Bluetooth Low Energy and Stepper Motor enabled device, compatible with the BlueST Protocol.
Dependencies: X_NUCLEO_IHM01A1
Bluetooth Low Energy and Stepper Motor enabled device, compatible with the BlueST Protocol.
Diff: source/main.cpp
- Revision:
- 1:84935552ca4d
- Parent:
- 0:f87cdc08dcd1
- Child:
- 2:b51fb6efcd55
--- a/source/main.cpp Tue Apr 17 14:59:28 2018 +0000 +++ b/source/main.cpp Thu May 10 12:18:51 2018 +0000 @@ -66,7 +66,7 @@ //DigitalOut alivenessLED(LED1, 0); //Conflicts with SPI CLK on D13 /* Bluetooth. */ -const static char DEVICE_NAME[] = "SHUTTER_DEVICE"; +const static char DEVICE_NAME[] = "MOTOR_DEVICE"; const static uint8_t MANUFACTURER_SPECIFIC_DATA[]= {0x01,0x80,0x00,0x00,0x20,0x00}; static EventQueue event_queue(/* event count */ 10 * EVENTS_EVENT_SIZE); CustomService *custom_service; @@ -138,7 +138,7 @@ } } } - + /** * This callback allows the custom service to write updates to the * characteristic. @@ -236,7 +236,7 @@ ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS, (uint8_t *) CUSTOM_STEPPER_MOTOR_SERVICE_UUID, sizeof(CUSTOM_STEPPER_MOTOR_SERVICE_UUID)); ble.gap().accumulateScanResponse(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, MANUFACTURER_SPECIFIC_DATA, sizeof(MANUFACTURER_SPECIFIC_DATA)); - ble.gap().accumulateScanResponse(GapAdvertisingData::COMPLETE_LOCAL_NAME, (const uint8_t *) DEVICE_NAME, sizeof(DEVICE_NAME)); + ble.gap().accumulateScanResponse(GapAdvertisingData::COMPLETE_LOCAL_NAME, (const uint8_t *) DEVICE_NAME, sizeof(DEVICE_NAME) - 1); ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); ble.gap().setAdvertisingInterval(BLE_ADVERTISING_INTERVAL_ms); ble.gap().startAdvertising();