mirror of
https://github.com/espressif/openthread.git
synced 2026-08-01 00:27:47 +00:00
Implement the use of otPlatRadioDefaultTxPower API. (#1417)
* Implement the use of otPlatRadioDefaultTxPower API. * Add implementation of otPlatRadioSetDefaultTxPower for windows.
This commit is contained in:
@@ -759,6 +759,26 @@ error:
|
||||
return NT_SUCCESS(status) ? kThreadError_None : kThreadError_Failed;
|
||||
}
|
||||
|
||||
void otPlatRadioSetDefaultTxPower(_In_ otInstance *otCtx, int8_t aPower)
|
||||
{
|
||||
NT_ASSERT(otCtx);
|
||||
PMS_FILTER pFilter = otCtxToFilter(otCtx);
|
||||
NTSTATUS status;
|
||||
|
||||
// Indicate to the miniport
|
||||
status =
|
||||
otLwfCmdSetProp(
|
||||
pFilter,
|
||||
SPINEL_PROP_PHY_TX_POWER,
|
||||
SPINEL_DATATYPE_INT8_S,
|
||||
aPower
|
||||
);
|
||||
if (!NT_SUCCESS(status))
|
||||
{
|
||||
LogError(DRIVER_DEFAULT, "Set SPINEL_PROP_PHY_TX_POWER failed, %!STATUS!", status);
|
||||
}
|
||||
}
|
||||
|
||||
inline USHORT getDstShortAddress(const UCHAR *frame)
|
||||
{
|
||||
return (((USHORT)frame[IEEE802154_DSTADDR_OFFSET + 1]) << 8) | frame[IEEE802154_DSTADDR_OFFSET];
|
||||
|
||||
@@ -785,3 +785,10 @@ ThreadError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, u
|
||||
(void)aScanDuration;
|
||||
return kThreadError_NotImplemented;
|
||||
}
|
||||
|
||||
void otPlatRadioSetDefaultTxPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
// TODO: Create a proper implementation for this driver.
|
||||
(void)aInstance;
|
||||
(void)aPower;
|
||||
}
|
||||
|
||||
@@ -1214,6 +1214,13 @@ exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void otPlatRadioSetDefaultTxPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
// TODO: Create a proper implementation for this driver.
|
||||
(void)aInstance;
|
||||
(void)aPower;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function documented in platform/radio.h
|
||||
*/
|
||||
|
||||
@@ -410,6 +410,13 @@ ThreadError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, u
|
||||
return kThreadError_NotImplemented;
|
||||
}
|
||||
|
||||
void otPlatRadioSetDefaultTxPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
// TODO: Create a proper implementation for this driver.
|
||||
(void)aInstance;
|
||||
(void)aPower;
|
||||
}
|
||||
|
||||
void da15000RadioProcess(otInstance *aInstance)
|
||||
{
|
||||
if (sSendFrameDone)
|
||||
|
||||
@@ -434,6 +434,13 @@ ThreadError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, u
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
void otPlatRadioSetDefaultTxPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
// TODO: Create a proper implementation for this driver.
|
||||
(void)aInstance;
|
||||
(void)aPower;
|
||||
}
|
||||
|
||||
void nrf5RadioProcess(otInstance *aInstance)
|
||||
{
|
||||
for (uint32_t i = 0; i < RADIO_RX_BUFFERS; i++)
|
||||
|
||||
@@ -738,3 +738,9 @@ ThreadError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, u
|
||||
(void)aScanDuration;
|
||||
return kThreadError_NotImplemented;
|
||||
}
|
||||
|
||||
void otPlatRadioSetDefaultTxPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
(void)aInstance;
|
||||
(void)aPower;
|
||||
}
|
||||
|
||||
@@ -407,6 +407,15 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance);
|
||||
*/
|
||||
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the radio Tx power used for auto-generated frames.
|
||||
*
|
||||
* @param[in] aInstance The OpenThread instance structure.
|
||||
* @param[in] aPower The Tx power to use in dBm.
|
||||
*
|
||||
*/
|
||||
void otPlatRadioSetDefaultTxPower(otInstance *aInstance, int8_t aPower);
|
||||
|
||||
/**
|
||||
* Get the status of promiscuous mode.
|
||||
*
|
||||
|
||||
@@ -91,6 +91,7 @@ int8_t otLinkGetMaxTransmitPower(otInstance *aInstance)
|
||||
void otLinkSetMaxTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().SetMaxTransmitPower(aPower);
|
||||
otPlatRadioSetDefaultTxPower(aInstance, aPower);
|
||||
}
|
||||
|
||||
otPanId otLinkGetPanId(otInstance *aInstance)
|
||||
|
||||
@@ -319,6 +319,12 @@ extern "C" {
|
||||
return kThreadError_NotImplemented;
|
||||
}
|
||||
|
||||
void otPlatRadioSetDefaultTxPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
(void)aInstance;
|
||||
(void)aPower;
|
||||
}
|
||||
|
||||
//
|
||||
// Random
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user