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.

cc2541: GATT_Notification handling in gatt client

Part Number: CC2541

hi,

I'm using SimplebleCentral project running in cc2541 keyfob(central) and i have HidKbdEmu project in another custom keypad (peripheral). i have to send notifications from peripheral to central device when key is pressed or released. i have code for sending notifications. But i dont know how this notification is handled in the central device(gatt client).

  • Hi Athul,

    SimpleBLECentral does not include the code for notification handling. To see an example, you can look at how it is done in the Glucose Collector project. You will have to modify simpleBLECentralProcessGATTMsg to catch ATT_HANDLE_VALUE_NOTI messages as seen in glucCollProcessGATTMsg.
  • I am using a keypad with cc2541 with modified Hidemukbd code is running in it. i want to send keypress/key release event from the gatt server.i.e, peripheral keypad. how these key press/release notifications are received in gatt client where simpleblecentral is running..?

  • Hi Athul,

    You will have to add them similar to how the GATT Notifications are processed in the Glucose Collector project. SimpleBLECentral processes GATT messages in simpleBLECentralProcessGATTMsg(). You have to add code to catch ATT_HANDLE_VALUE_NOTI messages as seen in glucCollProcessGATTMsg in the Glucose Collector project. Did you look at the Glucose Collector project after my last post?
  • I have gone through glucose collector project. i added the ATT_HANDLE_VALUE_NOTI in simpleBLECentralProcessGATTMsg. but when i press a key in peripheral(gatt server), i am not receiving GATT_MSG_EVENT. is there anything to be done with the keyboard profile and service/characteristics uuid ? how the service,characteristics discovery is done?

  • Hi Athul,

    In your original post you said "i have code for sending notifications". Did the Central write to the CCCD of the Peripheral device to enable notifications? Are you sure the notifications are being sent by the Peripheral? Please send a sniffer capture if the peripheral is sending notifications that are not being received by the Central.

    If you need a better understanding of what steps are necessary to send and receive notifications, you can go through the Custom Profile lab in SimpleLink Academy. The instructions are written for the CC2640R2 but the GATT information should be similar enough to give you a better understanding of what to do. dev.ti.com/.../
  • Hi Rachel,

    Thanks for your reply.

    How Central write to the CCCD of the Peripheral device to enable notifications? is it include in SimpleBleCentral project or Glucosecollector project?

  • Part Number: CC2541

    hi,

    i want to implement a central device using the simpleBLECentral project which can be connected to a keypad running keyfob project in it. i was able to connect to the device, but couldnt make data transfer from the keyfob to SimpleBLECentral. how can i make use of  simplekeys profile in simplleblecentral (gatt client) to receive button press event from the keyfob(gatt server).how to do this?

  • Hi Athul,

    I've merged your new thread with your old one to keep all the information in one place. I am not sure I understand which side you are having trouble with.

    Can you run the Glucose Sensor and Glucose Connector project? These 2 work together and may be able to clear up some of the confusion you are having about enabling notifications. The Glucose Connector and Glucose Sensor project are explained in detail in the TI BLE Sample Applications guide.

    Please go through the following steps.
    1. Send a GATT Write from the Central to the CCCD for your Notification characteristic on your Peripheral
    2. Change the value of the Notification characteristic on your Peripheral. Do you see notifications over the air?
    3. Process incoming notifications on your Central device. Are you receiving the notifications sent over the air?
  • I have added some modifications in the Glucose Sensor and Glucose Connector projects. the two devices are connected. but after that, the service discovery is not happening. STARt_DISCOVERY_EVT is not happening and hence glucCollCentralStartDiscovery() is not called. what may be the reason?
  • Hi Athul,

    What modifications did you make to the project? Without knowing what you added, it's hard to say why START_DISCOVERY_EVT never happens. Was the demo example working before your modifications?
  • Hi Rachel,
    now i am able to discover the service. what are the steps for enabling notification for SK_KEYPRESSED_UUID ? I want to receive notifications for key press and release.
  • Hi Athul,

    As mentioned in Chapter 7.2.4 of the TI BLE Sample Applications Guide, the Glucose Collector project will configure notifications automatically. You can see this behavior in glucoseConfigNext():

        // Set notification for these characteristics
        case HDL_GLUCOSE_MEAS_CCCD:
        case HDL_GLUCOSE_CONTEXT_CCCD:
          read = FALSE;
          charCfg = GATT_CLIENT_CFG_NOTIFY;
          break;
          
        // Set indication for these characteristics
        case HDL_GLUCOSE_CTL_PNT_CCCD:
          read = FALSE;
          charCfg = GATT_CLIENT_CFG_INDICATE;
          break;

    Later in the function, the GATT_WriteCharValue function is called using the information above.