move setTxPower() and getTxPowerLevels() into Gap.h
This commit is contained in:
parent
4d24dc24c9
commit
efcb88a147
4 changed files with 30 additions and 30 deletions
|
@ -71,33 +71,6 @@ const char *nRF51822n::getVersion(void)
|
|||
return versionString;
|
||||
}
|
||||
|
||||
/* (Valid values are -40, -20, -16, -12, -8, -4, 0, 4) */
|
||||
ble_error_t nRF51822n::setTxPower(int8_t txPower)
|
||||
{
|
||||
unsigned rc;
|
||||
if ((rc = sd_ble_gap_tx_power_set(txPower)) != NRF_SUCCESS) {
|
||||
switch (rc) {
|
||||
case NRF_ERROR_BUSY:
|
||||
return BLE_STACK_BUSY;
|
||||
case NRF_ERROR_INVALID_PARAM:
|
||||
default:
|
||||
return BLE_ERROR_PARAM_OUT_OF_RANGE;
|
||||
}
|
||||
}
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
||||
void nRF51822n::getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP)
|
||||
{
|
||||
static const int8_t permittedTxValues[] = {
|
||||
-40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
};
|
||||
|
||||
*valueArrayPP = permittedTxValues;
|
||||
*countP = sizeof(permittedTxValues) / sizeof(int8_t);
|
||||
}
|
||||
|
||||
ble_error_t nRF51822n::init(void)
|
||||
{
|
||||
/* ToDo: Clear memory contents, reset the SD, etc. */
|
||||
|
|
|
@ -40,9 +40,6 @@ public:
|
|||
return nRF51GattServer::getInstance();
|
||||
};
|
||||
|
||||
virtual ble_error_t setTxPower(int8_t txPower);
|
||||
virtual void getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP);
|
||||
|
||||
virtual ble_error_t init(void);
|
||||
virtual ble_error_t shutdown(void);
|
||||
virtual ble_error_t reset(void);
|
||||
|
|
27
nRF51Gap.cpp
27
nRF51Gap.cpp
|
@ -378,3 +378,30 @@ ble_error_t nRF51Gap::getAppearance(uint16_t *appearanceP)
|
|||
return BLE_ERROR_PARAM_OUT_OF_RANGE;
|
||||
}
|
||||
}
|
||||
|
||||
/* (Valid values are -40, -20, -16, -12, -8, -4, 0, 4) */
|
||||
ble_error_t nRF51Gap::setTxPower(int8_t txPower)
|
||||
{
|
||||
unsigned rc;
|
||||
if ((rc = sd_ble_gap_tx_power_set(txPower)) != NRF_SUCCESS) {
|
||||
switch (rc) {
|
||||
case NRF_ERROR_BUSY:
|
||||
return BLE_STACK_BUSY;
|
||||
case NRF_ERROR_INVALID_PARAM:
|
||||
default:
|
||||
return BLE_ERROR_PARAM_OUT_OF_RANGE;
|
||||
}
|
||||
}
|
||||
|
||||
return BLE_ERROR_NONE;
|
||||
}
|
||||
|
||||
void nRF51Gap::getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP)
|
||||
{
|
||||
static const int8_t permittedTxValues[] = {
|
||||
-40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||
};
|
||||
|
||||
*valueArrayPP = permittedTxValues;
|
||||
*countP = sizeof(permittedTxValues) / sizeof(int8_t);
|
||||
}
|
||||
|
|
|
@ -63,6 +63,9 @@ public:
|
|||
virtual ble_error_t setAppearance(uint16_t appearance);
|
||||
virtual ble_error_t getAppearance(uint16_t *appearanceP);
|
||||
|
||||
virtual ble_error_t setTxPower(int8_t txPower);
|
||||
virtual void getPermittedTxPowerValues(const int8_t **valueArrayPP, size_t *countP);
|
||||
|
||||
void setConnectionHandle(uint16_t con_handle);
|
||||
uint16_t getConnectionHandle(void);
|
||||
|
||||
|
|
Loading…
Reference in a new issue