The cube puck updates its gatt attributes on rotation. Listen in!

Dependencies:   BLE_API MPU6050 mbed nRF51822

Fork of cube-puck by Nordic Pucks

Committer:
aleksanb
Date:
Wed Jul 09 15:02:59 2014 +0000
Revision:
2:b9b42ff80e9a
Parent:
0:449ee9595cf6
Update cube direction and Gatt in ticker handler. Enable Gatt notifications for subscribers.; ; This resolves issue where IMU suddenly would die on itself due too high; query frequency.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
aleksanb 0:449ee9595cf6 1 #include "BLEDevice.h"
aleksanb 0:449ee9595cf6 2
aleksanb 0:449ee9595cf6 3 uint8_t uuid_array_service[16] = {'b', 'f', 't', 'j', ' ', 'c', 'u', 'b', 'e', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
aleksanb 0:449ee9595cf6 4 uint8_t uuid_array_direction[16] = {'b', 'f', 't', 'j', ' ', 'c', 'u', 'b', 'e', ' ', 'd', 'i', 'r', 'c', 't', 'n' };
aleksanb 0:449ee9595cf6 5
aleksanb 0:449ee9595cf6 6 const UUID uuid_service = UUID(uuid_array_service);
aleksanb 0:449ee9595cf6 7 const UUID uuid_direction = UUID(uuid_array_direction);
aleksanb 0:449ee9595cf6 8
aleksanb 0:449ee9595cf6 9 uint8_t direction_data[1] = {6};
aleksanb 0:449ee9595cf6 10
aleksanb 0:449ee9595cf6 11 GattCharacteristic directionCharacteristic(
aleksanb 0:449ee9595cf6 12 uuid_direction,
aleksanb 0:449ee9595cf6 13 direction_data,
aleksanb 0:449ee9595cf6 14 sizeof(direction_data),
aleksanb 0:449ee9595cf6 15 sizeof(direction_data),
aleksanb 2:b9b42ff80e9a 16 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ
aleksanb 2:b9b42ff80e9a 17 | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY);
aleksanb 0:449ee9595cf6 18
aleksanb 0:449ee9595cf6 19 GattCharacteristic *characteristics[] = {&directionCharacteristic};
aleksanb 0:449ee9595cf6 20 GattService cube_service(uuid_service,
aleksanb 0:449ee9595cf6 21 characteristics,
aleksanb 0:449ee9595cf6 22 sizeof(characteristics) / sizeof(GattCharacteristic *));
aleksanb 0:449ee9595cf6 23