Bluetooth: Use Characteristic attribute whenever possible

With updates to bt_gatt_notify and bt_gatt_indicate it is now possible
to pass the Characteristic attribute instead of its value which makes
the code able to verify if attribute properties are set correctly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2018-06-07 14:17:32 +03:00 committed by Anas Nashif
parent 679a0b395f
commit 68de9d5d66
6 changed files with 8 additions and 8 deletions

View File

@ -69,5 +69,5 @@ void bas_notify(void)
battery = 100;
}
bt_gatt_notify(NULL, &attrs[2], &battery, sizeof(battery));
bt_gatt_notify(NULL, &attrs[1], &battery, sizeof(battery));
}

View File

@ -110,5 +110,5 @@ void cts_notify(void)
}
ct_update = 0;
bt_gatt_notify(NULL, &attrs[3], &ct, sizeof(ct));
bt_gatt_notify(NULL, &attrs[1], &ct, sizeof(ct));
}

View File

@ -78,5 +78,5 @@ void hrs_notify(void)
hrm[0] = 0x06; /* uint8, sensor contact */
hrm[1] = heartrate;
bt_gatt_notify(NULL, &attrs[2], &hrm, sizeof(hrm));
bt_gatt_notify(NULL, &attrs[1], &hrm, sizeof(hrm));
}

View File

@ -246,7 +246,7 @@ static void ctrl_point_ind(struct bt_conn *conn, u8_t req_op, u8_t status,
memcpy(ind->data, data, data_len);
}
bt_gatt_notify(conn, &csc_attrs[9], buf, sizeof(buf));
bt_gatt_notify(conn, &csc_attrs[8], buf, sizeof(buf));
}
struct csc_measurement_nfy {
@ -299,7 +299,7 @@ static void measurement_nfy(struct bt_conn *conn, u32_t cwr, u16_t lwet,
memcpy(nfy->data + len, &data, sizeof(data));
}
bt_gatt_notify(NULL, &csc_attrs[2], buf, sizeof(buf));
bt_gatt_notify(NULL, &csc_attrs[1], buf, sizeof(buf));
}
static u16_t lwet; /* Last Wheel Event Time */

View File

@ -541,6 +541,6 @@ void ble_init(void)
bt_conn_cb_register(&conn_callbacks);
local_attr = &pong_attrs[2];
local_attr = &pong_attrs[1];
bt_gatt_service_register(&pong_svc);
}

View File

@ -885,13 +885,13 @@ static int proxy_send(struct bt_conn *conn, const void *data, u16_t len)
#if defined(CONFIG_BT_MESH_GATT_PROXY)
if (gatt_svc == MESH_GATT_PROXY) {
return bt_gatt_notify(conn, &proxy_attrs[4], data, len);
return bt_gatt_notify(conn, &proxy_attrs[3], data, len);
}
#endif
#if defined(CONFIG_BT_MESH_PB_GATT)
if (gatt_svc == MESH_GATT_PROV) {
return bt_gatt_notify(conn, &prov_attrs[4], data, len);
return bt_gatt_notify(conn, &prov_attrs[3], data, len);
}
#endif