consolidated the connect APIs into a single API. Takes pointers instead of references.

This commit is contained in:
Rohit Grover 2015-05-21 09:33:40 +01:00
parent cc30c92fa5
commit 6da31dcedd
2 changed files with 19 additions and 23 deletions

View file

@ -319,8 +319,16 @@ public:
*/
ble_error_t stopScan(void);
ble_error_t connect(const Gap::Address_t peerAddr, Gap::AddressType_t peerAddrType = Gap::ADDR_TYPE_RANDOM_STATIC);
ble_error_t connect(const Gap::Address_t peerAddr, Gap::AddressType_t peerAddrType, const GapScanningParams &scanParams);
/**
* [connect description]
* @param peerAddr [description]
* @param peerAddrType [description]
* @return [description]
*/
ble_error_t connect(const Gap::Address_t peerAddr,
Gap::AddressType_t peerAddrType = Gap::ADDR_TYPE_RANDOM_STATIC,
const Gap::ConnectionParams_t *connectionParams = NULL,
const GapScanningParams *scanParams = NULL);
/**
* This call initiates the disconnection procedure, and its completion will
@ -861,26 +869,11 @@ BLEDevice::stopScan(void) {
}
inline ble_error_t
BLEDevice::connect(const Gap::Address_t peerAddr, Gap::AddressType_t peerAddrType) {
Gap::ConnectionParams_t connectionParams = {
.minConnectionInterval = 30,
.maxConnectionInterval = 100,
.slaveLatency = 0,
.connectionSupervisionTimeout = 400
};
return transport->getGap().connect(peerAddr, peerAddrType, scanningParams, connectionParams);
}
inline ble_error_t
BLEDevice::connect(const Gap::Address_t peerAddr, Gap::AddressType_t peerAddrType, const GapScanningParams &scanParams) {
Gap::ConnectionParams_t connectionParams = {
.minConnectionInterval = 30,
.maxConnectionInterval = 100,
.slaveLatency = 0,
.connectionSupervisionTimeout = 400
};
return transport->getGap().connect(peerAddr, peerAddrType, scanParams, connectionParams);
BLEDevice::connect(const Gap::Address_t peerAddr,
Gap::AddressType_t peerAddrType,
const Gap::ConnectionParams_t *connectionParams,
const GapScanningParams *scanParams) {
return transport->getGap().connect(peerAddr, peerAddrType, connectionParams, scanParams);
}
inline ble_error_t

View file

@ -177,7 +177,10 @@ private:
virtual uint16_t getMinAdvertisingInterval(void) const = 0;
virtual uint16_t getMinNonConnectableAdvertisingInterval(void) const = 0;
virtual uint16_t getMaxAdvertisingInterval(void) const = 0;
virtual ble_error_t connect(const Address_t peerAddr, Gap::AddressType_t peerAddrType, const GapScanningParams &scanParams, const ConnectionParams_t& connectionParams) = 0;
virtual ble_error_t connect(const Address_t peerAddr,
Gap::AddressType_t peerAddrType,
const ConnectionParams_t *connectionParams,
const GapScanningParams *scanParams) = 0;
virtual ble_error_t disconnect(DisconnectionReason_t reason) = 0;
virtual ble_error_t getPreferredConnectionParams(ConnectionParams_t *params) = 0;
virtual ble_error_t setPreferredConnectionParams(const ConnectionParams_t *params) = 0;