I wrote a little app to advertise Generic Access Service characteristics. When I run the code, the service shows up, but the characteristics do not. Any ideas?
#include "Particle.h"
SYSTEM_MODE(MANUAL); // No Particle Mesh used
const char * devName = "MyDevice";
const unsigned long UPDATE_INTERVAL_MS = 1000;
unsigned long lastUpdate = 0;
BleAdvertisingData advData;
BleUuid genericAccessService(BLE_SIG_UUID_GENERIC_ACCESS_SVC);
BleCharacteristic deviceNameCharacteristic("devName",
BleCharacteristicProperty::NOTIFY,
BleUuid(BLE_SIG_UUID_DEVICE_NAME_CHAR), genericAccessService);
BleCharacteristic deviceAppearanceCharacteristic("devAppearance",
BleCharacteristicProperty::NOTIFY,
BleUuid(BLE_SIG_UUID_APPEARANCE_CHAR), genericAccessService);
void setup() {
BLE.addCharacteristic(deviceNameCharacteristic);
BLE.addCharacteristic(deviceAppearanceCharacteristic);
advData.appendServiceUUID(genericAccessService);
deviceNameCharacteristic.setValue(devName);
deviceAppearanceCharacteristic.setValue(BLE_SIG_APPEARANCE_GENERIC_TAG);
BLE.advertise(&advData);
}
void loop() {
if ( millis() - lastUpdate >= UPDATE_INTERVAL_MS ) {
lastUpdate = millis();
if ( BLE.connected() ) {
deviceNameCharacteristic.setValue(devName);
deviceAppearanceCharacteristic.setValue(BLE_SIG_APPEARANCE_GENERIC_TAG);
}
}
}