BLE_Health_Thermometer for mbed HRM1017 with BLE library 0.1.0
Dependencies: BLE_API TMP102 mbed nRF51822
Fork of BLE_Health_Thermometer2 by
Diff: main.cpp
- Revision:
- 6:490217968616
- Parent:
- 5:ab8889077be9
--- a/main.cpp Sat Sep 06 08:06:19 2014 +0000 +++ b/main.cpp Tue Sep 09 12:31:39 2014 +0000 @@ -13,7 +13,7 @@ #define DEBUG(...) /* nothing */ #endif /* #if NEED_CONSOLE_OUTPUT */ -const static char DEVICE_NAME[] = "HRM1017_HTM"; +const uint8_t DEVICE_NAME[] = "HRM1017_HTM"; static volatile bool triggerSensorPolling = false; BLEDevice ble; @@ -43,8 +43,8 @@ GattService battService(GattService::UUID_BATTERY_SERVICE, battChars, sizeof(battChars) / sizeof(GattCharacteristic *)); -uint16_t uuid16_list[] = {GattService::UUID_HEALTH_THERMOMETER_SERVICE, - GattService::UUID_BATTERY_SERVICE}; +uint16_t uuid16_list[] = {GattService::UUID_HEALTH_THERMOMETER_SERVICE, + GattService::UUID_BATTERY_SERVICE}; uint32_t quick_ieee11073_from_float(float temperature); void updateServiceValues(void); @@ -107,6 +107,7 @@ ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t*)uuid16_list, sizeof(uuid16_list)); ble.accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_THERMOMETER); ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME)); + ble.setDeviceName(DEVICE_NAME); ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */ ble.startAdvertising();