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 Simple BLE Peripheral Sending Notification to Mobile App

Other Parts Discussed in Thread: CC2540

Hi all,

I am trying to write an iOS app that reads characteristics from SimpleBLEPeripheral through notifications. I believe characteristic 4 is configured to enable notification, but I was not able to read that to iOS. I read from other posts that I need to turn on a configuration. I tried GATTServApp_WriteCharCfg(connHandle,simpleProfileChar4Config,GATT_CLIENT_CFG_NOTIFY), but it didn't work. Can anyone help me on how to turn on notification?

Thanks,

Chushi

  • Hello Chushi,


    Indeed, you must enable Notifications in the associated Client Characteristic Config, but this must be done by the Client, or iOS in your case. See the "Subscribing to a Characteristic’s Value" section of the Core Bluetooth Programming Guide (Apple).

    Best wishes

  • Hi JXS,

    Thanks for the response. I tried following the Apple guide to enable notification using [peripheral setNotifyValue:YES forCharacteristic:interestingCharacteristic]; (of course I set the peripheral and characteristic to the corresponding CC2540 SimpleBLEPeripheral. However, I am still not able to read any value in 

    - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic

    Is there any other operation I need to do to subscribe notifications?

    Thanks,

    Chushi

  • Hello Chushi,

    I would first use Light Blue to verify your methodology. With SimpleBLEPeripheral programmed to the peripheral, Connect with Light Blue, listen for Notifications on Char4, then write a byte to Char3. You should see that value in the Notification on Char4.

    If you are not able to replicate this, I would suggest following up on a forum dedicated to iOS programming.

    Best wishes
  • Hi JXS,

    I was able to read the notification in Light Blue. I then noticed an error in the iOS code, I was able to subscribe notification value after I fixed that. Thank you very much for the help.

    Chushi