Skip to content

Commit 2581cff

Browse files
committed
API Cleanup
1 parent 03c82d3 commit 2581cff

14 files changed

+135
-825
lines changed

libraries/CurieBle/examples/AutomationIO/AutomationIO.ino

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ void setup() {
217217
CHECK_STATUS(blePeripheral.addAttribute(pin->userDescription));
218218
CHECK_STATUS(blePeripheral.addAttribute(pin->presentationFormat));
219219
CHECK_STATUS(blePeripheral.addAttribute(pin->numDigitalsDesc));
220-
CHECK_STATUS(pin->numDigitalsDesc.setValue((uint8_t) 1));
221220
}
222221

223222
/* Add characteristics for the Digital Outputs */
@@ -235,7 +234,6 @@ void setup() {
235234
CHECK_STATUS(blePeripheral.addAttribute(pin->userDescription));
236235
CHECK_STATUS(blePeripheral.addAttribute(pin->presentationFormat));
237236
CHECK_STATUS(blePeripheral.addAttribute(pin->numDigitalsDesc));
238-
CHECK_STATUS(pin->numDigitalsDesc.setValue((uint8_t) 1));
239237
}
240238

241239
/* Add characteristics for the Analog Inputs */

libraries/CurieBle/examples/BatteryMonitor/BatteryMonitor.ino

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ BleService battSvc(SERVICE_UUID_BATTERY);
5353
/* BLE Battery Level Characteristic */
5454
BleUnsignedCharCharacteristic battLvlChar(CHAR_UUID_BATTERY_LEVEL, /* standard 16-bit characteristic UUID */
5555
BleRead | BleNotify /* remote clients will be able to get notifications if this characteristic changes */
56-
);
57-
58-
/* Bluetooth MAC address for this device */
59-
BleDeviceAddress localAddress;
56+
);
6057

6158
/* Variable to keep track of last battery level reading from analog input */
6259
unsigned char oldBattLvl = 0;

libraries/CurieBle/src/BleAddress.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

libraries/CurieBle/src/BleCentral.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,28 +29,32 @@ BleCentral::BleCentral(BlePeripheral* peripheral) :
2929
}
3030

3131
BleCentral::operator bool() const {
32-
BleDeviceAddress zero;
32+
ble_addr_t zero;
3333

3434
memset(&zero, 0, sizeof(zero));
3535

3636
return (memcmp(&_address, &zero, sizeof(_address)) != 0);
3737
}
3838

39-
bool BleCentral::operator==(const BleCentral& rhs) const {
39+
bool
40+
BleCentral::operator==(const BleCentral& rhs) const {
4041
return (memcmp(&_address, &rhs._address, sizeof(_address)) == 0);
4142
}
4243

43-
bool BleCentral::operator!=(const BleCentral& rhs) const {
44+
bool
45+
BleCentral::operator!=(const BleCentral& rhs) const {
4446
return !(*this == rhs);
4547
}
4648

47-
bool BleCentral::connected() {
49+
bool
50+
BleCentral::connected() {
4851
poll();
4952

5053
return (*this && *this == _peripheral->central());
5154
}
5255

53-
const char* BleCentral::address() const {
56+
const char*
57+
BleCentral::address() const {
5458
static String address = "";
5559

5660
for (int i = 5; i >= 0; i--) {
@@ -70,22 +74,26 @@ const char* BleCentral::address() const {
7074
return address.c_str();
7175
}
7276

73-
void BleCentral::poll() {
77+
void
78+
BleCentral::poll() {
7479
_peripheral->poll();
7580
}
7681

77-
BleStatus BleCentral::disconnect() {
82+
BleStatus
83+
BleCentral::disconnect() {
7884
if (connected()) {
7985
return _peripheral->disconnect();
8086
}
8187

8288
return BLE_STATUS_WRONG_STATE;
8389
}
8490

85-
void BleCentral::setAddress(BleDeviceAddress address) {
91+
void
92+
BleCentral::setAddress(ble_addr_t address) {
8693
_address = address;
8794
}
8895

89-
void BleCentral::clearAddress() {
96+
void
97+
BleCentral::clearAddress() {
9098
memset(&_address, 0x00, sizeof(_address));
9199
}

libraries/CurieBle/src/BleCentral.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#ifndef _BLE_CENTRAL_H_INCLUDED
2121
#define _BLE_CENTRAL_H_INCLUDED
2222

23-
#include "BleAddress.h"
2423
#include "BleCommon.h"
2524

2625
class BlePeripheral;
@@ -39,14 +38,14 @@ class BleCentral {
3938

4039
BleStatus disconnect();
4140

42-
// protected:
41+
protected:
4342
BleCentral(BlePeripheral* peripheral);
44-
void setAddress(BleDeviceAddress address);
43+
void setAddress(ble_addr_t address);
4544
void clearAddress();
4645

4746
private:
4847
BlePeripheral* _peripheral;
49-
BleDeviceAddress _address;
48+
ble_addr_t _address;
5049
};
5150

5251
#endif

0 commit comments

Comments
 (0)