Reply
Posts: 6
Registered: ‎05-08-2017

How to add the field structure of GATT Characteristics manually

Hello,

 

I need help regarding the Bluetooth example mentioned in qsg139. On page 19 it is mentioned that one has to add field structure of GATT Characteristics manually. Being new to this development I kind of stuck on how to do it. And also how to modify the value of your characteristic in the database afterward. The commands that are mentioned, I am not sure how and where to use them.

 

Thank you.

Posts: 109
Registered: ‎07-27-2015

Re: How to add the field structure of GATT Characteristics manually

Hi,

 

This is not a pre-defined thing, I mean, the structure depends on your requirement. So let's still take the current time as an example, we can see it's defined in the document to be:

PACKSTRUCT(struct date_time_t{
uint16 year;
uint8 month;
uint8 day;
uint8 hours;
uint8 minutes;
uint8 seconds;
});

 

If I don't care about the year, month and day, I only care the time in one day, then I can define my structure to be:

PACKSTRUCT(struct my_time_t{
uint8 hours;
uint8 minutes;
uint8 seconds;
});

 

So it's flexiable and you need to define and optimize it by yourself.

 

Thanks,

Kevin

Posts: 16
Registered: ‎08-02-2017

Re: How to add the field structure of GATT Characteristics manually

But where does that have to be written?

I follow the qsg139 document, but when I get to the characteristics I don't know what to do.

And if I don't do anything in the application in unknown only appears current time but not year, month...

Thank you.

 

Posts: 109
Registered: ‎07-27-2015

Re: How to add the field structure of GATT Characteristics manually

Hi,

 

The current time shuold be sent to the peer device by bytes, so you can see from the function it has been changed to uint8_t buffer((uint8_t *)&current_time). So you need to get it back to struct or parse it by yourself in your application.

 

Thanks,

Kevin