Geo beacon for VF.

Dependencies:   MMA8452 aconno_bsp adc52832_common

Committer:
jurica238814
Date:
Thu Aug 10 11:02:02 2017 +0000
Revision:
16:a338d2417fd5
Child:
18:e844d3e6ab88
Sh-sh implementation started. Does not work (sh-sh works but the scanner does not). Try to use UART for debugging (does not work).

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jurica238814 16:a338d2417fd5 1
jurica238814 16:a338d2417fd5 2 #define MAC_ADDR_SIZE_B (6)
jurica238814 16:a338d2417fd5 3
jurica238814 16:a338d2417fd5 4 // Template allows you to use 'constant' values on non-constant places (XD)
jurica238814 16:a338d2417fd5 5 template<uint8_t dataSize>
jurica238814 16:a338d2417fd5 6
jurica238814 16:a338d2417fd5 7 class ACKService{
jurica238814 16:a338d2417fd5 8 public:
jurica238814 16:a338d2417fd5 9 const static uint16_t ACK_SERVICE_UUID = 0xA000;
jurica238814 16:a338d2417fd5 10 const static uint16_t ACK_CHARA_UUID = 0xA001;
jurica238814 16:a338d2417fd5 11 const static uint16_t ACK_MAC_CHAR_UUID = 0xA002;
jurica238814 16:a338d2417fd5 12
jurica238814 16:a338d2417fd5 13 ACKService(BLEDevice &_ble, uint8_t *_initValues) : ble(_ble), ACK(ACK_CHARA_UUID, _initValues), MAC(ACK_MAC_CHAR_UUID, _initValues, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY){
jurica238814 16:a338d2417fd5 14 GattCharacteristic *charTable[] = {&ACK, &MAC}; // Add characteristick in table
jurica238814 16:a338d2417fd5 15 GattService AckService(ACK_SERVICE_UUID, charTable, sizeof(charTable)/sizeof(GattCharacteristic *));
jurica238814 16:a338d2417fd5 16 ble.addService(AckService); // Add service in the BLE
jurica238814 16:a338d2417fd5 17 }
jurica238814 16:a338d2417fd5 18 void updateMacAddress(uint8_t *MacAddress){
jurica238814 16:a338d2417fd5 19 ble.gattServer().write(MAC.getValueHandle(), MacAddress, MAC_ADDR_SIZE_B);
jurica238814 16:a338d2417fd5 20 }
jurica238814 16:a338d2417fd5 21 private:
jurica238814 16:a338d2417fd5 22 BLEDevice &ble;
jurica238814 16:a338d2417fd5 23 // Create new characteristic
jurica238814 16:a338d2417fd5 24 WriteOnlyArrayGattCharacteristic<uint8_t, dataSize> ACK;
jurica238814 16:a338d2417fd5 25 ReadOnlyArrayGattCharacteristic<uint8_t, MAC_ADDR_SIZE_B> MAC;
jurica238814 16:a338d2417fd5 26 };