This class defines a channel mask.
More...
#include <src/core/mac/channel_mask.hpp>
This class defines a channel mask.
It is a wrapper class around a uint32_t bit vector representing a set of channels.
§ anonymous enum
| Enumerator |
|---|
| kChannelIteratorFirst | Value to pass in GetNextChannel() to get the first channel in the mask.
|
| kInfoStringSize | Recommended buffer size to use with ToString().
|
§ ChannelMask()
| ot::Mac::ChannelMask::ChannelMask |
( |
uint32_t |
aMask | ) |
|
|
inline |
This constructor initializes a ChannelMask instance with a given mask.
- Parameters
-
| [in] | aMask | A channel mask (as a uint32_t bit-vector mask with bit 0 (lsb) -> channel 0, and so on). |
§ AddChannel()
| void ot::Mac::ChannelMask::AddChannel |
( |
uint8_t |
aChannel | ) |
|
|
inline |
This method adds a channel to the channel mask.
- Parameters
-
§ ContainsChannel()
| bool ot::Mac::ChannelMask::ContainsChannel |
( |
uint8_t |
aChannel | ) |
const |
|
inline |
This method indicates if the mask contains a given channel.
- Parameters
-
- Returns
- TRUE if the channel
aChannel is included in the mask, FALSE otherwise.
§ GetMask()
| uint32_t ot::Mac::ChannelMask::GetMask |
( |
void |
| ) |
const |
|
inline |
This method gets the channel mask (as a uint32_t bit-vector mask with bit 0 (lsb) -> channel 0, and so on).
- Returns
- The channel mask.
§ GetNextChannel()
| otError ot::Mac::ChannelMask::GetNextChannel |
( |
uint8_t & |
aChannel | ) |
const |
This method gets the next channel in the channel mask.
This method can be used to iterate over all channels in the channel mask. To get the first channel (channel with lowest number) in the mask the aChannel should be set to kChannelIteratorFirst.
- Parameters
-
| [in,out] | aChannel | A reference to a uint8_t. On entry it should contain the previous channel or kChannelIteratorFirst. On exit it contains the next channel. |
- Return values
-
| OT_ERROR_NONE | Got the next channel, aChannel updated successfully. |
| OT_ERROR_NOT_FOUND | No next channel in the channel mask (note: aChannel may be changed). |
§ GetNumberOfChannels()
| uint8_t ot::Mac::ChannelMask::GetNumberOfChannels |
( |
void |
| ) |
const |
This method returns the number of channels in the mask.
- Returns
- Number of channels in the mask.
§ Intersect()
| void ot::Mac::ChannelMask::Intersect |
( |
const ChannelMask & |
aOtherMask | ) |
|
|
inline |
This method updates the channel mask by intersecting it with another mask.
- Parameters
-
| [in] | aOtherMask | Another channel mask. |
§ IsEmpty()
| bool ot::Mac::ChannelMask::IsEmpty |
( |
void |
| ) |
const |
|
inline |
This method indicates if the mask is empty.
- Returns
- TRUE if the mask is empty, FALSE otherwise.
§ IsSingleChannel()
| bool ot::Mac::ChannelMask::IsSingleChannel |
( |
void |
| ) |
const |
|
inline |
This method indicates if the mask contains only a single channel.
- Returns
- TRUE if channel mask contains a single channel, FALSE otherwise
§ operator!=()
| bool ot::Mac::ChannelMask::operator!= |
( |
const ChannelMask & |
aAnother | ) |
const |
|
inline |
This method overloads != operator to indicate whether two masks are different.
- Parameters
-
| [in] | aAnother | A reference to another mask to compare with the current one. |
- Returns
- TRUE if the two masks are different, FALSE otherwise.
§ operator==()
| bool ot::Mac::ChannelMask::operator== |
( |
const ChannelMask & |
aAnother | ) |
const |
|
inline |
This method overloads == operator to indicate whether two masks are equal.
- Parameters
-
| [in] | aAnother | A reference to another mask to compare with the current one. |
- Returns
- TRUE if the two masks are equal, FALSE otherwise.
§ RemoveChannel()
| void ot::Mac::ChannelMask::RemoveChannel |
( |
uint8_t |
aChannel | ) |
|
|
inline |
This method removes a channel from the channel mask.
- Parameters
-
§ SetMask()
| void ot::Mac::ChannelMask::SetMask |
( |
uint32_t |
aMask | ) |
|
|
inline |
This method sets the channel mask.
- Parameters
-
| [in] | aMask | A channel mask (as a uint32_t bit-vector mask with bit 0 (lsb) -> channel 0, and so on). |
§ ToString()
This method converts the channel mask into a human-readable string.
Examples of possible output:
- empty mask -> "{ }"
- all channels -> "{ 11-26 }"
- single channel -> "{ 20 }"
- multiple ranges -> "{ 11, 14-17, 20-22, 24, 25 }"
- no range -> "{ 14, 21, 26 }"
- Returns
- An
InfoString object representing the channel mask.
The documentation for this class was generated from the following files: