4343struct DigitalPinConfig {
4444 unsigned pin;
4545 const char *name;
46- BleUnsignedCharCharacteristic characteristic;
47- BleDescriptor userDescription;
48- BleDescriptor presentationFormat;
49- BleDescriptor numDigitalsDesc;
46+ BLEUnsignedCharCharacteristic characteristic;
47+ BLEDescriptor userDescription;
48+ BLEDescriptor presentationFormat;
49+ BLEDescriptor numDigitalsDesc;
5050 uint8_t val;
5151};
5252
5353struct AnalogPinConfig {
5454 unsigned pin;
5555 const char *name;
56- BleUnsignedShortCharacteristic characteristic;
57- BleDescriptor userDescription;
58- BleDescriptor presentationFormat;
56+ BLEUnsignedShortCharacteristic characteristic;
57+ BLEDescriptor userDescription;
58+ BLEDescriptor presentationFormat;
5959 uint16_t val;
6060};
6161
6262/* Macros to simplify the definition of a new PinConfig struct for a given pin number
6363 * Note that input pins are only readable by the remote device, while output pins are
6464 * only writable. Different characteristic UUIDs are used for digital and analog pins */
6565#define DIGITAL_INPUT_PINCONFIG (pin ) \
66- { (pin), #pin, {CHAR_UUID_DIGITAL, BleRead | BleNotify }, {" 2901" , #pin}, {" 2904" , (uint8_t []){0x02 , 0x00 , 0x00 , 0x027 , 0x1 , pin + 1 , 00 }, 7 }, {DESC_UUID_NUMDIGITALS, (uint8_t []){1 }, sizeof (uint8_t )} }
66+ { (pin), #pin, {CHAR_UUID_DIGITAL, BLERead | BLENotify }, {" 2901" , #pin}, {" 2904" , (uint8_t []){0x02 , 0x00 , 0x00 , 0x027 , 0x1 , pin + 1 , 00 }, 7 }, {DESC_UUID_NUMDIGITALS, (uint8_t []){1 }, sizeof (uint8_t )} }
6767#define DIGITAL_OUTPUT_PINCONFIG (pin ) \
68- { (pin), #pin, {CHAR_UUID_DIGITAL, BleWriteWithoutResponse | BleWrite }, {" 2901" , #pin}, {" 2904" , (uint8_t []){0x02 , 0x00 , 0x00 , 0x027 , 0x1 , pin + 1 , 00 }, 7 }, {DESC_UUID_NUMDIGITALS, (uint8_t []){1 }, sizeof (uint8_t )} }
68+ { (pin), #pin, {CHAR_UUID_DIGITAL, BLEWriteWithoutResponse | BLEWrite }, {" 2901" , #pin}, {" 2904" , (uint8_t []){0x02 , 0x00 , 0x00 , 0x027 , 0x1 , pin + 1 , 00 }, 7 }, {DESC_UUID_NUMDIGITALS, (uint8_t []){1 }, sizeof (uint8_t )} }
6969#define ANALOG_INPUT_PINCONFIG (pin ) \
70- { (pin), #pin, {CHAR_UUID_ANALOG, BleRead | BleNotify }, {" 2901" , #pin}, {" 2904" , (uint8_t []){0x6 , 0x00 , 0x00 , 0x027 , 0x1 , pin + 1 , 00 }, 7 } }
70+ { (pin), #pin, {CHAR_UUID_ANALOG, BLERead | BLENotify }, {" 2901" , #pin}, {" 2904" , (uint8_t []){0x6 , 0x00 , 0x00 , 0x027 , 0x1 , pin + 1 , 00 }, 7 } }
7171#define ANALOG_OUTPUT_PINCONFIG (pin ) \
72- { (pin), #pin, {CHAR_UUID_ANALOG, BleWriteWithoutResponse | BleWrite }, {" 2901" , #pin}, {" 2904" , (uint8_t []){0x6 , 0x00 , 0x00 , 0x027 , 0x1 , pin + 1 , 00 }, 7 } }
72+ { (pin), #pin, {CHAR_UUID_ANALOG, BLEWriteWithoutResponse | BLEWrite }, {" 2901" , #pin}, {" 2904" , (uint8_t []){0x6 , 0x00 , 0x00 , 0x027 , 0x1 , pin + 1 , 00 }, 7 } }
7373
7474/* The following lists of pins are configured and presented to
7575 * the remote BLE device as digital/analog input/output pins
@@ -111,10 +111,10 @@ struct AnalogPinConfig analogOutputPins[] = {
111111};
112112
113113/* BLE Peripheral Device (this Intel Curie device) */
114- BlePeripheral blePeripheral;
114+ BLEPeripheral blePeripheral;
115115
116116/* BLE Automation I/O Service */
117- BleService ioService (SERVICE_UUID_AUTOMATIONIO);
117+ BLEService ioService (SERVICE_UUID_AUTOMATIONIO);
118118
119119/* The standard allows for multiple digital pins to be included per characteristic,
120120 * where the pin states are encapsulated as an array of 2-bit values
@@ -145,18 +145,18 @@ BleService ioService(SERVICE_UUID_AUTOMATIONIO);
145145
146146/* This function will be called when a BLE GAP event is detected by the
147147 * Intel Curie BLE device */
148- void blePeripheralConnectedEventCb (BleCentral &bleCentral)
148+ void blePeripheralConnectedEventCb (BLECentral &bleCentral)
149149{
150150 LOG_SERIAL.println (" Got CONNECTED event" );
151151}
152152
153- void blePeripheralDisconnectedEventCb (BleCentral &bleCentral)
153+ void blePeripheralDisconnectedEventCb (BLECentral &bleCentral)
154154{
155155 LOG_SERIAL.println (" Got DISCONNECTED event" );
156156}
157157
158158/* This function will be called when a connected remote peer sets a new value for a digital output characteristic */
159- void digitalOutputCharWrittenEventCb (BleCentral ¢ral, BleCharacteristic &characteristic)
159+ void digitalOutputCharWrittenEventCb (BLECentral ¢ral, BLECharacteristic &characteristic)
160160{
161161 for (unsigned int i = 0 ; i < ARRAY_SIZE (digitalOutputPins); i++) {
162162 if (&digitalOutputPins[i].characteristic == &characteristic) {
@@ -172,7 +172,7 @@ void digitalOutputCharWrittenEventCb(BleCentral ¢ral, BleCharacteristic &cha
172172}
173173
174174/* This function will be called when a connected remote peer sets a new value for an analog output characteristic */
175- void analogOutputCharWrittenEventCb (BleCentral ¢ral, BleCharacteristic &characteristic)
175+ void analogOutputCharWrittenEventCb (BLECentral ¢ral, BLECharacteristic &characteristic)
176176{
177177 for (unsigned int i = 0 ; i < ARRAY_SIZE (analogOutputPins); i++) {
178178 if (&analogOutputPins[i].characteristic == &characteristic) {
@@ -193,8 +193,8 @@ void setup() {
193193 CHECK_STATUS (blePeripheral.setLocalName (LOCAL_NAME));
194194
195195 /* Set a function to be called whenever a BLE GAP event occurs */
196- blePeripheral.setEventHandler (BleConnected , blePeripheralConnectedEventCb);
197- blePeripheral.setEventHandler (BleDisconnected , blePeripheralDisconnectedEventCb);
196+ blePeripheral.setEventHandler (BLEConnected , blePeripheralConnectedEventCb);
197+ blePeripheral.setEventHandler (BLEDisconnected , blePeripheralDisconnectedEventCb);
198198
199199 CHECK_STATUS (blePeripheral.setAdvertisedServiceUuid (ioService.uuid ()));
200200
@@ -229,7 +229,7 @@ void setup() {
229229 /* Add the characteristic for this pin */
230230 CHECK_STATUS (blePeripheral.addAttribute (pin->characteristic ));
231231 /* Add a callback to be triggered if the remote device updates the value for this pin */
232- pin->characteristic .setEventHandler (BleWritten , digitalOutputCharWrittenEventCb);
232+ pin->characteristic .setEventHandler (BLEWritten , digitalOutputCharWrittenEventCb);
233233 /* Add a number_of_digitals descriptor for this characteristic */
234234 CHECK_STATUS (blePeripheral.addAttribute (pin->userDescription ));
235235 CHECK_STATUS (blePeripheral.addAttribute (pin->presentationFormat ));
@@ -258,7 +258,7 @@ void setup() {
258258 CHECK_STATUS (blePeripheral.addAttribute (pin->userDescription ));
259259 CHECK_STATUS (blePeripheral.addAttribute (pin->presentationFormat ));
260260 /* Add a callback to be triggered if the remote device updates the value for this pin */
261- pin->characteristic .setEventHandler (BleWritten , analogOutputCharWrittenEventCb);
261+ pin->characteristic .setEventHandler (BLEWritten , analogOutputCharWrittenEventCb);
262262 }
263263
264264 /* Now activate the BLE device. It will start continuously transmitting BLE
0 commit comments