Add macros for the channel bit-vector used with otActiveScan. (#236)

This commit is contained in:
Jonathan Hui
2016-07-06 18:53:45 -07:00
committed by GitHub
parent 862edfb1de
commit a7d69c1726
8 changed files with 48 additions and 15 deletions
+31
View File
@@ -147,6 +147,32 @@ typedef struct otExtAddress
uint8_t m8[OT_EXT_ADDRESS_SIZE]; ///< IEEE 802.15.4 Extended Address bytes
} otExtAddress;
/**
* @addtogroup commands Commands
*
* @{
*
*/
#define OT_CHANNEL_11_MASK (1 << 11) ///< Channel 11
#define OT_CHANNEL_12_MASK (1 << 12) ///< Channel 12
#define OT_CHANNEL_13_MASK (1 << 13) ///< Channel 13
#define OT_CHANNEL_14_MASK (1 << 14) ///< Channel 14
#define OT_CHANNEL_15_MASK (1 << 15) ///< Channel 15
#define OT_CHANNEL_16_MASK (1 << 16) ///< Channel 16
#define OT_CHANNEL_17_MASK (1 << 17) ///< Channel 17
#define OT_CHANNEL_18_MASK (1 << 18) ///< Channel 18
#define OT_CHANNEL_19_MASK (1 << 19) ///< Channel 19
#define OT_CHANNEL_20_MASK (1 << 20) ///< Channel 20
#define OT_CHANNEL_21_MASK (1 << 21) ///< Channel 21
#define OT_CHANNEL_22_MASK (1 << 22) ///< Channel 22
#define OT_CHANNEL_23_MASK (1 << 23) ///< Channel 23
#define OT_CHANNEL_24_MASK (1 << 24) ///< Channel 24
#define OT_CHANNEL_25_MASK (1 << 25) ///< Channel 25
#define OT_CHANNEL_26_MASK (1 << 26) ///< Channel 26
#define OT_CHANNEL_ALL 0xffffffff ///< All channels
/**
* This struct represents a received IEEE 802.15.4 Beacon.
*
@@ -165,6 +191,11 @@ typedef struct otActiveScanResult
bool mIsJoinable : 1; ///< Joining Permitted flag
} otActiveScanResult;
/**
* @}
*
*/
/**
* @addtogroup config Configuration
*
+2 -2
View File
@@ -176,7 +176,7 @@ typedef void (*otHandleActiveScanResult)(otActiveScanResult *aResult);
/**
* This function starts an IEEE 802.15.4 Active Scan
*
* @param[in] aScanChannels A bit vector indicating which channels to scan.
* @param[in] aScanChannels A bit vector indicating which channels to scan (e.g. OT_CHANNEL_11_MASK).
* @param[in] aScanDuration The time in milliseconds to spend scanning each channel.
* @param[in] aCallback A pointer to a function that is called when a beacon is received or the scan completes.
*
@@ -184,7 +184,7 @@ typedef void (*otHandleActiveScanResult)(otActiveScanResult *aResult);
* @retval kThreadError_Busy Already performing an Active Scan.
*
*/
ThreadError otActiveScan(uint16_t aScanChannels, uint16_t aScanDuration, otHandleActiveScanResult aCallback);
ThreadError otActiveScan(uint32_t aScanChannels, uint16_t aScanDuration, otHandleActiveScanResult aCallback);
/**
* This function determines if an IEEE 802.15.4 Active Scan is currently in progress.
+6 -5
View File
@@ -67,11 +67,12 @@ extern "C" {
enum
{
kMaxPHYPacketSize = 127, ///< aMaxPHYPacketSize (IEEE 802.15.4-2006)
kPhyMinChannel = 11, ///< 2.4 GHz IEEE 802.15.4-2006
kPhyMaxChannel = 26, ///< 2.4 GHz IEEE 802.15.4-2006
kPhySymbolsPerOctet = 2, ///< 2.4 GHz IEEE 802.15.4-2006
kPhyBitRate = 250000, ///< 2.4 GHz IEEE 802.15.4 (kilobits per second)
kMaxPHYPacketSize = 127, ///< aMaxPHYPacketSize (IEEE 802.15.4-2006)
kPhyMinChannel = 11, ///< 2.4 GHz IEEE 802.15.4-2006
kPhyMaxChannel = 26, ///< 2.4 GHz IEEE 802.15.4-2006
kPhySupportedChannelMask = 0xffff << kPhyMinChannel, ///< 2.4 GHz IEEE 802.15.4-2006
kPhySymbolsPerOctet = 2, ///< 2.4 GHz IEEE 802.15.4-2006
kPhyBitRate = 250000, ///< 2.4 GHz IEEE 802.15.4 (kilobits per second)
kPhyBitsPerOctet = 8,
kPhyUsPerSymbol = ((kPhyBitsPerOctet / kPhySymbolsPerOctet) * 1000000) / kPhyBitRate,