This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Get BLE data notifications in ubuntu

I defined custom service (NRF51822,S110) to send sensor data. Code follows. Here I enabled notifications for new data. I can able to receive data, if I enabled notification in NRFconnect app in Android and windows. But I am not able to enable notification in ubuntu 16.04 . I am using bluez gatttool. To get notification I send this command "char-write-req 0x000e 0100" from command line. Please Help me to fix this issue.

Code

{

ble_gatts_char_md_t char_md;
ble_gatts_attr_t attr_char_value;
ble_uuid_t ble_uuid;
ble_gatts_attr_md_t attr_md;

memset(&char_md, 0, sizeof(char_md));
char_md.char_props.notify = 1;

ble_uuid.type = p_ms->uuid_type;
ble_uuid.uuid = MS_UUID_SENSOR;

memset(&attr_md, 0, sizeof(attr_md));

BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm);
attr_md.vloc = BLE_GATTS_VLOC_STACK;

memset(&attr_char_value, 0, sizeof(attr_char_value));

attr_char_value.p_uuid = &ble_uuid;
attr_char_value.p_attr_md = &attr_md;
attr_char_value.init_len = 12;
attr_char_value.init_offs = 0;
attr_char_value.max_len = 12;

return sd_ble_gatts_characteristic_add(p_ms->service_handle,
&char_md,
&attr_char_value,
&p_ms->msm_handles);}

Parents Reply Children
Related