Add API function to check if MAC layer is during transmission operation. (#1447)

This commit is contained in:
Hubert Miś
2017-03-20 09:38:07 -07:00
committed by Jonathan Hui
parent febcd2d9a4
commit 163c54537f
4 changed files with 33 additions and 0 deletions
+14
View File
@@ -136,6 +136,20 @@ OTAPI bool OTCALL otLinkIsEnergyScanInProgress(otInstance *aInstance);
*/
OTAPI ThreadError OTCALL otLinkSendDataRequest(otInstance *aInstance);
/**
* This function indicates whether or not an IEEE 802.15.4 MAC is in the transmit state.
*
* MAC module is in the transmit state during CSMA/CA procedure, CCA, Data, Beacon or Data Request frame transmission
* and receiving an ACK of a transmitted frame. MAC module is not in the transmit state during transmission of an ACK
* frame or a Beacon Request frame.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @returns true if an IEEE 802.15.4 MAC is in the transmit state, false otherwise.
*
*/
OTAPI bool OTCALL otLinkIsInTransmitState(otInstance *aInstance);
/**
* Get the IEEE 802.15.4 channel.
*
+4
View File
@@ -355,6 +355,10 @@ bool otLinkIsEnergyScanInProgress(otInstance *aInstance)
return aInstance->mThreadNetif.GetMac().IsEnergyScanInProgress();
}
bool otLinkIsInTransmitState(otInstance *aInstance)
{
return aInstance->mThreadNetif.GetMac().IsInTransmitState();
}
#ifdef __cplusplus
+5
View File
@@ -257,6 +257,11 @@ bool Mac::IsEnergyScanInProgress(void)
return (mState == kStateEnergyScan) || (mPendingScanRequest == kScanTypeEnergy);
}
bool Mac::IsInTransmitState(void)
{
return (mState == kStateTransmitData) || (mState == kStateTransmitBeacon);
}
void Mac::StartEnergyScan(void)
{
mState = kStateEnergyScan;
+10
View File
@@ -502,6 +502,16 @@ public:
*/
bool IsEnergyScanInProgress(void);
/**
* This method returns if the MAC layer is in transmit state.
*
* The MAC layer is in transmit state during CSMA/CA, CCA, transmission of Data, Beacon or Data Request frames and
* receiving of ACK frames. The MAC layer is not in transmit state during transmission of ACK frames or Beacon
* Requests.
*
*/
bool IsInTransmitState(void);
/**
* This method registers a callback to provide received raw IEEE 802.15.4 frames.
*