-
-
Notifications
You must be signed in to change notification settings - Fork 283
Closed
Description
Hi, I am having trouble understanding the BLECharacteristic templates, and implementing the .ino example code in .cpp. Specifically, adding a typed BLECharacteristic (eg. BLEUnsignedLongCharacteristic) to a service. I have also reviewed the .cpp code that the Arduino IDE generates, and find that XCode IDE still won't compile it. Using master head of CurieBLE library Code and compiler error below (which follows patterns in the LED and LEDCallback examples provided):
BLEPeripheral blePeripheral;
BLEService service = BLEService("8888888-5555-1234-5678-D104768A1214");
BLEUnsignedCharCharacteristic failedChar = BLEUnsignedCharCharacteristic("8888888-5555-1235-5678-D104768A1214", BLERead | BLEWrite);
BLECharacteristic workingChar = BLECharacteristic(""8888888-5555-1236-5678-D104768A1214"", BLERead | BLEWrite , 1);
int main(int argc, const char * argv[]) {
service.addServiceToPeripheral(blePeripheral);
service.addCharacteristic(workingChar);
//throws error in XCode:
//non-const !value reference to type "BLECharacteristic" cannot bind to value of unrelated type "BLEUnsignedLongCharacteristic"
service.addCharacteristic(failedChar);
}
As an aside, perhaps examples could be given in .cpp and .ino?