for camera
Dependencies: BLE_API mbed nRF51822
Fork of BLE_GATT_Example by
Diff: main.cpp
- Revision:
- 32:f775b63b66f9
- Parent:
- 31:e28a1c47859a
- Child:
- 33:65b7bedb0877
--- a/main.cpp Sat Jun 10 20:34:31 2017 +0000 +++ b/main.cpp Mon Jun 12 22:10:46 2017 +0000 @@ -2,18 +2,22 @@ #include "ble/BLE.h" DigitalOut led(P0_4, 0); -uint16_t customServiceUUID = 0xA000; +uint16_t customServiceUUID = 0xFFFF; uint16_t readCharUUID = 0xA001; uint16_t writeCharUUID = 0xA002; const static char DEVICE_NAME[] = "timesync1"; // change this -static const uint16_t uuid16_list[] = {0xFFFF}; //Custom UUID, FFFF is reserved for development +static const uint16_t uuid16_list[] = {0xA000}; //Custom UUID, FFFF is reserved for development + + +static uint8_t readValue[10] = {0}; +ReadOnlyArrayGattCharacteristic<uint8_t, sizeof(readValue)> readChar(readCharUUID, readValue); static uint8_t writeValue[10] = {0}; WriteOnlyArrayGattCharacteristic<uint8_t, sizeof(writeValue)> writeChar(writeCharUUID, writeValue); /* Set up custom service */ -GattCharacteristic *characteristics[] = {&writeChar}; +GattCharacteristic *characteristics[] = {&readChar, &writeChar}; GattService customService(customServiceUUID, characteristics, sizeof(characteristics) / sizeof(GattCharacteristic *)); /* @@ -57,7 +61,7 @@ ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); // advertising type ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); // add name ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t *)uuid16_list, sizeof(uuid16_list)); // UUID's broadcast in advertising packet - ble.gap().setAdvertisingInterval(500); // 500ms. + ble.gap().setAdvertisingInterval(400); // 500ms. /* Add our custom service */ ble.addService(customService);