[radio] adding Radio::Callback class (#4045)

This commit adds a `Radio::Callback` class which provides all the
callbacks (as C++ methods) mirroring the radio platform layer
callbacks (including the diags related radio callbacks).
This commit is contained in:
Abtin Keshavarzian
2019-08-01 15:01:19 -07:00
committed by Jonathan Hui
parent 142d98c0ee
commit 700bb6b5a8
10 changed files with 349 additions and 203 deletions
+2 -1
View File
@@ -188,7 +188,8 @@ LOCAL_SRC_FILES := \
src/core/net/ip6_mpl.cpp \
src/core/net/netif.cpp \
src/core/net/udp6.cpp \
src/core/radio/radio_platform_defaults.cpp \
src/core/radio/radio_callbacks.cpp \
src/core/radio/radio_platform.cpp \
src/core/thread/address_resolver.cpp \
src/core/thread/announce_begin_server.cpp \
src/core/thread/announce_sender.cpp \
+4 -2
View File
@@ -194,7 +194,8 @@ SOURCES_COMMON = \
net/netif.cpp \
net/sntp_client.cpp \
net/udp6.cpp \
radio/radio_platform_defaults.cpp \
radio/radio_callbacks.cpp \
radio/radio_platform.cpp \
thread/address_resolver.cpp \
thread/announce_begin_server.cpp \
thread/announce_sender.cpp \
@@ -255,7 +256,8 @@ libopenthread_radio_a_SOURCES = \
mac/mac_frame.cpp \
mac/sub_mac.cpp \
mac/sub_mac_callbacks.cpp \
radio/radio_platform_defaults.cpp \
radio/radio_callbacks.cpp \
radio/radio_platform.cpp \
thread/link_quality.cpp \
utils/missing_strlcat.c \
utils/missing_strlcpy.c \
+5
View File
@@ -388,6 +388,11 @@ template <> inline Radio &Instance::Get(void)
return mRadio;
}
template <> inline Radio::Callbacks &Instance::Get(void)
{
return mRadio.mCallbacks;
}
#if OPENTHREAD_MTD || OPENTHREAD_FTD
template <> inline Notifier &Instance::Get(void)
{
-28
View File
@@ -122,18 +122,6 @@ extern "C" void otPlatDiagAlarmFired(otInstance *aInstance)
otPlatDiagAlarmCallback(aInstance);
}
extern "C" void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
// notify OpenThread Diags module on host side
otPlatRadioTxDone(aInstance, aFrame, NULL, aError);
}
extern "C" void otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
// notify OpenThread Diags module on host side
otPlatRadioReceiveDone(aInstance, aFrame, aError);
}
#else // OPENTHREAD_RADIO
const struct Diags::Command Diags::sCommands[] = {
@@ -408,13 +396,6 @@ void Diags::AlarmFired(void)
}
}
extern "C" void otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
Instance *instance = static_cast<Instance *>(aInstance);
instance->Get<Diags>().ReceiveDone(aFrame, aError);
}
void Diags::ReceiveDone(otRadioFrame *aFrame, otError aError)
{
if (aError == OT_ERROR_NONE)
@@ -435,15 +416,6 @@ void Diags::ReceiveDone(otRadioFrame *aFrame, otError aError)
otPlatDiagRadioReceived(&GetInstance(), aFrame, aError);
}
extern "C" void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
OT_UNUSED_VARIABLE(aFrame);
Instance *instance = static_cast<Instance *>(aInstance);
instance->Get<Diags>().TransmitDone(aError);
}
void Diags::TransmitDone(otError aError)
{
if (aError == OT_ERROR_NONE)
-56
View File
@@ -607,61 +607,5 @@ const char *SubMac::StateToString(State aState)
// LCOV_EXCL_STOP
//---------------------------------------------------------------------------------------------------------------------
// otPlatRadio callbacks
extern "C" void otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
Instance *instance = static_cast<Instance *>(aInstance);
if (instance->IsInitialized())
{
instance->Get<SubMac>().HandleReceiveDone(static_cast<RxFrame *>(aFrame), aError);
}
}
extern "C" void otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame)
{
Instance *instance = static_cast<Instance *>(aInstance);
if (instance->IsInitialized())
{
instance->Get<SubMac>().HandleTransmitStarted(*static_cast<TxFrame *>(aFrame));
}
}
extern "C" void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
{
Instance *instance = static_cast<Instance *>(aInstance);
if (instance->IsInitialized())
{
instance->Get<SubMac>().HandleTransmitDone(*static_cast<TxFrame *>(aFrame), static_cast<RxFrame *>(aAckFrame),
aError);
}
}
extern "C" void otPlatRadioEnergyScanDone(otInstance *aInstance, int8_t aEnergyScanMaxRssi)
{
Instance *instance = static_cast<Instance *>(aInstance);
if (instance->IsInitialized())
{
instance->Get<SubMac>().HandleEnergyScanDone(aEnergyScanMaxRssi);
}
}
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
extern "C" void otPlatRadioFrameUpdated(otInstance *aInstance, otRadioFrame *aFrame)
{
Instance *instance = static_cast<Instance *>(aInstance);
if (instance->IsInitialized())
{
instance->Get<SubMac>().HandleFrameUpdated(*static_cast<TxFrame *>(aFrame));
}
}
#endif
} // namespace Mac
} // namespace ot
+10 -61
View File
@@ -76,6 +76,8 @@ namespace Mac {
*/
class SubMac : public InstanceLocator
{
friend class Radio::Callbacks;
public:
enum
{
@@ -343,67 +345,6 @@ public:
*/
otError EnergyScan(uint8_t aScanChannel, uint16_t aScanDuration);
/**
* This method handles a "Receive Done" event from radio platform.
*
*
* @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed.
* @param[in] aError OT_ERROR_NONE when successfully received a frame,
* OT_ERROR_ABORT when reception was aborted and a frame was not received,
* OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space.
*
*/
void HandleReceiveDone(RxFrame *aFrame, otError aError);
/**
* This method handles a Transmit Started event from radio platform.
*
* @param[in] aFrame The frame that is being transmitted.
*
*/
void HandleTransmitStarted(TxFrame &aFrame);
/**
* This method handles a "Transmit Done" event from radio platform.
*
* @param[in] aFrame The frame that was transmitted.
* @param[in] aAckFrame A pointer to the ACK frame, NULL if no ACK was received.
* @param[in] aError OT_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 tx could not take place due to activity on the channel,
* OT_ERROR_ABORT when transmission was aborted for other reasons.
*
*/
void HandleTransmitDone(TxFrame &aFrame, RxFrame *aAckFrame, otError aError);
/**
* This method handles "Energy Scan Done" event from radio platform.
*
* This method is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability. It is called from
* `otPlatRadioEnergyScanDone()`.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aEnergyScanMaxRssi The maximum RSSI encountered on the scanned channel.
*
*/
void HandleEnergyScanDone(int8_t aMaxRssi);
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
/**
* This method handles a "Frame Updated" event from radio platform.
*
* This is called to notify OpenThread to process transmit security for the frame, this happens when the frame
* includes Header IE(s) that were updated before transmission. It is called from `otPlatRadioFrameUpdated()`.
*
* @note This method can be called from interrupt context and it would only read/write data passed in
* via @p aFrame, but would not read/write any state within OpenThread.
*
* @param[in] aFrame The frame which needs to process transmit security.
*
*/
void HandleFrameUpdated(TxFrame &aFrame);
#endif
private:
enum
{
@@ -448,6 +389,14 @@ private:
void BeginTransmit(void);
void SampleRssi(void);
void HandleReceiveDone(RxFrame *aFrame, otError aError);
void HandleTransmitStarted(TxFrame &aFrame);
void HandleTransmitDone(TxFrame &aTxFrame, RxFrame *aAckFrame, otError aError);
void HandleEnergyScanDone(int8_t aMaxRssi);
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
void HandleFrameUpdated(TxFrame &aFrame);
#endif
static void HandleTimer(Timer &aTimer);
void HandleTimer(void);
+106
View File
@@ -60,6 +60,8 @@ namespace ot {
*/
class Radio : public InstanceLocator
{
friend class Instance;
public:
/**
* This enumeration defines the IEEE 802.15.4 channel related parameters.
@@ -92,6 +94,107 @@ public:
"OPENTHREAD_CONFIG_RADIO_2P4GHZ_OQPSK_SUPPORT or OPENTHREAD_CONFIG_RADIO_915MHZ_OQPSK_SUPPORT "
"must be set to 1 to specify the radio mode");
/**
* This class defines the callbacks from `Radio`.
*
*/
class Callbacks : public InstanceLocator
{
friend class Radio;
public:
/**
* This callback method handles a "Receive Done" event from radio platform.
*
* @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed.
* @param[in] aError OT_ERROR_NONE when successfully received a frame,
* OT_ERROR_ABORT when reception was aborted and a frame was not received,
* OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space.
*
*/
void HandleReceiveDone(Mac::RxFrame *aFrame, otError aError);
/**
* This callback method handles a "Transmit Started" event from radio platform.
*
* @param[in] aFrame The frame that is being transmitted.
*
*/
void HandleTransmitStarted(Mac::TxFrame &aFrame);
/**
* This callback method handles a "Transmit Done" event from radio platform.
*
* @param[in] aFrame The frame that was transmitted.
* @param[in] aAckFrame A pointer to the ACK frame, NULL if no ACK was received.
* @param[in] aError OT_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 tx could not take place due to activity on the
* channel, OT_ERROR_ABORT when transmission was aborted for other reasons.
*
*/
void HandleTransmitDone(Mac::TxFrame &aFrame, Mac::RxFrame *aAckFrame, otError aError);
/**
* This callback method handles "Energy Scan Done" event from radio platform.
*
* This method is used when radio provides OT_RADIO_CAPS_ENERGY_SCAN capability. It is called from
* `otPlatRadioEnergyScanDone()`.
*
* @param[in] aInstance The OpenThread instance structure.
* @param[in] aEnergyScanMaxRssi The maximum RSSI encountered on the scanned channel.
*
*/
void HandleEnergyScanDone(int8_t aMaxRssi);
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
/**
* This callback method handles a "Frame Updated" event from radio platform.
*
* This is called to notify OpenThread to process transmit security for the frame, this happens when the frame
* includes Header IE(s) that were updated before transmission. It is called from `otPlatRadioFrameUpdated()`.
*
* @note This method can be called from interrupt context and it would only read/write data passed in
* via @p aFrame, but would not read/write any state within OpenThread.
*
* @param[in] aFrame The frame which needs to process transmit security.
*
*/
void HandleFrameUpdated(Mac::TxFrame &aFrame);
#endif
#if OPENTHREAD_CONFIG_DIAG_ENABLE
/**
* This callback method handles a "Receive Done" event from radio platform when diagnostics mode is enabled.
*
* @param[in] aFrame A pointer to the received frame or NULL if the receive operation failed.
* @param[in] aError OT_ERROR_NONE when successfully received a frame,
* OT_ERROR_ABORT when reception was aborted and a frame was not received,
* OT_ERROR_NO_BUFS when a frame could not be received due to lack of rx buffer space.
*
*/
void HandleDiagsReceiveDone(Mac::RxFrame *aFrame, otError aError);
/**
* This callback method handles a "Transmit Done" event from radio platform when diagnostics mode is enabled.
*
* @param[in] aFrame The frame that was transmitted.
* @param[in] aError OT_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 tx could not take place due to activity on the
* channel, OT_ERROR_ABORT when transmission was aborted for other reasons.
*
*/
void HandleDiagsTransmitDone(Mac::TxFrame &aFrame, otError aError);
#endif
private:
explicit Callbacks(Instance &aInstance)
: InstanceLocator(aInstance)
{
}
};
/**
* This constructor initializes the `Radio` object.
*
@@ -100,6 +203,7 @@ public:
*/
Radio(Instance &aInstance)
: InstanceLocator(aInstance)
, mCallbacks(aInstance)
{
}
@@ -405,6 +509,8 @@ public:
private:
otInstance *GetInstance(void) { return reinterpret_cast<otInstance *>(&InstanceLocator::GetInstance()); }
Callbacks mCallbacks;
};
} // namespace ot
+91
View File
@@ -0,0 +1,91 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* This file implements the radio callbacks.
*/
#include "radio.hpp"
#include "common/instance.hpp"
#include "common/locator-getters.hpp"
namespace ot {
void Radio::Callbacks::HandleReceiveDone(Mac::RxFrame *aFrame, otError aError)
{
Get<Mac::SubMac>().HandleReceiveDone(aFrame, aError);
}
void Radio::Callbacks::HandleTransmitStarted(Mac::TxFrame &aFrame)
{
Get<Mac::SubMac>().HandleTransmitStarted(aFrame);
}
void Radio::Callbacks::HandleTransmitDone(Mac::TxFrame &aFrame, Mac::RxFrame *aAckFrame, otError aError)
{
Get<Mac::SubMac>().HandleTransmitDone(aFrame, aAckFrame, aError);
}
void Radio::Callbacks::HandleEnergyScanDone(int8_t aMaxRssi)
{
Get<Mac::SubMac>().HandleEnergyScanDone(aMaxRssi);
}
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
void Radio::Callbacks::HandleFrameUpdated(Mac::TxFrame &aFrame)
{
Get<Mac::SubMac>().HandleFrameUpdated(aFrame);
}
#endif
#if OPENTHREAD_CONFIG_DIAG_ENABLE
void Radio::Callbacks::HandleDiagsReceiveDone(Mac::RxFrame *aFrame, otError aError)
{
#if OPENTHREAD_RADIO
// Pass it to notify OpenThread `Diags` module on host side.
HandleReceiveDone(aFrame, aError);
#else
Get<FactoryDiags::Diags>().ReceiveDone(aFrame, aError);
#endif
}
void Radio::Callbacks::HandleDiagsTransmitDone(Mac::TxFrame &aFrame, otError aError)
{
#if OPENTHREAD_RADIO
// Pass it to notify OpenThread `Diags` module on host side.
HandleTransmitDone(aFrame, NULL, aError);
#else
OT_UNUSED_VARIABLE(aFrame);
Get<FactoryDiags::Diags>().TransmitDone(aError);
#endif
}
#endif // OPENTHREAD_CONFIG_DIAG_ENABLE
} // namespace ot
+131
View File
@@ -0,0 +1,131 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* This file implements the radio platform callbacks into OpenThread and default/weak radio platform APIs.
*/
#include <openthread/instance.h>
#include "common/instance.hpp"
#include "radio/radio.hpp"
using namespace ot;
//---------------------------------------------------------------------------------------------------------------------
// otPlatRadio callbacks
extern "C" void otPlatRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
Instance *instance = static_cast<Instance *>(aInstance);
if (instance->IsInitialized())
{
instance->Get<Radio::Callbacks>().HandleReceiveDone(static_cast<Mac::RxFrame *>(aFrame), aError);
}
}
extern "C" void otPlatRadioTxStarted(otInstance *aInstance, otRadioFrame *aFrame)
{
Instance *instance = static_cast<Instance *>(aInstance);
if (instance->IsInitialized())
{
instance->Get<Radio::Callbacks>().HandleTransmitStarted(*static_cast<Mac::TxFrame *>(aFrame));
}
}
extern "C" void otPlatRadioTxDone(otInstance *aInstance, otRadioFrame *aFrame, otRadioFrame *aAckFrame, otError aError)
{
Instance *instance = static_cast<Instance *>(aInstance);
if (instance->IsInitialized())
{
instance->Get<Radio::Callbacks>().HandleTransmitDone(*static_cast<Mac::TxFrame *>(aFrame),
static_cast<Mac::RxFrame *>(aAckFrame), aError);
}
}
extern "C" void otPlatRadioEnergyScanDone(otInstance *aInstance, int8_t aEnergyScanMaxRssi)
{
Instance *instance = static_cast<Instance *>(aInstance);
if (instance->IsInitialized())
{
instance->Get<Radio::Callbacks>().HandleEnergyScanDone(aEnergyScanMaxRssi);
}
}
#if OPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT
extern "C" void otPlatRadioFrameUpdated(otInstance *aInstance, otRadioFrame *aFrame)
{
Instance *instance = static_cast<Instance *>(aInstance);
if (instance->IsInitialized())
{
instance->Get<Radio::Callbacks>().HandleFrameUpdated(*static_cast<Mac::TxFrame *>(aFrame));
}
}
#endif
#if OPENTHREAD_CONFIG_DIAG_ENABLE
extern "C" void otPlatDiagRadioReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
Instance *instance = static_cast<Instance *>(aInstance);
instance->Get<Radio::Callbacks>().HandleDiagsReceiveDone(static_cast<Mac::RxFrame *>(aFrame), aError);
}
extern "C" void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
Instance *instance = static_cast<Instance *>(aInstance);
instance->Get<Radio::Callbacks>().HandleDiagsTransmitDone(*static_cast<Mac::TxFrame *>(aFrame), aError);
}
#endif
//---------------------------------------------------------------------------------------------------------------------
// Default/weak implementation of radio platform APIs
OT_TOOL_WEAK uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return Radio::kSupportedChannels;
}
OT_TOOL_WEAK uint32_t otPlatRadioGetPreferredChannelMask(otInstance *aInstance)
{
return otPlatRadioGetSupportedChannelMask(aInstance);
}
OT_TOOL_WEAK const char *otPlatRadioGetVersionString(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return otGetVersionString();
}
@@ -1,55 +0,0 @@
/*
* Copyright (c) 2019, The OpenThread Authors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @file
* This file implements the default/weak radio platform APIs.
*/
#include <openthread/instance.h>
#include "radio/radio.hpp"
using namespace ot;
OT_TOOL_WEAK uint32_t otPlatRadioGetSupportedChannelMask(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return Radio::kSupportedChannels;
}
OT_TOOL_WEAK uint32_t otPlatRadioGetPreferredChannelMask(otInstance *aInstance)
{
return otPlatRadioGetSupportedChannelMask(aInstance);
}
OT_TOOL_WEAK const char *otPlatRadioGetVersionString(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return otGetVersionString();
}