moved the utility function into the pal since it's only useful below pal

pull/7899/head
paul-szczepanek-arm 2018-07-19 15:47:06 +01:00 committed by Vincent Coubard
parent 03f44e7a29
commit db3d124516
3 changed files with 23 additions and 22 deletions

View File

@ -668,26 +668,6 @@ public:
set_coded(phy_coded); set_coded(phy_coded);
} }
/**
* Create an ALL_PHYS parameter used in LE Set PHY Command
* and LE Set Default PHY Command.
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E - 7.8.49
*/
static uint8_t all_phys_value(
const phy_set_t& tx_phys,
const phy_set_t& rx_phys
) {
/* if phy set is empty set corresponding all_phys bit to 1 */
uint8_t all_phys = 0;
if (tx_phys.value() == 0) {
all_phys |= 0x01;
}
if (rx_phys.value() == 0) {
all_phys |= 0x02;
}
return all_phys;
}
/** Prefer 1M PHY. */ /** Prefer 1M PHY. */
void set_1m(bool enabled = true) { void set_1m(bool enabled = true) {
if (enabled) { if (enabled) {

View File

@ -802,6 +802,27 @@ protected:
} }
} }
public:
/**
* Create an ALL_PHYS parameter used in LE Set PHY Command
* and LE Set Default PHY Command.
* @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part E - 7.8.49
*/
static uint8_t create_all_phys_value(
const phy_set_t& tx_phys,
const phy_set_t& rx_phys
) {
/* if phy set is empty set corresponding all_phys bit to 1 */
uint8_t all_phys = 0;
if (tx_phys.value() == 0) {
all_phys |= 0x01;
}
if (rx_phys.value() == 0) {
all_phys |= 0x02;
}
return all_phys;
}
private: private:
/** /**
* Callback called when an event is emitted by the LE subsystem. * Callback called when an event is emitted by the LE subsystem.

View File

@ -343,7 +343,7 @@ ble_error_t Gap::set_preferred_phys(
const phy_set_t& rx_phys const phy_set_t& rx_phys
) { ) {
DmSetDefaultPhy( DmSetDefaultPhy(
phy_set_t::all_phys_value(tx_phys, rx_phys), create_all_phys_value(tx_phys, rx_phys),
tx_phys.value(), tx_phys.value(),
rx_phys.value() rx_phys.value()
); );
@ -368,7 +368,7 @@ ble_error_t Gap::set_phy(
DmSetPhy( DmSetPhy(
connection, connection,
phy_set_t::all_phys_value(tx_phys, rx_phys), create_all_phys_value(tx_phys, rx_phys),
tx_phys.value(), tx_phys.value(),
rx_phys.value(), rx_phys.value(),
coded_symbol.value() coded_symbol.value()