BLE: Construct a phy_set_t from a phy_t.

pull/8738/head
Vincent Coubard 2018-11-24 22:24:15 +00:00
parent e130bec6a0
commit 3119f9488c
1 changed files with 22 additions and 0 deletions

View File

@ -725,6 +725,28 @@ public:
set_coded(phy_coded);
}
/**
* Create a set from a single phy.
*
* @param phy The phy to add to the set.
*/
phy_set_t(phy_t phy) : _value()
{
switch (phy.value()) {
case phy_t::LE_1M:
set_1m(true);
break;
case phy_t::LE_2M:
set_2m(true);
break;
case phy_t::LE_CODED:
set_coded(true);
break;
default:
break;
}
}
/** Prefer 1M PHY. */
void set_1m(bool enabled = true) {
if (enabled) {