This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2540: CC2540 - Characteristic 4 (Notification) -

Part Number: CC2540


Hi,

I am new to CC2540.

Am I correct to say that, for CC2540 simpleBLEperipherial project, Characteristic 4 notification will notify whenever there is a change in value right?

Currently I am able to get my temperature reading (which has newly sample reading every 5sec), and i would like characteristic 4 to notify that temperature reading on ios app every time sensor has new reading. And the ios app i use is called LightBlue, which can turn on notification easily.

So my question is, which part of "simpleGATTprofile.c" code i need to add in my temperature reading to get notified as Characteristic 4 value?

Thank you.

Regards,

LB

  • Hi LzBone,
    Can you explain more detail? I dont understand your mean. Device only can send data to app when properties of characteristic is notify. You cannot use app to write data to device with notify properties. If you want to write, you have to add write option into properties
  • Hi Luu Vy,

    Thanks for the reply. Allow me to elaborate more.

    For simpleBLEperipheral project. There are 5 characteristics already defined inside right. They are as follows:

    Characteristic 1 - read and write
    Characteristic 2 - read only
    Characteristic 3 - write only
    Characteristic 4 - notification only
    Characteristic 5 - read only (for paired)

    As of now, I am able to put my temperature reading as Characteristic 2's value.

    As such, after i connect my cc2540 to my ios app, under the ios app characteristic 2 read, i can press read button in ios app to read the temperature reading(which is characteristics 2's value).

    The thing is, i have to keep pressing "read button" in ios to see the changes in temperature.

    I don't want to do that. So I am wondering, how can i use Characteristic 4's notification to keep sending updated temperature reading from cc2540 to my ios.

    Thank you.


    Regards,
    LB
  • Hi LzBone,
    You can set the event to call SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR4, sizeof(uint8), &valueToCopy).
  • Hi Luu Vy,

    That's is exactly the place iIam looking for.

    I just try this morning and it works as the way I want it to be.

    Thanks a lot indeed for your kind help. Really appreciate it. :)

    Regards,

    LB