move variants of setup into nRFDiscoveredCharacteristic.

This commit is contained in:
Rohit Grover 2015-05-28 08:17:04 +01:00
parent 543e493d70
commit 12ed0b3884
2 changed files with 27 additions and 2 deletions

View File

@ -247,11 +247,13 @@ NordicServiceDiscovery::setupDiscoveredCharacteristics(const ble_gattc_evt_char_
for (unsigned charIndex = 0; charIndex < numCharacteristics; charIndex++) {
if (response->chars[charIndex].uuid.type == BLE_UUID_TYPE_UNKNOWN) {
charUUIDDiscoveryQueue.enqueue(charIndex);
characteristics[charIndex].setup(*(const uint8_t *)(&response->chars[charIndex].char_props),
characteristics[charIndex].setup(connHandle,
*(const uint8_t *)(&response->chars[charIndex].char_props),
response->chars[charIndex].handle_decl,
response->chars[charIndex].handle_value);
} else {
characteristics[charIndex].setup(response->chars[charIndex].uuid.uuid,
characteristics[charIndex].setup(connHandle,
response->chars[charIndex].uuid.uuid,
*(const uint8_t *)(&response->chars[charIndex].char_props),
response->chars[charIndex].handle_decl,
response->chars[charIndex].handle_value);

View File

@ -23,6 +23,29 @@
void bleGattcEventHandler(const ble_evt_t *p_ble_evt);
class nRFDiscoveredCharacteristic : public DiscoveredCharacteristic {
public:
void setup(Gap::Handle_t connectionHandleIn,
Properties_t propsIn,
GattAttribute::Handle_t declHandleIn,
GattAttribute::Handle_t valueHandleIn) {
connHandle = connectionHandleIn;
props = propsIn;
declHandle = declHandleIn;
valueHandle = valueHandleIn;
}
void setup(Gap::Handle_t connectionHandleIn,
UUID::ShortUUIDBytes_t uuidIn,
Properties_t propsIn,
GattAttribute::Handle_t declHandleIn,
GattAttribute::Handle_t valueHandleIn) {
connHandle = connectionHandleIn;
uuid = uuidIn;
props = propsIn;
declHandle = declHandleIn;
valueHandle = valueHandleIn;
}
public:
/**
* Initiate (or continue) a read for the value attribute, optionally at a