cancel
Showing results for 
Search instead for 
Did you mean: 

How can I access to the SENSORDEMO_GET_TEMPERATURE() of the BlueNRG GUI ?

Sylvain Pétré
Associate
Posted on February 19, 2018 at 12:32

Hello everyone,

I try to build a notification of the temperature characteristic of the SensorDemo example from de BlueNRG GUI. Unfortonatelly, that doesn't work. I follow the same scheme of the Notification for Acceleration Characteristic but that doesn't work.

Anyone know how I can access to the function SENSORDEMO_GET_TEMPERATURE() ?

Here's the code I have add to the SensorDemo_Central python script :

♯ Enable Notification for Temperature Characteristic

&sharpThe handle of descriptor is equal to temp_attr_handle+2

status=  ACI_GATT_WRITE_CHAR_VALUE(Connection_Handle=conn_handle, Attr_Handle=temp_attr_handle+2, Attribute_Val_Length=2, Attribute_Val=0x0001)

if (status != 0x00):

    ERROR( 'ENABLE NOTIFICATION FOR TEMPERATURE CHARACTERISTIC FAILED')

e = WAIT_EVENT(HCI_VENDOR_EVENT, timeout=30, Ecode=ACI_GATT_PROC_COMPLETE_EVENT)

&sharpReceive Notifications

while(True):

    e = WAIT_EVENT(HCI_VENDOR_EVENT)

    eCode = e.get_param('Ecode').val

    if (eCode == ACI_GATT_NOTIFICATION_EVENT):

        if e.get_param('Attribute_Handle').val == freeFall_attr_handle+1:

            PRINT('---FREE FALL---')

        elif e.get_param('Attribute_Handle').val == temp_attr_handle+1:

        PRINT ('Ok')

        PRINT ( 'READ TEMPERATURE CHARAC -> ' + str(SENSORDEMO_GET_TEMPERATURE(e.get_param('Attribute_Value').val)))

The last line of this code give me an error.

Thanks in advance,

Sylvain.

#sensordemo #bluenrg
0 REPLIES 0