4 Replies Latest reply on Jan 9, 2015 5:18 AM by userc_4967

    BCM20737 : enable notification on a new characteristic

      Hi

       

      I'm adding new characteristic to WICED sense. My new UUID is correctly listed by a tool like lightblue.

      It needs to support read & notify.

       

      When i read the wiced sens source code, i saw this function :

       

      blecm_connectionEventNotifiationEnable((void (*)(void*, UINT32))wiced_sense_tx_opportunity_notice, 0, 6250/625, 30000/625, wiced_sense_connection_handle);

       

      i assume that NOTIFY is enabled in the GATT database declaration (with LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY). I've done it.

       

      but how i can differenciate notification coming from UUID A and UUID B ?

       

      my idea is to get access to UUID and change the PDU depending on the received UUID.

       

      is there anybody who know how to deal with notification, especially when there is multiple UUID with read/notify possibility, please ?

       

      thank you a lot

       

      best regards

        • 1. Re: BCM20737 : enable notification on a new characteristic
          MichaelF_56

          I spoke to the developers about this issue today and they confirmed that when you perform a GATT discovery, this will tell you which handle applies to which UUID (both values are passed, you cannot know the handle without the UUID).

           

          To setup notifications, you need to know the handle

          • 2. Re: BCM20737 : enable notification on a new characteristic

            hi,

             

            does it means that we need to pass the right handle (change wiced_sense_connection_handle) to this function to enable notification on specific UUID (on top of the GATT databasse declaration) ?

             

            blecm_connectionEventNotifiationEnable((void (*)(void*, UINT32))wiced_sense_tx_opportunity_notice, 0, 6250/625, 30000/625, wiced_sense_connection_handle);

             

            sorry but i'm a bit lost and i didn't find a correct / clean way to call a specific function to fill the right BLE packet content for a specific UUID.

             

            i have basically 3 UUID :

                 - WICED sense service (the one you created) : no problem

                 - UUID A : new service

                      - characteristic first_char

                      - characteristic second_char

             

            first_char & second_char are read only, and notification enable. The packet content is different.

             

            best regards

            • 3. Re: BCM20737 : enable notification on a new characteristic
              VictorZ_46

              I agree that it is a bit confusing.  The blecm_connectionEventNotifiationEnable function does not actually send or enable GATT notifications.  The function allows your application to register a callback to be called a few millisecond before something can be send up to the client.  The handle in the blecm_con... function is not the attribute handle (which is related to UUID), but it is a connection handle identifying connection if you are connected to multiple devices. 

               

              When your callback (for example wiced_sense_tx_opportunity_notice) is called, your application can send one or several GATT Notification.  When you are sending notifications you will need to use correct attribute handle in the bleprofile_sendnotification call.

               

              Please note that you do not need precise timing, you do not need to use blecm_con.. function at all.  Please see hello_sensor sample which sends notification without all these headaches.

              • 4. Re: BCM20737 : enable notification on a new characteristic

                that's ok. thank you for clarification.

                 

                i reviewed my code, and now i'm able to enbale/disable notification and received good datas.

                 

                thanks for the clarification !

                1 of 1 people found this helpful