Raw Link

This module includes functions that control the raw link-layer configuration.

Typedefs

typedef void(* otLinkRawReceiveDone) (otInstance *aInstance, otRadioFrame *aFrame, otError aError)
 This function pointer on receipt of a IEEE 802.15.4 frame.
 
typedef void(* otLinkRawTransmitDone) (otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
 This function pointer on receipt of a IEEE 802.15.4 frame.
 
typedef void(* otLinkRawEnergyScanDone) (otInstance *aInstance, int8_t aEnergyScanMaxRssi)
 This function pointer on receipt of a IEEE 802.15.4 frame.

Functions

otError otLinkRawSetReceiveDone (otInstance *aInstance, otLinkRawReceiveDone aCallback)
 This function enables/disables the raw link-layer.
 
bool otLinkRawIsEnabled (otInstance *aInstance)
 This function indicates whether or not the raw link-layer is enabled.
 
bool otLinkRawGetPromiscuous (otInstance *aInstance)
 This function gets the status of promiscuous mode.
 
otError otLinkRawSetPromiscuous (otInstance *aInstance, bool aEnable)
 This function enables or disables promiscuous mode.
 
otError otLinkRawSetShortAddress (otInstance *aInstance, uint16_t aShortAddress)
 Set the Short Address for address filtering.
 
otError otLinkRawSleep (otInstance *aInstance)
 Transition the radio from Receive to Sleep.
 
otError otLinkRawReceive (otInstance *aInstance)
 Transitioning the radio from Sleep to Receive.
 
bool otLinkRawIsTransmittingOrScanning (otInstance *aInstance)
 This function indicates whether or not the raw link-layer is busy transmitting or scanning.
 
otRadioFrameotLinkRawGetTransmitBuffer (otInstance *aInstance)
 The radio transitions from Transmit to Receive.
 
otError otLinkRawTransmit (otInstance *aInstance, otLinkRawTransmitDone aCallback)
 This method begins the transmit sequence on the radio.
 
int8_t otLinkRawGetRssi (otInstance *aInstance)
 Get the most recent RSSI measurement.
 
otRadioCaps otLinkRawGetCaps (otInstance *aInstance)
 Get the radio capabilities.
 
otError otLinkRawEnergyScan (otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration, otLinkRawEnergyScanDone aCallback)
 This method begins the energy scan sequence on the radio.
 
otError otLinkRawSrcMatchEnable (otInstance *aInstance, bool aEnable)
 Enable/Disable source match for frame pending.
 
otError otLinkRawSrcMatchAddShortEntry (otInstance *aInstance, uint16_t aShortAddress)
 Adding short address to the source match table.
 
otError otLinkRawSrcMatchAddExtEntry (otInstance *aInstance, const otExtAddress *aExtAddress)
 Adding extended address to the source match table.
 
otError otLinkRawSrcMatchClearShortEntry (otInstance *aInstance, uint16_t aShortAddress)
 Removing short address to the source match table.
 
otError otLinkRawSrcMatchClearExtEntry (otInstance *aInstance, const otExtAddress *aExtAddress)
 Removing extended address to the source match table of the radio.
 
otError otLinkRawSrcMatchClearShortEntries (otInstance *aInstance)
 Removing all the short addresses from the source match table.
 
otError otLinkRawSrcMatchClearExtEntries (otInstance *aInstance)
 Removing all the extended addresses from the source match table.
 
otError otLinkRawSetMacKey (otInstance *aInstance, uint8_t aKeyIdMode, uint8_t aKeyId, const otMacKey *aPrevKey, const otMacKey *aCurrKey, const otMacKey *aNextKey)
 Update MAC keys and key index.
 
otError otLinkRawSetMacFrameCounter (otInstance *aInstance, uint32_t aMacFrameCounter)
 Sets the current MAC frame counter value.
 
uint64_t otLinkRawGetRadioTime (otInstance *aInstance)
 Get current platform time (64bits width) of the radio chip.

Detailed Description

This module includes functions that control the raw link-layer configuration.

Typedef Documentation

◆ otLinkRawEnergyScanDone

typedef void(* otLinkRawEnergyScanDone) (otInstance *aInstance, int8_t aEnergyScanMaxRssi)

This function pointer on receipt of a IEEE 802.15.4 frame.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aEnergyScanMaxRssiThe maximum RSSI encountered on the scanned channel.

◆ otLinkRawReceiveDone

typedef void(* otLinkRawReceiveDone) (otInstance *aInstance, otRadioFrame *aFrame, otError aError)

This function pointer on receipt of a IEEE 802.15.4 frame.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aFrameA pointer to the received frame or NULL if the receive operation was aborted.
[in]aErrorOT_ERROR_NONE when successfully received a frame. OT_ERROR_ABORT when reception was aborted and a frame was not received.

◆ otLinkRawTransmitDone

typedef void(* otLinkRawTransmitDone) (otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)

This function pointer on receipt of a IEEE 802.15.4 frame.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aFrameA pointer to the frame that was transmitted.
[in]aAckFrameA pointer to the ACK frame.
[in]aErrorOT_ERROR_NONE when the frame was transmitted. OT_ERROR_NO_ACK when the frame was transmitted but no ACK was received OT_ERROR_CHANNEL_ACCESS_FAILURE when the transmission could not take place due to activity on the channel. OT_ERROR_ABORT when transmission was aborted for other reasons.

Function Documentation

◆ otLinkRawEnergyScan()

otError otLinkRawEnergyScan ( otInstance aInstance,
uint8_t  aScanChannel,
uint16_t  aScanDuration,
otLinkRawEnergyScanDone  aCallback 
)

This method begins the energy scan sequence on the radio.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aScanChannelThe channel to perform the energy scan on.
[in]aScanDurationThe duration, in milliseconds, for the channel to be scanned.
[in]aCallbackA pointer to a function called on completion of a scanned channel.
Return values
OT_ERROR_NONESuccessfully started scanning the channel.
OT_ERROR_NOT_IMPLEMENTEDThe radio doesn't support energy scanning.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawGetCaps()

otRadioCaps otLinkRawGetCaps ( otInstance aInstance)

Get the radio capabilities.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The radio capability bit vector. The stack enables or disables some functions based on this value.

◆ otLinkRawGetPromiscuous()

bool otLinkRawGetPromiscuous ( otInstance aInstance)

This function gets the status of promiscuous mode.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
truePromiscuous mode is enabled.
falsePromiscuous mode is disabled.

◆ otLinkRawGetRadioTime()

uint64_t otLinkRawGetRadioTime ( otInstance aInstance)

Get current platform time (64bits width) of the radio chip.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The current radio time in microseconds.

◆ otLinkRawGetRssi()

int8_t otLinkRawGetRssi ( otInstance aInstance)

Get the most recent RSSI measurement.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
The RSSI in dBm when it is valid. 127 when RSSI is invalid.

◆ otLinkRawGetTransmitBuffer()

otRadioFrame* otLinkRawGetTransmitBuffer ( otInstance aInstance)

The radio transitions from Transmit to Receive.

This method returns a pointer to the transmit buffer.

The caller forms the IEEE 802.15.4 frame in this buffer then calls otLinkRawTransmit() to request transmission.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Returns
A pointer to the transmit buffer or NULL if the raw link-layer isn't enabled.

◆ otLinkRawIsEnabled()

bool otLinkRawIsEnabled ( otInstance aInstance)

This function indicates whether or not the raw link-layer is enabled.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
trueThe raw link-layer is enabled.
falseThe raw link-layer is disabled.

◆ otLinkRawIsTransmittingOrScanning()

bool otLinkRawIsTransmittingOrScanning ( otInstance aInstance)

This function indicates whether or not the raw link-layer is busy transmitting or scanning.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
trueThe raw link-layer is busy transmitting or scanning.
falseThe raw link-layer is not busy transmitting or scanning.

◆ otLinkRawReceive()

otError otLinkRawReceive ( otInstance aInstance)

Transitioning the radio from Sleep to Receive.

Turn on the radio.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
OT_ERROR_NONESuccessfully transitioned to Receive.
OT_ERROR_INVALID_STATEThe radio was disabled or transmitting.

◆ otLinkRawSetMacFrameCounter()

otError otLinkRawSetMacFrameCounter ( otInstance aInstance,
uint32_t  aMacFrameCounter 
)

Sets the current MAC frame counter value.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aMacFrameCounterThe MAC frame counter value.
Return values
OT_ERROR_NONEIf successful.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawSetMacKey()

otError otLinkRawSetMacKey ( otInstance aInstance,
uint8_t  aKeyIdMode,
uint8_t  aKeyId,
const otMacKey aPrevKey,
const otMacKey aCurrKey,
const otMacKey aNextKey 
)

Update MAC keys and key index.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aKeyIdModeThe key ID mode.
[in]aKeyIdThe key index.
[in]aPrevKeyThe previous MAC key.
[in]aCurrKeyThe current MAC key.
[in]aNextKeyThe next MAC key.
Return values
OT_ERROR_NONEIf successful.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawSetPromiscuous()

otError otLinkRawSetPromiscuous ( otInstance aInstance,
bool  aEnable 
)

This function enables or disables promiscuous mode.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aEnableA value to enable or disable promiscuous mode.
Return values
OT_ERROR_NONEIf successful.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawSetReceiveDone()

otError otLinkRawSetReceiveDone ( otInstance aInstance,
otLinkRawReceiveDone  aCallback 
)

This function enables/disables the raw link-layer.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aCallbackA pointer to a function called on receipt of a IEEE 802.15.4 frame. NULL to disable the raw-link layer.
Return values
OT_ERROR_FAILEDThe radio could not be enabled/disabled.
OT_ERROR_INVALID_STATEIf the OpenThread IPv6 interface is already enabled.
OT_ERROR_NONEIf the enable state was successfully set.

◆ otLinkRawSetShortAddress()

otError otLinkRawSetShortAddress ( otInstance aInstance,
uint16_t  aShortAddress 
)

Set the Short Address for address filtering.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aShortAddressThe IEEE 802.15.4 Short Address.
Return values
OT_ERROR_NONEIf successful.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawSleep()

otError otLinkRawSleep ( otInstance aInstance)

Transition the radio from Receive to Sleep.

Turn off the radio.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
OT_ERROR_NONESuccessfully transitioned to Sleep.
OT_ERROR_BUSYThe radio was transmitting
OT_ERROR_INVALID_STATEThe radio was disabled

◆ otLinkRawSrcMatchAddExtEntry()

otError otLinkRawSrcMatchAddExtEntry ( otInstance aInstance,
const otExtAddress aExtAddress 
)

Adding extended address to the source match table.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aExtAddressThe extended address to be added.
Return values
OT_ERROR_NONESuccessfully added extended address to the source match table.
OT_ERROR_NO_BUFSNo available entry in the source match table.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawSrcMatchAddShortEntry()

otError otLinkRawSrcMatchAddShortEntry ( otInstance aInstance,
uint16_t  aShortAddress 
)

Adding short address to the source match table.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aShortAddressThe short address to be added.
Return values
OT_ERROR_NONESuccessfully added short address to the source match table.
OT_ERROR_NO_BUFSNo available entry in the source match table.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawSrcMatchClearExtEntries()

otError otLinkRawSrcMatchClearExtEntries ( otInstance aInstance)

Removing all the extended addresses from the source match table.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
OT_ERROR_NONEIf successful.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawSrcMatchClearExtEntry()

otError otLinkRawSrcMatchClearExtEntry ( otInstance aInstance,
const otExtAddress aExtAddress 
)

Removing extended address to the source match table of the radio.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aExtAddressThe extended address to be removed.
Return values
OT_ERROR_NONESuccessfully removed the extended address from the source match table.
OT_ERROR_NO_ADDRESSThe extended address is not in source match table.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawSrcMatchClearShortEntries()

otError otLinkRawSrcMatchClearShortEntries ( otInstance aInstance)

Removing all the short addresses from the source match table.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
Return values
OT_ERROR_NONEIf successful.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawSrcMatchClearShortEntry()

otError otLinkRawSrcMatchClearShortEntry ( otInstance aInstance,
uint16_t  aShortAddress 
)

Removing short address to the source match table.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aShortAddressThe short address to be removed.
Return values
OT_ERROR_NONESuccessfully removed short address from the source match table.
OT_ERROR_NO_ADDRESSThe short address is not in source match table.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawSrcMatchEnable()

otError otLinkRawSrcMatchEnable ( otInstance aInstance,
bool  aEnable 
)

Enable/Disable source match for frame pending.

Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aEnableEnable/disable source match for frame pending.
Return values
OT_ERROR_NONEIf successful.
OT_ERROR_INVALID_STATEIf the raw link-layer isn't enabled.

◆ otLinkRawTransmit()

otError otLinkRawTransmit ( otInstance aInstance,
otLinkRawTransmitDone  aCallback 
)

This method begins the transmit sequence on the radio.

The caller must form the IEEE 802.15.4 frame in the buffer provided by otLinkRawGetTransmitBuffer() before requesting transmission. The channel and transmit power are also included in the otRadioFrame structure.

The transmit sequence consists of:

  1. Transitioning the radio to Transmit from Receive.
  2. Transmits the PSDU on the given channel and at the given transmit power.
Parameters
[in]aInstanceA pointer to an OpenThread instance.
[in]aCallbackA pointer to a function called on completion of the transmission.
Return values
OT_ERROR_NONESuccessfully transitioned to Transmit.
OT_ERROR_INVALID_STATEThe radio was not in the Receive state.