mirror of
https://github.com/espressif/openthread.git
synced 2026-07-30 15:47:46 +00:00
Link API cleanup.
This commit is contained in:
@@ -59,6 +59,7 @@
|
||||
<ClCompile Include="..\..\src\core\api\dhcp6_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\ip6_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\joiner_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\link_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\link_raw_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\message_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\tasklet_api.cpp" />
|
||||
|
||||
@@ -72,6 +72,9 @@
|
||||
<ClCompile Include="..\..\src\core\api\joiner_api.cpp">
|
||||
<Filter>Source Files\api</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\api\link_api.cpp">
|
||||
<Filter>Source Files\api</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\api\link_raw_api.cpp">
|
||||
<Filter>Source Files\api</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
<ClCompile Include="..\..\src\core\api\dhcp6_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\ip6_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\joiner_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\link_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\message_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\api\tasklet_api.cpp" />
|
||||
<ClCompile Include="..\..\src\core\coap\coap_base.cpp" />
|
||||
|
||||
@@ -72,6 +72,9 @@
|
||||
<ClCompile Include="..\..\src\core\api\joiner_api.cpp">
|
||||
<Filter>Source Files\api</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\api\link_api.cpp">
|
||||
<Filter>Source Files\api</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\core\api\link_raw_api.cpp">
|
||||
<Filter>Source Files\api</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -190,7 +190,7 @@ void MainPage::ShowInterfaceDetails(Platform::Guid InterfaceGuid)
|
||||
GUID deviceGuid = InterfaceGuid;
|
||||
auto device = otInstanceInit(ApiInstance, &deviceGuid);
|
||||
|
||||
auto extendedAddress = otGetExtendedAddress(device);
|
||||
auto extendedAddress = otLinkGetExtendedAddress(device);
|
||||
if (extendedAddress)
|
||||
{
|
||||
WCHAR szMac[256] = { 0 };
|
||||
@@ -370,10 +370,10 @@ void MainPage::ConnectNetwork(Platform::Guid InterfaceGuid)
|
||||
wcstombs((char*)masterKey.m8, InterfaceConfigKey->Text->Data(), sizeof(masterKey.m8));
|
||||
otSetMasterKey(device, masterKey.m8, sizeof(masterKey.m8));
|
||||
|
||||
otSetChannel(device, (uint8_t)InterfaceConfigChannel->Value);
|
||||
otLinkSetChannel(device, (uint8_t)InterfaceConfigChannel->Value);
|
||||
otSetMaxAllowedChildren(device, (uint8_t)InterfaceConfigMaxChildren->Value);
|
||||
|
||||
otSetPanId(device, 0x4567);
|
||||
otLinkSetPanId(device, 0x4567);
|
||||
|
||||
//
|
||||
// Bring up the interface and start the Thread logic
|
||||
|
||||
@@ -1273,7 +1273,7 @@ otIsSingleton(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otActiveScan(
|
||||
otLinkActiveScan(
|
||||
_In_ otInstance *aInstance,
|
||||
uint32_t aScanChannels,
|
||||
uint16_t aScanDuration,
|
||||
@@ -1295,7 +1295,7 @@ otActiveScan(
|
||||
OTAPI
|
||||
bool
|
||||
OTCALL
|
||||
otIsActiveScanInProgress(
|
||||
otLinkIsActiveScanInProgress(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -1307,7 +1307,7 @@ otIsActiveScanInProgress(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otEnergyScan(
|
||||
otLinkEnergyScan(
|
||||
_In_ otInstance *aInstance,
|
||||
uint32_t aScanChannels,
|
||||
uint16_t aScanDuration,
|
||||
@@ -1329,7 +1329,7 @@ otEnergyScan(
|
||||
OTAPI
|
||||
bool
|
||||
OTCALL
|
||||
otIsEnergyScanInProgress(
|
||||
otLinkIsEnergyScanInProgress(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -1388,7 +1388,7 @@ otSendMacDataRequest(
|
||||
OTAPI
|
||||
uint8_t
|
||||
OTCALL
|
||||
otGetChannel(
|
||||
otLinkGetChannel(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -1400,7 +1400,7 @@ otGetChannel(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otSetChannel(
|
||||
otLinkSetChannel(
|
||||
_In_ otInstance *aInstance,
|
||||
uint8_t aChannel
|
||||
)
|
||||
@@ -1487,7 +1487,7 @@ OTAPI
|
||||
const
|
||||
uint8_t *
|
||||
OTCALL
|
||||
otGetExtendedAddress(
|
||||
otLinkGetExtendedAddress(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -1505,7 +1505,7 @@ otGetExtendedAddress(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otSetExtendedAddress(
|
||||
otLinkSetExtendedAddress(
|
||||
_In_ otInstance *aInstance,
|
||||
const otExtAddress *aExtendedAddress
|
||||
)
|
||||
@@ -1546,7 +1546,7 @@ otSetExtendedPanId(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otGetFactoryAssignedIeeeEui64(
|
||||
otLinkGetFactoryAssignedIeeeEui64(
|
||||
_In_ otInstance *aInstance,
|
||||
_Out_ otExtAddress *aEui64
|
||||
)
|
||||
@@ -1558,7 +1558,7 @@ otGetFactoryAssignedIeeeEui64(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otGetHashMacAddress(
|
||||
otLinkGetJoinerId(
|
||||
_In_ otInstance *aInstance,
|
||||
_Out_ otExtAddress *aHashMacAddress
|
||||
)
|
||||
@@ -1658,7 +1658,7 @@ otSetMasterKey(
|
||||
OTAPI
|
||||
int8_t
|
||||
OTCALL
|
||||
otGetMaxTransmitPower(
|
||||
otLinkGetMaxTransmitPower(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -1670,7 +1670,7 @@ otGetMaxTransmitPower(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otSetMaxTransmitPower(
|
||||
otLinkSetMaxTransmitPower(
|
||||
_In_ otInstance *aInstance,
|
||||
int8_t aPower
|
||||
)
|
||||
@@ -1833,7 +1833,7 @@ otGetNextOnMeshPrefix(
|
||||
OTAPI
|
||||
otPanId
|
||||
OTCALL
|
||||
otGetPanId(
|
||||
otLinkGetPanId(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -1845,7 +1845,7 @@ otGetPanId(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otSetPanId(
|
||||
otLinkSetPanId(
|
||||
_In_ otInstance *aInstance,
|
||||
otPanId aPanId
|
||||
)
|
||||
@@ -1880,7 +1880,7 @@ otSetRouterRoleEnabled(
|
||||
OTAPI
|
||||
otShortAddress
|
||||
OTCALL
|
||||
otGetShortAddress(
|
||||
otLinkGetShortAddress(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -2352,7 +2352,7 @@ otSendPendingSet(
|
||||
OTAPI
|
||||
uint32_t
|
||||
OTCALL
|
||||
otGetPollPeriod(
|
||||
otLinkGetPollPeriod(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -2364,7 +2364,7 @@ otGetPollPeriod(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otSetPollPeriod(
|
||||
otLinkSetPollPeriod(
|
||||
_In_ otInstance *aInstance,
|
||||
uint32_t aPollPeriod
|
||||
)
|
||||
@@ -2677,7 +2677,7 @@ otReleaseRouterId(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otAddMacWhitelist(
|
||||
otLinkAddWhitelist(
|
||||
_In_ otInstance *aInstance,
|
||||
const uint8_t *aExtAddr
|
||||
)
|
||||
@@ -2689,7 +2689,7 @@ otAddMacWhitelist(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otAddMacWhitelistRssi(
|
||||
otLinkAddWhitelistRssi(
|
||||
_In_ otInstance *aInstance,
|
||||
const uint8_t *aExtAddr,
|
||||
int8_t aRssi
|
||||
@@ -2704,7 +2704,7 @@ otAddMacWhitelistRssi(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otRemoveMacWhitelist(
|
||||
otLinkRemoveWhitelist(
|
||||
_In_ otInstance *aInstance,
|
||||
const uint8_t *aExtAddr
|
||||
)
|
||||
@@ -2715,7 +2715,7 @@ otRemoveMacWhitelist(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otGetMacWhitelistEntry(
|
||||
otLinkGetWhitelistEntry(
|
||||
_In_ otInstance *aInstance,
|
||||
uint8_t aIndex,
|
||||
_Out_ otMacWhitelistEntry *aEntry
|
||||
@@ -2728,7 +2728,7 @@ otGetMacWhitelistEntry(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otClearMacWhitelist(
|
||||
otLinkClearWhitelist(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -2738,27 +2738,18 @@ otClearMacWhitelist(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otDisableMacWhitelist(
|
||||
_In_ otInstance *aInstance
|
||||
otLinkSetWhitelistEnabled(
|
||||
_In_ otInstance *aInstance,
|
||||
bool aEnabled
|
||||
)
|
||||
{
|
||||
if (aInstance) (void)SetIOCTL(aInstance, IOCTL_OTLWF_OT_MAC_WHITELIST_ENABLED, (BOOLEAN)FALSE);
|
||||
}
|
||||
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otEnableMacWhitelist(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
if (aInstance) (void)SetIOCTL(aInstance, IOCTL_OTLWF_OT_MAC_WHITELIST_ENABLED, (BOOLEAN)TRUE);
|
||||
if (aInstance) (void)SetIOCTL(aInstance, IOCTL_OTLWF_OT_MAC_WHITELIST_ENABLED, (BOOLEAN)aEnabled);
|
||||
}
|
||||
|
||||
OTAPI
|
||||
bool
|
||||
OTCALL
|
||||
otIsMacWhitelistEnabled(
|
||||
otLinkIsWhitelistEnabled(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -2820,7 +2811,7 @@ otBecomeLeader(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otAddMacBlacklist(
|
||||
otLinkAddBlacklist(
|
||||
_In_ otInstance *aInstance,
|
||||
const uint8_t *aExtAddr
|
||||
)
|
||||
@@ -2832,7 +2823,7 @@ otAddMacBlacklist(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otRemoveMacBlacklist(
|
||||
otLinkRemoveBlacklist(
|
||||
_In_ otInstance *aInstance,
|
||||
const uint8_t *aExtAddr
|
||||
)
|
||||
@@ -2843,7 +2834,7 @@ otRemoveMacBlacklist(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otGetMacBlacklistEntry(
|
||||
otLinkGetBlacklistEntry(
|
||||
_In_ otInstance *aInstance,
|
||||
uint8_t aIndex,
|
||||
_Out_ otMacBlacklistEntry *aEntry
|
||||
@@ -2856,7 +2847,7 @@ otGetMacBlacklistEntry(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otClearMacBlacklist(
|
||||
otLinkClearBlacklist(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -2866,27 +2857,18 @@ otClearMacBlacklist(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otDisableMacBlacklist(
|
||||
_In_ otInstance *aInstance
|
||||
otLinkSetBlacklistEnabled(
|
||||
_In_ otInstance *aInstance,
|
||||
bool aEnabled
|
||||
)
|
||||
{
|
||||
if (aInstance) (void)SetIOCTL(aInstance, IOCTL_OTLWF_OT_MAC_BLACKLIST_ENABLED, (BOOLEAN)FALSE);
|
||||
}
|
||||
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otEnableMacBlacklist(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
if (aInstance) (void)SetIOCTL(aInstance, IOCTL_OTLWF_OT_MAC_BLACKLIST_ENABLED, (BOOLEAN)TRUE);
|
||||
if (aInstance) (void)SetIOCTL(aInstance, IOCTL_OTLWF_OT_MAC_BLACKLIST_ENABLED, (BOOLEAN)aEnabled);
|
||||
}
|
||||
|
||||
OTAPI
|
||||
bool
|
||||
OTCALL
|
||||
otIsMacBlacklistEnabled(
|
||||
otLinkIsBlacklistEnabled(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
@@ -2898,7 +2880,7 @@ otIsMacBlacklistEnabled(
|
||||
OTAPI
|
||||
ThreadError
|
||||
OTCALL
|
||||
otGetAssignLinkQuality(
|
||||
otLinkGetAssignLinkQuality(
|
||||
_In_ otInstance *aInstance,
|
||||
const uint8_t *aExtAddr,
|
||||
_Out_ uint8_t *aLinkQuality
|
||||
@@ -2911,7 +2893,7 @@ otGetAssignLinkQuality(
|
||||
OTAPI
|
||||
void
|
||||
OTCALL
|
||||
otSetAssignLinkQuality(
|
||||
otLinkSetAssignLinkQuality(
|
||||
_In_ otInstance *aInstance,
|
||||
const uint8_t *aExtAddr,
|
||||
uint8_t aLinkQuality
|
||||
@@ -3133,7 +3115,7 @@ otGetStableNetworkDataVersion(
|
||||
OTAPI
|
||||
const otMacCounters*
|
||||
OTCALL
|
||||
otGetMacCounters(
|
||||
otLinkGetCounters(
|
||||
_In_ otInstance *aInstance
|
||||
)
|
||||
{
|
||||
|
||||
@@ -134,8 +134,8 @@ OTLWF_IOCTL_HANDLER IoCtls[] =
|
||||
{ "IOCTL_OTLWF_OT_SEND_ACTIVE_SET", REF_IOCTL_FUNC(otSendActiveSet) },
|
||||
{ "IOCTL_OTLWF_OT_SEND_PENDING_GET", REF_IOCTL_FUNC(otSendPendingGet) },
|
||||
{ "IOCTL_OTLWF_OT_SEND_PENDING_SET", REF_IOCTL_FUNC(otSendPendingSet) },
|
||||
{ "IOCTL_OTLWF_OT_SEND_MGMT_COMMISSIONER_GET", REF_IOCTL_FUNC(otCommissionerSendMgmtGet) },
|
||||
{ "IOCTL_OTLWF_OT_SEND_MGMT_COMMISSIONER_SET", REF_IOCTL_FUNC(otCommissionerSendMgmtSet) },
|
||||
{ "IOCTL_OTLWF_OT_SEND_MGMT_COMMISSIONER_GET", REF_IOCTL_FUNC(otSendMgmtCommissionerGet) },
|
||||
{ "IOCTL_OTLWF_OT_SEND_MGMT_COMMISSIONER_SET", REF_IOCTL_FUNC(otSendMgmtCommissionerSet) },
|
||||
{ "IOCTL_OTLWF_OT_KEY_SWITCH_GUARDTIME", REF_IOCTL_FUNC_WITH_TUN(otKeySwitchGuardtime) },
|
||||
{ "IOCTL_OTLWF_OT_FACTORY_RESET", REF_IOCTL_FUNC(otFactoryReset) },
|
||||
{ "IOCTL_OTLWF_OT_THREAD_AUTO_START", REF_IOCTL_FUNC(otThreadAutoStart) }
|
||||
@@ -676,7 +676,7 @@ otLwfIoCtl_otActiveScan(
|
||||
uint32_t aScanChannels = *(uint32_t*)InBuffer;
|
||||
uint16_t aScanDuration = *(uint16_t*)(InBuffer + sizeof(uint32_t));
|
||||
status = ThreadErrorToNtstatus(
|
||||
otActiveScan(
|
||||
otLinkActiveScan(
|
||||
pFilter->otCtx,
|
||||
aScanChannels,
|
||||
aScanDuration,
|
||||
@@ -687,7 +687,7 @@ otLwfIoCtl_otActiveScan(
|
||||
}
|
||||
else if (*OutBufferLength >= sizeof(BOOLEAN))
|
||||
{
|
||||
*(BOOLEAN*)OutBuffer = otIsActiveScanInProgress(pFilter->otCtx) ? TRUE : FALSE;
|
||||
*(BOOLEAN*)OutBuffer = otLinkIsActiveScanInProgress(pFilter->otCtx) ? TRUE : FALSE;
|
||||
*OutBufferLength = sizeof(BOOLEAN);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -796,7 +796,7 @@ otLwfIoCtl_otEnergyScan(
|
||||
uint32_t aScanChannels = *(uint32_t*)InBuffer;
|
||||
uint16_t aScanDuration = *(uint16_t*)(InBuffer + sizeof(uint32_t));
|
||||
status = ThreadErrorToNtstatus(
|
||||
otEnergyScan(
|
||||
otLinkEnergyScan(
|
||||
pFilter->otCtx,
|
||||
aScanChannels,
|
||||
aScanDuration,
|
||||
@@ -807,7 +807,7 @@ otLwfIoCtl_otEnergyScan(
|
||||
}
|
||||
else if (*OutBufferLength >= sizeof(BOOLEAN))
|
||||
{
|
||||
*(BOOLEAN*)OutBuffer = otIsEnergyScanInProgress(pFilter->otCtx) ? TRUE : FALSE;
|
||||
*(BOOLEAN*)OutBuffer = otLinkIsEnergyScanInProgress(pFilter->otCtx) ? TRUE : FALSE;
|
||||
*OutBufferLength = sizeof(BOOLEAN);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -956,12 +956,12 @@ otLwfIoCtl_otChannel(
|
||||
|
||||
if (InBufferLength >= sizeof(uint8_t))
|
||||
{
|
||||
status = ThreadErrorToNtstatus(otSetChannel(pFilter->otCtx, *(uint8_t*)InBuffer));
|
||||
status = ThreadErrorToNtstatus(otLinkSetChannel(pFilter->otCtx, *(uint8_t*)InBuffer));
|
||||
*OutBufferLength = 0;
|
||||
}
|
||||
else if (*OutBufferLength >= sizeof(uint8_t))
|
||||
{
|
||||
*(uint8_t*)OutBuffer = otGetChannel(pFilter->otCtx);
|
||||
*(uint8_t*)OutBuffer = otLinkGetChannel(pFilter->otCtx);
|
||||
*OutBufferLength = sizeof(uint8_t);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -1153,12 +1153,12 @@ otLwfIoCtl_otExtendedAddress(
|
||||
|
||||
if (InBufferLength >= sizeof(otExtAddress))
|
||||
{
|
||||
status = ThreadErrorToNtstatus(otSetExtendedAddress(pFilter->otCtx, (otExtAddress*)InBuffer));
|
||||
status = ThreadErrorToNtstatus(otLinkSetExtendedAddress(pFilter->otCtx, (otExtAddress*)InBuffer));
|
||||
*OutBufferLength = 0;
|
||||
}
|
||||
else if (*OutBufferLength >= sizeof(otExtAddress))
|
||||
{
|
||||
memcpy(OutBuffer, otGetExtendedAddress(pFilter->otCtx), sizeof(otExtAddress));
|
||||
memcpy(OutBuffer, otLinkGetExtendedAddress(pFilter->otCtx), sizeof(otExtAddress));
|
||||
*OutBufferLength = sizeof(otExtAddress);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -1360,7 +1360,7 @@ otLwfIoCtl_otFactoryAssignedIeeeEui64(
|
||||
|
||||
if (*OutBufferLength >= sizeof(otExtAddress))
|
||||
{
|
||||
otGetFactoryAssignedIeeeEui64(pFilter->otCtx, (otExtAddress*)OutBuffer);
|
||||
otLinkGetFactoryAssignedIeeeEui64(pFilter->otCtx, (otExtAddress*)OutBuffer);
|
||||
*OutBufferLength = sizeof(otExtAddress);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -1391,7 +1391,7 @@ otLwfIoCtl_otHashMacAddress(
|
||||
|
||||
if (*OutBufferLength >= sizeof(otExtAddress))
|
||||
{
|
||||
otGetHashMacAddress(pFilter->otCtx, (otExtAddress*)OutBuffer);
|
||||
otLinkGetJoinerId(pFilter->otCtx, (otExtAddress*)OutBuffer);
|
||||
*OutBufferLength = sizeof(otExtAddress);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -2042,12 +2042,12 @@ otLwfIoCtl_otPanId(
|
||||
|
||||
if (InBufferLength >= sizeof(otPanId))
|
||||
{
|
||||
status = ThreadErrorToNtstatus(otSetPanId(pFilter->otCtx, *(otPanId*)InBuffer));
|
||||
status = ThreadErrorToNtstatus(otLinkSetPanId(pFilter->otCtx, *(otPanId*)InBuffer));
|
||||
*OutBufferLength = 0;
|
||||
}
|
||||
else if (*OutBufferLength >= sizeof(otPanId))
|
||||
{
|
||||
*(otPanId*)OutBuffer = otGetPanId(pFilter->otCtx);
|
||||
*(otPanId*)OutBuffer = otLinkGetPanId(pFilter->otCtx);
|
||||
*OutBufferLength = sizeof(otPanId);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -2242,7 +2242,7 @@ otLwfIoCtl_otShortAddress(
|
||||
|
||||
if (*OutBufferLength >= sizeof(otShortAddress))
|
||||
{
|
||||
*(otShortAddress*)OutBuffer = otGetShortAddress(pFilter->otCtx);
|
||||
*(otShortAddress*)OutBuffer = otLinkGetShortAddress(pFilter->otCtx);
|
||||
*OutBufferLength = sizeof(otShortAddress);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -3346,20 +3346,13 @@ otLwfIoCtl_otMacWhitelistEnabled(
|
||||
if (InBufferLength >= sizeof(BOOLEAN))
|
||||
{
|
||||
BOOLEAN aEnabled = *(BOOLEAN*)InBuffer;
|
||||
if (aEnabled)
|
||||
{
|
||||
otEnableMacWhitelist(pFilter->otCtx);
|
||||
}
|
||||
else
|
||||
{
|
||||
otDisableMacWhitelist(pFilter->otCtx);
|
||||
}
|
||||
otLinkSetWhitelistEnabled(pFilter->otCtx, aEnabled);
|
||||
status = STATUS_SUCCESS;
|
||||
*OutBufferLength = 0;
|
||||
}
|
||||
else if (*OutBufferLength >= sizeof(BOOLEAN))
|
||||
{
|
||||
*(BOOLEAN*)OutBuffer = otIsMacWhitelistEnabled(pFilter->otCtx) ? TRUE : FALSE;
|
||||
*(BOOLEAN*)OutBuffer = otLinkIsWhitelistEnabled(pFilter->otCtx) ? TRUE : FALSE;
|
||||
status = STATUS_SUCCESS;
|
||||
*OutBufferLength = sizeof(BOOLEAN);
|
||||
}
|
||||
@@ -3456,11 +3449,11 @@ otLwfIoCtl_otAddMacWhitelist(
|
||||
if (InBufferLength >= sizeof(otExtAddress) + sizeof(int8_t))
|
||||
{
|
||||
int8_t aRssi = *(int8_t*)(InBuffer + sizeof(otExtAddress));
|
||||
status = ThreadErrorToNtstatus(otAddMacWhitelistRssi(pFilter->otCtx, (uint8_t*)InBuffer, aRssi));
|
||||
status = ThreadErrorToNtstatus(otLinkAddWhitelistRssi(pFilter->otCtx, (uint8_t*)InBuffer, aRssi));
|
||||
}
|
||||
else if (InBufferLength >= sizeof(otExtAddress))
|
||||
{
|
||||
status = ThreadErrorToNtstatus(otAddMacWhitelist(pFilter->otCtx, (uint8_t*)InBuffer));
|
||||
status = ThreadErrorToNtstatus(otLinkAddWhitelist(pFilter->otCtx, (uint8_t*)InBuffer));
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -3526,7 +3519,7 @@ otLwfIoCtl_otRemoveMacWhitelist(
|
||||
|
||||
if (InBufferLength >= sizeof(otExtAddress))
|
||||
{
|
||||
otRemoveMacWhitelist(pFilter->otCtx, (uint8_t*)InBuffer);
|
||||
otLinkRemoveWhitelist(pFilter->otCtx, (uint8_t*)InBuffer);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -3583,7 +3576,7 @@ otLwfIoCtl_otMacWhitelistEntry(
|
||||
*OutBufferLength >= sizeof(otMacWhitelistEntry))
|
||||
{
|
||||
status = ThreadErrorToNtstatus(
|
||||
otGetMacWhitelistEntry(
|
||||
otLinkGetWhitelistEntry(
|
||||
pFilter->otCtx,
|
||||
*(uint8_t*)InBuffer,
|
||||
(otMacWhitelistEntry*)OutBuffer)
|
||||
@@ -3617,7 +3610,7 @@ otLwfIoCtl_otClearMacWhitelist(
|
||||
UNREFERENCED_PARAMETER(OutBuffer);
|
||||
*OutBufferLength = 0;
|
||||
|
||||
otClearMacWhitelist(pFilter->otCtx);
|
||||
otLinkClearWhitelist(pFilter->otCtx);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -4541,20 +4534,13 @@ otLwfIoCtl_otMacBlacklistEnabled(
|
||||
if (InBufferLength >= sizeof(BOOLEAN))
|
||||
{
|
||||
BOOLEAN aEnabled = *(BOOLEAN*)InBuffer;
|
||||
if (aEnabled)
|
||||
{
|
||||
otEnableMacBlacklist(pFilter->otCtx);
|
||||
}
|
||||
else
|
||||
{
|
||||
otDisableMacBlacklist(pFilter->otCtx);
|
||||
}
|
||||
otLinkSetBlacklistEnabled(pFilter->otCtx, aEnabled);
|
||||
status = STATUS_SUCCESS;
|
||||
*OutBufferLength = 0;
|
||||
}
|
||||
else if (*OutBufferLength >= sizeof(BOOLEAN))
|
||||
{
|
||||
*(BOOLEAN*)OutBuffer = otIsMacBlacklistEnabled(pFilter->otCtx) ? TRUE : FALSE;
|
||||
*(BOOLEAN*)OutBuffer = otLinkIsBlacklistEnabled(pFilter->otCtx) ? TRUE : FALSE;
|
||||
status = STATUS_SUCCESS;
|
||||
*OutBufferLength = sizeof(BOOLEAN);
|
||||
}
|
||||
@@ -4585,7 +4571,7 @@ otLwfIoCtl_otAddMacBlacklist(
|
||||
|
||||
if (InBufferLength >= sizeof(otExtAddress))
|
||||
{
|
||||
status = ThreadErrorToNtstatus(otAddMacBlacklist(pFilter->otCtx, (uint8_t*)InBuffer));
|
||||
status = ThreadErrorToNtstatus(otLinkAddBlacklist(pFilter->otCtx, (uint8_t*)InBuffer));
|
||||
}
|
||||
|
||||
return status;
|
||||
@@ -4610,7 +4596,7 @@ otLwfIoCtl_otRemoveMacBlacklist(
|
||||
|
||||
if (InBufferLength >= sizeof(otExtAddress))
|
||||
{
|
||||
otRemoveMacBlacklist(pFilter->otCtx, (uint8_t*)InBuffer);
|
||||
otLinkRemoveBlacklist(pFilter->otCtx, (uint8_t*)InBuffer);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -4635,7 +4621,7 @@ otLwfIoCtl_otMacBlacklistEntry(
|
||||
*OutBufferLength >= sizeof(otMacBlacklistEntry))
|
||||
{
|
||||
status = ThreadErrorToNtstatus(
|
||||
otGetMacBlacklistEntry(
|
||||
otLinkGetBlacklistEntry(
|
||||
pFilter->otCtx,
|
||||
*(uint8_t*)InBuffer,
|
||||
(otMacBlacklistEntry*)OutBuffer)
|
||||
@@ -4669,7 +4655,7 @@ otLwfIoCtl_otClearMacBlacklist(
|
||||
UNREFERENCED_PARAMETER(OutBuffer);
|
||||
*OutBufferLength = 0;
|
||||
|
||||
otClearMacBlacklist(pFilter->otCtx);
|
||||
otLinkClearBlacklist(pFilter->otCtx);
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -4690,13 +4676,13 @@ otLwfIoCtl_otMaxTransmitPower(
|
||||
|
||||
if (InBufferLength >= sizeof(int8_t))
|
||||
{
|
||||
otSetMaxTransmitPower(pFilter->otCtx, *(int8_t*)InBuffer);
|
||||
otLinkSetMaxTransmitPower(pFilter->otCtx, *(int8_t*)InBuffer);
|
||||
status = STATUS_SUCCESS;
|
||||
*OutBufferLength = 0;
|
||||
}
|
||||
else if (*OutBufferLength >= sizeof(int8_t))
|
||||
{
|
||||
*(int8_t*)OutBuffer = otGetMaxTransmitPower(pFilter->otCtx);
|
||||
*(int8_t*)OutBuffer = otLinkGetMaxTransmitPower(pFilter->otCtx);
|
||||
*OutBufferLength = sizeof(int8_t);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -4765,13 +4751,13 @@ otLwfIoCtl_otPollPeriod(
|
||||
|
||||
if (InBufferLength >= sizeof(uint32_t))
|
||||
{
|
||||
otSetPollPeriod(pFilter->otCtx, *(uint32_t*)InBuffer);
|
||||
otLinkSetPollPeriod(pFilter->otCtx, *(uint32_t*)InBuffer);
|
||||
status = STATUS_SUCCESS;
|
||||
*OutBufferLength = 0;
|
||||
}
|
||||
else if (*OutBufferLength >= sizeof(uint32_t))
|
||||
{
|
||||
*(uint32_t*)OutBuffer = otGetPollPeriod(pFilter->otCtx);
|
||||
*(uint32_t*)OutBuffer = otLinkGetPollPeriod(pFilter->otCtx);
|
||||
*OutBufferLength = sizeof(uint32_t);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -4833,7 +4819,7 @@ otLwfIoCtl_otAssignLinkQuality(
|
||||
|
||||
if (InBufferLength >= sizeof(otExtAddress) + sizeof(uint8_t))
|
||||
{
|
||||
otSetAssignLinkQuality(
|
||||
otLinkSetAssignLinkQuality(
|
||||
pFilter->otCtx,
|
||||
(uint8_t*)InBuffer,
|
||||
*(uint8_t*)(InBuffer + sizeof(otExtAddress)));
|
||||
@@ -4844,7 +4830,7 @@ otLwfIoCtl_otAssignLinkQuality(
|
||||
*OutBufferLength >= sizeof(uint8_t))
|
||||
{
|
||||
status = ThreadErrorToNtstatus(
|
||||
otGetAssignLinkQuality(
|
||||
otLinkGetAssignLinkQuality(
|
||||
pFilter->otCtx,
|
||||
(uint8_t*)InBuffer,
|
||||
(uint8_t*)OutBuffer)
|
||||
@@ -5075,7 +5061,7 @@ otLwfIoCtl_otMacCounters(
|
||||
|
||||
if (*OutBufferLength >= sizeof(otMacCounters))
|
||||
{
|
||||
memcpy_s(OutBuffer, *OutBufferLength, otGetMacCounters(pFilter->otCtx), sizeof(otMacCounters));
|
||||
memcpy_s(OutBuffer, *OutBufferLength, otLinkGetCounters(pFilter->otCtx), sizeof(otMacCounters));
|
||||
*OutBufferLength = sizeof(otMacCounters);
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
@@ -5898,7 +5884,7 @@ otLwfIoCtl_otSendPendingSet(
|
||||
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
NTSTATUS
|
||||
otLwfIoCtl_otCommissionerSendMgmtGet(
|
||||
otLwfIoCtl_otSendMgmtCommissionerGet(
|
||||
_In_ PMS_FILTER pFilter,
|
||||
_In_reads_bytes_(InBufferLength)
|
||||
PUCHAR InBuffer,
|
||||
@@ -5934,7 +5920,7 @@ otLwfIoCtl_otCommissionerSendMgmtGet(
|
||||
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
NTSTATUS
|
||||
otLwfIoCtl_otCommissionerSendMgmtSet(
|
||||
otLwfIoCtl_otSendMgmtCommissionerSet(
|
||||
_In_ PMS_FILTER pFilter,
|
||||
_In_reads_bytes_(InBufferLength)
|
||||
PUCHAR InBuffer,
|
||||
|
||||
@@ -220,8 +220,8 @@ DECL_IOCTL_FUNC(otSendActiveGet);
|
||||
DECL_IOCTL_FUNC(otSendActiveSet);
|
||||
DECL_IOCTL_FUNC(otSendPendingGet);
|
||||
DECL_IOCTL_FUNC(otSendPendingSet);
|
||||
DECL_IOCTL_FUNC(otCommissionerSendMgmtGet);
|
||||
DECL_IOCTL_FUNC(otCommissionerSendMgmtSet);
|
||||
DECL_IOCTL_FUNC(otSendMgmtCommissionerGet);
|
||||
DECL_IOCTL_FUNC(otSendMgmtCommissionerSet);
|
||||
DECL_IOCTL_FUNC_WITH_TUN2(otKeySwitchGuardtime);
|
||||
DECL_IOCTL_FUNC(otFactoryReset);
|
||||
DECL_IOCTL_FUNC(otThreadAutoStart);
|
||||
|
||||
@@ -1 +1 @@
|
||||
#include "precomp.h"
|
||||
#include "precomp.h"
|
||||
|
||||
@@ -1068,7 +1068,7 @@ OTNODEAPI int32_t OTCALL otNodeClearWhitelist(otNode* aNode)
|
||||
otLogFuncEntryMsg("[%d]", aNode->mId);
|
||||
printf("%d: whitelist clear\r\n", aNode->mId);
|
||||
|
||||
otClearMacWhitelist(aNode->mInstance);
|
||||
otLinkClearWhitelist(aNode->mInstance);
|
||||
otLogFuncExit();
|
||||
return 0;
|
||||
}
|
||||
@@ -1078,7 +1078,7 @@ OTNODEAPI int32_t OTCALL otNodeEnableWhitelist(otNode* aNode)
|
||||
otLogFuncEntryMsg("[%d]", aNode->mId);
|
||||
printf("%d: whitelist enable\r\n", aNode->mId);
|
||||
|
||||
otEnableMacWhitelist(aNode->mInstance);
|
||||
otLinkSetWhitelistEnabled(aNode->mInstance, true);
|
||||
otLogFuncExit();
|
||||
return 0;
|
||||
}
|
||||
@@ -1088,7 +1088,7 @@ OTNODEAPI int32_t OTCALL otNodeDisableWhitelist(otNode* aNode)
|
||||
otLogFuncEntryMsg("[%d]", aNode->mId);
|
||||
printf("%d: whitelist disable\r\n", aNode->mId);
|
||||
|
||||
otDisableMacWhitelist(aNode->mInstance);
|
||||
otLinkSetWhitelistEnabled(aNode->mInstance, false);
|
||||
otLogFuncExit();
|
||||
return 0;
|
||||
}
|
||||
@@ -1107,11 +1107,11 @@ OTNODEAPI int32_t OTCALL otNodeAddWhitelist(otNode* aNode, const char *aExtAddr,
|
||||
ThreadError error;
|
||||
if (aRssi == 0)
|
||||
{
|
||||
error = otAddMacWhitelist(aNode->mInstance, extAddr);
|
||||
error = otLinkAddWhitelist(aNode->mInstance, extAddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
error = otAddMacWhitelistRssi(aNode->mInstance, extAddr, aRssi);
|
||||
error = otLinkAddWhitelistRssi(aNode->mInstance, extAddr, aRssi);
|
||||
}
|
||||
otLogFuncExit();
|
||||
return error;
|
||||
@@ -1126,7 +1126,7 @@ OTNODEAPI int32_t OTCALL otNodeRemoveWhitelist(otNode* aNode, const char *aExtAd
|
||||
if (Hex2Bin(aExtAddr, extAddr, sizeof(extAddr)) != sizeof(extAddr))
|
||||
return kThreadError_InvalidArgs;
|
||||
|
||||
otRemoveMacWhitelist(aNode->mInstance, extAddr);
|
||||
otLinkRemoveWhitelist(aNode->mInstance, extAddr);
|
||||
otLogFuncExit();
|
||||
return 0;
|
||||
}
|
||||
@@ -1144,7 +1144,7 @@ OTNODEAPI const char* OTCALL otNodeGetHashMacAddress(otNode* aNode)
|
||||
{
|
||||
otLogFuncEntryMsg("[%d]", aNode->mId);
|
||||
otExtAddress aHashMacAddress = {};
|
||||
otGetHashMacAddress(aNode->mInstance, &aHashMacAddress);
|
||||
otLinkGetJoinerId(aNode->mInstance, &aHashMacAddress);
|
||||
char* str = (char*)malloc(18);
|
||||
if (str != nullptr)
|
||||
{
|
||||
@@ -1160,7 +1160,7 @@ OTNODEAPI const char* OTCALL otNodeGetHashMacAddress(otNode* aNode)
|
||||
OTNODEAPI const char* OTCALL otNodeGetAddr64(otNode* aNode)
|
||||
{
|
||||
otLogFuncEntryMsg("[%d]", aNode->mId);
|
||||
auto extAddr = otGetExtendedAddress(aNode->mInstance);
|
||||
auto extAddr = otLinkGetExtendedAddress(aNode->mInstance);
|
||||
char* str = (char*)malloc(18);
|
||||
if (str != nullptr)
|
||||
{
|
||||
@@ -1178,7 +1178,7 @@ OTNODEAPI int32_t OTCALL otNodeSetChannel(otNode* aNode, uint8_t aChannel)
|
||||
{
|
||||
otLogFuncEntryMsg("[%d]", aNode->mId);
|
||||
printf("%d: channel %d\r\n", aNode->mId, aChannel);
|
||||
auto result = otSetChannel(aNode->mInstance, aChannel);
|
||||
auto result = otLinkSetChannel(aNode->mInstance, aChannel);
|
||||
otLogFuncExit();
|
||||
return result;
|
||||
}
|
||||
@@ -1186,7 +1186,7 @@ OTNODEAPI int32_t OTCALL otNodeSetChannel(otNode* aNode, uint8_t aChannel)
|
||||
OTNODEAPI uint8_t OTCALL otNodeGetChannel(otNode* aNode)
|
||||
{
|
||||
otLogFuncEntryMsg("[%d]", aNode->mId);
|
||||
auto result = otGetChannel(aNode->mInstance);
|
||||
auto result = otLinkGetChannel(aNode->mInstance);
|
||||
printf("%d: channel\r\n%d\r\n", aNode->mId, result);
|
||||
otLogFuncExit();
|
||||
return result;
|
||||
@@ -1287,7 +1287,7 @@ OTNODEAPI const char* OTCALL otNodeGetNetworkName(otNode* aNode)
|
||||
OTNODEAPI uint16_t OTCALL otNodeGetPanId(otNode* aNode)
|
||||
{
|
||||
otLogFuncEntryMsg("[%d]", aNode->mId);
|
||||
auto result = otGetPanId(aNode->mInstance);
|
||||
auto result = otLinkGetPanId(aNode->mInstance);
|
||||
printf("%d: panid\r\n0x%04x\r\n", aNode->mId, result);
|
||||
otLogFuncExit();
|
||||
return result;
|
||||
@@ -1297,7 +1297,7 @@ OTNODEAPI int32_t OTCALL otNodeSetPanId(otNode* aNode, uint16_t aPanId)
|
||||
{
|
||||
otLogFuncEntryMsg("[%d]", aNode->mId);
|
||||
printf("%d: panid 0x%04x\r\n", aNode->mId, aPanId);
|
||||
auto result = otSetPanId(aNode->mInstance, aPanId);
|
||||
auto result = otLinkSetPanId(aNode->mInstance, aPanId);
|
||||
otLogFuncExit();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1093,26 +1093,6 @@ typedef void (OTCALL *otDeviceAvailabilityChangedCallback)(bool aAdded, const GU
|
||||
|
||||
#endif // OTDLL
|
||||
|
||||
/**
|
||||
* This function pointer is called during an IEEE 802.15.4 Active Scan when an IEEE 802.15.4 Beacon is received or
|
||||
* the scan completes.
|
||||
*
|
||||
* @param[in] aResult A valid pointer to the beacon information or NULL when the active scan completes.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (OTCALL *otHandleActiveScanResult)(otActiveScanResult *aResult, void *aContext);
|
||||
|
||||
/**
|
||||
* This function pointer is called during an IEEE 802.15.4 Energy Scan when the result for a channel is ready or the
|
||||
* scan completes.
|
||||
*
|
||||
* @param[in] aResult A valid pointer to the energy scan result information or NULL when the energy scan completes.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (OTCALL *otHandleEnergyScanResult)(otEnergyScanResult *aResult, void *aContext);
|
||||
|
||||
/**
|
||||
* This function pointer is called to notify certain configuration or state changes within OpenThread.
|
||||
*
|
||||
|
||||
+1
-466
@@ -39,6 +39,7 @@
|
||||
|
||||
#include "openthread/crypto.h"
|
||||
#include "openthread/ip6.h"
|
||||
#include "openthread/link.h"
|
||||
#include "openthread/message.h"
|
||||
#include "openthread/tasklet.h"
|
||||
|
||||
@@ -315,57 +316,6 @@ OTAPI bool OTCALL otThreadGetAutoStart(otInstance *aInstance);
|
||||
*/
|
||||
OTAPI bool OTCALL otIsSingleton(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function starts an IEEE 802.15.4 Active Scan
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @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 called on receiving a beacon or scan completes.
|
||||
* @param[in] aCallbackContext A pointer to application-specific context.
|
||||
*
|
||||
* @retval kThreadError_None Accepted the Active Scan request.
|
||||
* @retval kThreadError_Busy Already performing an Active Scan.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otActiveScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration,
|
||||
otHandleActiveScanResult aCallback, void *aCallbackContext);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not an IEEE 802.15.4 Active Scan is currently in progress.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns true if an IEEE 802.15.4 Active Scan is in progress, false otherwise.
|
||||
*/
|
||||
OTAPI bool OTCALL otIsActiveScanInProgress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function starts an IEEE 802.15.4 Energy Scan
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aScanChannels A bit vector indicating on which channels to perform energy scan.
|
||||
* @param[in] aScanDuration The time in milliseconds to spend scanning each channel.
|
||||
* @param[in] aCallback A pointer to a function called to pass on scan result on indicate scan completion.
|
||||
* @param[in] aCallbackContext A pointer to application-specific context.
|
||||
*
|
||||
* @retval kThreadError_None Accepted the Energy Scan request.
|
||||
* @retval kThreadError_Busy Could not start the energy scan.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otEnergyScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration,
|
||||
otHandleEnergyScanResult aCallback, void *aCallbackContext);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not an IEEE 802.15.4 Energy Scan is currently in progress.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns true if an IEEE 802.15.4 Energy Scan is in progress, false otherwise.
|
||||
*
|
||||
*/
|
||||
OTAPI bool OTCALL otIsEnergyScanInProgress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function starts a Thread Discovery scan.
|
||||
*
|
||||
@@ -392,19 +342,6 @@ OTAPI ThreadError OTCALL otDiscover(otInstance *aInstance, uint32_t aScanChannel
|
||||
*/
|
||||
OTAPI bool OTCALL otIsDiscoverInProgress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function enqueues an IEEE 802.15.4 Data Request message for transmission.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval kThreadError_None Successfully enqueued an IEEE 802.15.4 Data Request message.
|
||||
* @retval kThreadError_Already An IEEE 802.15.4 Data Request message is already enqueued.
|
||||
* @retval kThreadError_InvalidState Device is not in rx-off-when-idle mode.
|
||||
* @retval kThreadError_NoBufs Insufficient message buffers available.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otSendMacDataRequest(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
@@ -430,30 +367,6 @@ OTAPI ThreadError OTCALL otSendMacDataRequest(otInstance *aInstance);
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 channel.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The IEEE 802.15.4 channel.
|
||||
*
|
||||
* @sa otSetChannel
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otGetChannel(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the IEEE 802.15.4 channel
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChannel The IEEE 802.15.4 channel.
|
||||
*
|
||||
* @retval kThreadError_None Successfully set the channel.
|
||||
* @retval kThreadError_InvalidArgs If @p aChannel is not in the range [11, 26].
|
||||
*
|
||||
* @sa otGetChannel
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otSetChannel(otInstance *aInstance, uint8_t aChannel);
|
||||
|
||||
/**
|
||||
* Set minimal delay timer.
|
||||
*
|
||||
@@ -524,27 +437,6 @@ OTAPI uint32_t OTCALL otGetChildTimeout(otInstance *aInstance);
|
||||
*/
|
||||
OTAPI void OTCALL otSetChildTimeout(otInstance *aInstance, uint32_t aTimeout);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*/
|
||||
OTAPI const uint8_t *OTCALL otGetExtendedAddress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtendedAddress A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @retval kThreadError_None Successfully set the IEEE 802.15.4 Extended Address.
|
||||
* @retval kThreadError_InvalidArgs @p aExtendedAddress was NULL.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtendedAddress);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 Extended PAN ID.
|
||||
*
|
||||
@@ -566,27 +458,6 @@ OTAPI const uint8_t *OTCALL otGetExtendedPanId(otInstance *aInstance);
|
||||
*/
|
||||
OTAPI void OTCALL otSetExtendedPanId(otInstance *aInstance, const uint8_t *aExtendedPanId);
|
||||
|
||||
/**
|
||||
* Get the factory-assigned IEEE EUI-64.
|
||||
*
|
||||
* @param[in] aInstance A pointer to the OpenThread instance.
|
||||
* @param[out] aEui64 A pointer to where the factory-assigned IEEE EUI-64 is placed.
|
||||
*
|
||||
*/
|
||||
OTAPI void OTCALL otGetFactoryAssignedIeeeEui64(otInstance *aInstance, otExtAddress *aEui64);
|
||||
|
||||
/**
|
||||
* Get the Hash Mac Address.
|
||||
*
|
||||
* Hash Mac Address is the first 64 bits of the result of computing SHA-256 over factory-assigned
|
||||
* IEEE EUI-64, which is used as IEEE 802.15.4 Extended Address during commissioning process.
|
||||
*
|
||||
* @param[in] aInstance A pointer to the OpenThread instance.
|
||||
* @param[out] aHashMacAddress A pointer to where the Hash Mac Address is placed.
|
||||
*
|
||||
*/
|
||||
OTAPI void OTCALL otGetHashMacAddress(otInstance *aInstance, otExtAddress *aHashMacAddress);
|
||||
|
||||
/**
|
||||
* This function returns a pointer to the Leader's RLOC.
|
||||
*
|
||||
@@ -650,25 +521,6 @@ OTAPI const uint8_t *OTCALL otGetMasterKey(otInstance *aInstance, uint8_t *aKeyL
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otSetMasterKey(otInstance *aInstance, const uint8_t *aKey, uint8_t aKeyLength);
|
||||
|
||||
/**
|
||||
* This function returns the maximum transmit power setting in dBm.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The maximum transmit power setting.
|
||||
*
|
||||
*/
|
||||
OTAPI int8_t OTCALL otGetMaxTransmitPower(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the maximum transmit power in dBm.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPower The maximum transmit power in dBm.
|
||||
*
|
||||
*/
|
||||
OTAPI void OTCALL otSetMaxTransmitPower(otInstance *aInstance, int8_t aPower);
|
||||
|
||||
/**
|
||||
* This function returns a pointer to the Mesh Local EID.
|
||||
*
|
||||
@@ -763,30 +615,6 @@ OTAPI ThreadError OTCALL otSetNetworkName(otInstance *aInstance, const char *aNe
|
||||
OTAPI ThreadError OTCALL otGetNextOnMeshPrefix(otInstance *aInstance, bool aLocal, otNetworkDataIterator *aIterator,
|
||||
otBorderRouterConfig *aConfig);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
* @sa otSetPanId
|
||||
*/
|
||||
OTAPI otPanId OTCALL otGetPanId(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPanId The IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully set the PAN ID.
|
||||
* @retval kThreadErrorInvalidArgs If aPanId is not in the range [0, 65534].
|
||||
*
|
||||
* @sa otGetPanId
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otSetPanId(otInstance *aInstance, otPanId aPanId);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not the Router Role is enabled.
|
||||
*
|
||||
@@ -807,15 +635,6 @@ OTAPI bool OTCALL otIsRouterRoleEnabled(otInstance *aInstance);
|
||||
*/
|
||||
OTAPI void OTCALL otSetRouterRoleEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 Short Address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns A pointer to the IEEE 802.15.4 Short Address.
|
||||
*/
|
||||
OTAPI otShortAddress OTCALL otGetShortAddress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function registers a callback to indicate when certain configuration or state changes within OpenThread.
|
||||
*
|
||||
@@ -961,30 +780,6 @@ OTAPI ThreadError OTCALL otSendPendingGet(otInstance *aInstance, const uint8_t *
|
||||
OTAPI ThreadError OTCALL otSendPendingSet(otInstance *aInstance, const otOperationalDataset *aDataset,
|
||||
const uint8_t *aTlvs, uint8_t aLength);
|
||||
|
||||
/**
|
||||
* Get the data poll period of sleepy end device.
|
||||
*
|
||||
* @note This function updates only poll period of sleepy end device. To update child timeout the function
|
||||
* otGetChildTimeout() shall be called.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The data poll period of sleepy end device.
|
||||
*
|
||||
* @sa otSetPollPeriod
|
||||
*/
|
||||
OTAPI uint32_t OTCALL otGetPollPeriod(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the data poll period for sleepy end device.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPollPeriod data poll period.
|
||||
*
|
||||
* @sa otGetPollPeriod
|
||||
*/
|
||||
OTAPI void OTCALL otSetPollPeriod(otInstance *aInstance, uint32_t aPollPeriod);
|
||||
|
||||
/**
|
||||
* Set the preferred Router Id.
|
||||
*
|
||||
@@ -1294,131 +1089,6 @@ OTAPI void OTCALL otSetRouterUpgradeThreshold(otInstance *aInstance, uint8_t aTh
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otReleaseRouterId(otInstance *aInstance, uint8_t aRouterId);
|
||||
|
||||
/**
|
||||
* Add an IEEE 802.15.4 Extended Address to the MAC whitelist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully added to the MAC whitelist.
|
||||
* @retval kThreadErrorNoBufs No buffers available for a new MAC whitelist entry.
|
||||
*
|
||||
* @sa otAddMacWhitelistRssi
|
||||
* @sa otRemoveMacWhitelist
|
||||
* @sa otClearMacWhitelist
|
||||
* @sa otGetMacWhitelistEntry
|
||||
* @sa otDisableMacWhitelist
|
||||
* @sa otEnableMacWhitelist
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otAddMacWhitelist(otInstance *aInstance, const uint8_t *aExtAddr);
|
||||
|
||||
/**
|
||||
* Add an IEEE 802.15.4 Extended Address to the MAC whitelist and fix the RSSI value.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
* @param[in] aRssi The RSSI in dBm to use when receiving messages from aExtAddr.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully added to the MAC whitelist.
|
||||
* @retval kThreadErrorNoBufs No buffers available for a new MAC whitelist entry.
|
||||
*
|
||||
* @sa otAddMacWhitelistRssi
|
||||
* @sa otRemoveMacWhitelist
|
||||
* @sa otClearMacWhitelist
|
||||
* @sa otGetMacWhitelistEntry
|
||||
* @sa otDisableMacWhitelist
|
||||
* @sa otEnableMacWhitelist
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otAddMacWhitelistRssi(otInstance *aInstance, const uint8_t *aExtAddr, int8_t aRssi);
|
||||
|
||||
/**
|
||||
* Remove an IEEE 802.15.4 Extended Address from the MAC whitelist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @sa otAddMacWhitelist
|
||||
* @sa otAddMacWhitelistRssi
|
||||
* @sa otClearMacWhitelist
|
||||
* @sa otGetMacWhitelistEntry
|
||||
* @sa otDisableMacWhitelist
|
||||
* @sa otEnableMacWhitelist
|
||||
*/
|
||||
OTAPI void OTCALL otRemoveMacWhitelist(otInstance *aInstance, const uint8_t *aExtAddr);
|
||||
|
||||
/**
|
||||
* This function gets a MAC whitelist entry.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aIndex An index into the MAC whitelist table.
|
||||
* @param[out] aEntry A pointer to where the information is placed.
|
||||
*
|
||||
* @retval kThreadError_None Successfully retrieved the MAC whitelist entry.
|
||||
* @retval kThreadError_InvalidArgs @p aIndex is out of bounds or @p aEntry is NULL.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otGetMacWhitelistEntry(otInstance *aInstance, uint8_t aIndex, otMacWhitelistEntry *aEntry);
|
||||
|
||||
/**
|
||||
* Remove all entries from the MAC whitelist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @sa otAddMacWhitelist
|
||||
* @sa otAddMacWhitelistRssi
|
||||
* @sa otRemoveMacWhitelist
|
||||
* @sa otGetMacWhitelistEntry
|
||||
* @sa otDisableMacWhitelist
|
||||
* @sa otEnableMacWhitelist
|
||||
*/
|
||||
OTAPI void OTCALL otClearMacWhitelist(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Disable MAC whitelist filtering.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @sa otAddMacWhitelist
|
||||
* @sa otAddMacWhitelistRssi
|
||||
* @sa otRemoveMacWhitelist
|
||||
* @sa otClearMacWhitelist
|
||||
* @sa otGetMacWhitelistEntry
|
||||
* @sa otEnableMacWhitelist
|
||||
*/
|
||||
OTAPI void OTCALL otDisableMacWhitelist(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Enable MAC whitelist filtering.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @sa otAddMacWhitelist
|
||||
* @sa otAddMacWhitelistRssi
|
||||
* @sa otRemoveMacWhitelist
|
||||
* @sa otClearMacWhitelist
|
||||
* @sa otGetMacWhitelistEntry
|
||||
* @sa otDisableMacWhitelist
|
||||
*/
|
||||
OTAPI void OTCALL otEnableMacWhitelist(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not the MAC whitelist is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns TRUE if the MAC whitelist is enabled, FALSE otherwise.
|
||||
*
|
||||
* @sa otAddMacWhitelist
|
||||
* @sa otAddMacWhitelistRssi
|
||||
* @sa otRemoveMacWhitelist
|
||||
* @sa otClearMacWhitelist
|
||||
* @sa otGetMacWhitelistEntry
|
||||
* @sa otDisableMacWhitelist
|
||||
* @sa otEnableMacWhitelist
|
||||
*
|
||||
*/
|
||||
OTAPI bool OTCALL otIsMacWhitelistEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Detach from the Thread network.
|
||||
*
|
||||
@@ -1460,132 +1130,6 @@ OTAPI ThreadError OTCALL otBecomeRouter(otInstance *aInstance);
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otBecomeLeader(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Add an IEEE 802.15.4 Extended Address to the MAC blacklist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully added to the MAC blacklist.
|
||||
* @retval kThreadErrorNoBufs No buffers available for a new MAC blacklist entry.
|
||||
*
|
||||
* @sa otRemoveMacBlacklist
|
||||
* @sa otClearMacBlacklist
|
||||
* @sa otGetMacBlacklistEntry
|
||||
* @sa otDisableMacBlacklist
|
||||
* @sa otEnableMacBlacklist
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otAddMacBlacklist(otInstance *aInstance, const uint8_t *aExtAddr);
|
||||
|
||||
/**
|
||||
* Remove an IEEE 802.15.4 Extended Address from the MAC blacklist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @sa otAddMacBlacklist
|
||||
* @sa otClearMacBlacklist
|
||||
* @sa otGetMacBlacklistEntry
|
||||
* @sa otDisableMacBlacklist
|
||||
* @sa otEnableMacBlacklist
|
||||
*/
|
||||
OTAPI void OTCALL otRemoveMacBlacklist(otInstance *aInstance, const uint8_t *aExtAddr);
|
||||
|
||||
/**
|
||||
* This function gets a MAC Blacklist entry.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aIndex An index into the MAC Blacklist table.
|
||||
* @param[out] aEntry A pointer to where the information is placed.
|
||||
*
|
||||
* @retval kThreadError_None Successfully retrieved the MAC Blacklist entry.
|
||||
* @retval kThreadError_InvalidArgs @p aIndex is out of bounds or @p aEntry is NULL.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otGetMacBlacklistEntry(otInstance *aInstance, uint8_t aIndex, otMacBlacklistEntry *aEntry);
|
||||
|
||||
/**
|
||||
* Remove all entries from the MAC Blacklist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @sa otAddMacBlacklist
|
||||
* @sa otRemoveMacBlacklist
|
||||
* @sa otGetMacBlacklistEntry
|
||||
* @sa otDisableMacBlacklist
|
||||
* @sa otEnableMacBlacklist
|
||||
*/
|
||||
OTAPI void OTCALL otClearMacBlacklist(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Disable MAC blacklist filtering.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
*
|
||||
* @sa otAddMacBlacklist
|
||||
* @sa otRemoveMacBlacklist
|
||||
* @sa otClearMacBlacklist
|
||||
* @sa otGetMacBlacklistEntry
|
||||
* @sa otEnableMacBlacklist
|
||||
*/
|
||||
OTAPI void OTCALL otDisableMacBlacklist(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Enable MAC Blacklist filtering.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @sa otAddMacBlacklist
|
||||
* @sa otRemoveMacBlacklist
|
||||
* @sa otClearMacBlacklist
|
||||
* @sa otGetMacBlacklistEntry
|
||||
* @sa otDisableMacBlacklist
|
||||
*/
|
||||
OTAPI void OTCALL otEnableMacBlacklist(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not the MAC Blacklist is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns TRUE if the MAC Blacklist is enabled, FALSE otherwise.
|
||||
*
|
||||
* @sa otAddMacBlacklist
|
||||
* @sa otRemoveMacBlacklist
|
||||
* @sa otClearMacBlacklist
|
||||
* @sa otGetMacBlacklistEntry
|
||||
* @sa otDisableMacBlacklist
|
||||
* @sa otEnableMacBlacklist
|
||||
*
|
||||
*/
|
||||
OTAPI bool OTCALL otIsMacBlacklistEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the assigned link quality which is on the link to a given extended address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
* @param[in] aLinkQuality A pointer to the assigned link quality.
|
||||
*
|
||||
* @retval kThreadError_None Successfully retrieved the link quality to aLinkQuality.
|
||||
* @retval kThreadError_InvalidState No attached child matches with a given extended address.
|
||||
*
|
||||
* @sa otSetAssignLinkQuality
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otGetAssignLinkQuality(otInstance *aInstance, const uint8_t *aExtAddr, uint8_t *aLinkQuality);
|
||||
|
||||
/**
|
||||
* Set the link quality which is on the link to a given extended address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
* @param[in] aLinkQuality The link quality to be set on the link.
|
||||
*
|
||||
* @sa otGetAssignLinkQuality
|
||||
*/
|
||||
OTAPI void OTCALL otSetAssignLinkQuality(otInstance *aInstance, const uint8_t *aExtAddr, uint8_t aLinkQuality);
|
||||
|
||||
/**
|
||||
* This method triggers a platform reset.
|
||||
*
|
||||
@@ -1888,15 +1432,6 @@ OTAPI ThreadError OTCALL otSendDiagnosticGet(otInstance *aInstance, const otIp6A
|
||||
OTAPI ThreadError OTCALL otSendDiagnosticReset(otInstance *aInstance, const otIp6Address *aDestination,
|
||||
const uint8_t aTlvTypes[], uint8_t aCount);
|
||||
|
||||
/**
|
||||
* Get the MAC layer counters.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns A pointer to the MAC layer counters.
|
||||
*/
|
||||
OTAPI const otMacCounters *OTCALL otGetMacCounters(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
@@ -37,6 +37,7 @@ openthread_headers = \
|
||||
ip6.h \
|
||||
jam_detection.h \
|
||||
joiner.h \
|
||||
link.h \
|
||||
message.h \
|
||||
tasklet.h \
|
||||
udp.h \
|
||||
|
||||
@@ -42,72 +42,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup diags Diagnostics
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that expose internal state.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function pointer is called when an IEEE 802.15.4 frame is received.
|
||||
*
|
||||
* @note This callback is called after FCS processing and @p aFrame may not contain the actual FCS that was received.
|
||||
*
|
||||
* @note This callback is called before IEEE 802.15.4 security processing and mSecurityValid in @p aFrame will
|
||||
* always be false.
|
||||
*
|
||||
* @param[in] aFrame A pointer to the received IEEE 802.15.4 frame.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (*otLinkPcapCallback)(const RadioPacket *aFrame, void *aContext);
|
||||
|
||||
/**
|
||||
* This function registers a callback to provide received raw IEEE 802.15.4 frames.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPcapCallback A pointer to a function that is called when receiving an IEEE 802.15.4 link frame or
|
||||
* NULL to disable the callback.
|
||||
* @param[in] aCallbackContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
void otSetLinkPcapCallback(otInstance *aInstance, otLinkPcapCallback aPcapCallback, void *aCallbackContext);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not promiscuous mode is enabled at the link layer.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval true Promiscuous mode is enabled.
|
||||
* @retval false Promiscuous mode is not enabled.
|
||||
*
|
||||
*/
|
||||
bool otIsLinkPromiscuous(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function enables or disables the link layer promiscuous mode.
|
||||
*
|
||||
* @note Promiscuous mode may only be enabled when the Thread interface is disabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPromiscuous true to enable promiscuous mode, or false otherwise.
|
||||
*
|
||||
* @retval kThreadError_None Successfully enabled promiscuous mode.
|
||||
* @retval kThreadError_InvalidState Could not enable promiscuous mode because
|
||||
* the Thread interface is enabled.
|
||||
*
|
||||
*/
|
||||
ThreadError otSetLinkPromiscuous(otInstance *aInstance, bool aPromiscuous);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup ip6 IPv6
|
||||
*
|
||||
|
||||
@@ -0,0 +1,572 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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
|
||||
* @brief
|
||||
* This file defines the OpenThread IEEE 802.15.4 Link Layer API.
|
||||
*/
|
||||
|
||||
#ifndef OPENTHREAD_LINK_H_
|
||||
#define OPENTHREAD_LINK_H_
|
||||
|
||||
#include "openthread-types.h"
|
||||
#include "platform/radio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup link Link
|
||||
*
|
||||
* @brief
|
||||
* This module includes functions that control link-layer configuration.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function pointer is called during an IEEE 802.15.4 Active Scan when an IEEE 802.15.4 Beacon is received or
|
||||
* the scan completes.
|
||||
*
|
||||
* @param[in] aResult A valid pointer to the beacon information or NULL when the active scan completes.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (OTCALL *otHandleActiveScanResult)(otActiveScanResult *aResult, void *aContext);
|
||||
|
||||
/**
|
||||
* This function starts an IEEE 802.15.4 Active Scan
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @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 called on receiving a beacon or scan completes.
|
||||
* @param[in] aCallbackContext A pointer to application-specific context.
|
||||
*
|
||||
* @retval kThreadError_None Accepted the Active Scan request.
|
||||
* @retval kThreadError_Busy Already performing an Active Scan.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkActiveScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration,
|
||||
otHandleActiveScanResult aCallback, void *aCallbackContext);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not an IEEE 802.15.4 Active Scan is currently in progress.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns true if an IEEE 802.15.4 Active Scan is in progress, false otherwise.
|
||||
*/
|
||||
OTAPI bool OTCALL otLinkIsActiveScanInProgress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function pointer is called during an IEEE 802.15.4 Energy Scan when the result for a channel is ready or the
|
||||
* scan completes.
|
||||
*
|
||||
* @param[in] aResult A valid pointer to the energy scan result information or NULL when the energy scan completes.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (OTCALL *otHandleEnergyScanResult)(otEnergyScanResult *aResult, void *aContext);
|
||||
|
||||
/**
|
||||
* This function starts an IEEE 802.15.4 Energy Scan
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aScanChannels A bit vector indicating on which channels to perform energy scan.
|
||||
* @param[in] aScanDuration The time in milliseconds to spend scanning each channel.
|
||||
* @param[in] aCallback A pointer to a function called to pass on scan result on indicate scan completion.
|
||||
* @param[in] aCallbackContext A pointer to application-specific context.
|
||||
*
|
||||
* @retval kThreadError_None Accepted the Energy Scan request.
|
||||
* @retval kThreadError_Busy Could not start the energy scan.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkEnergyScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration,
|
||||
otHandleEnergyScanResult aCallback, void *aCallbackContext);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not an IEEE 802.15.4 Energy Scan is currently in progress.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns true if an IEEE 802.15.4 Energy Scan is in progress, false otherwise.
|
||||
*
|
||||
*/
|
||||
OTAPI bool OTCALL otLinkIsEnergyScanInProgress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function enqueues an IEEE 802.15.4 Data Request message for transmission.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval kThreadError_None Successfully enqueued an IEEE 802.15.4 Data Request message.
|
||||
* @retval kThreadError_Already An IEEE 802.15.4 Data Request message is already enqueued.
|
||||
* @retval kThreadError_InvalidState Device is not in rx-off-when-idle mode.
|
||||
* @retval kThreadError_NoBufs Insufficient message buffers available.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkSendDataRequest(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 channel.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The IEEE 802.15.4 channel.
|
||||
*
|
||||
* @sa otLinkSetChannel
|
||||
*/
|
||||
OTAPI uint8_t OTCALL otLinkGetChannel(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the IEEE 802.15.4 channel
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aChannel The IEEE 802.15.4 channel.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully set the channel.
|
||||
* @retval kThreadErrorInvalidArgs If @p aChnanel is not in the range [11, 26].
|
||||
*
|
||||
* @sa otLinkGetChannel
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkSetChannel(otInstance *aInstance, uint8_t aChannel);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*/
|
||||
OTAPI const uint8_t *OTCALL otLinkGetExtendedAddress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtendedAddress A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @retval kThreadError_None Successfully set the IEEE 802.15.4 Extended Address.
|
||||
* @retval kThreadError_InvalidArgs @p aExtendedAddress was NULL.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtendedAddress);
|
||||
|
||||
/**
|
||||
* Get the factory-assigned IEEE EUI-64.
|
||||
*
|
||||
* @param[in] aInstance A pointer to the OpenThread instance.
|
||||
* @param[out] aEui64 A pointer to where the factory-assigned IEEE EUI-64 is placed.
|
||||
*
|
||||
*/
|
||||
OTAPI void OTCALL otLinkGetFactoryAssignedIeeeEui64(otInstance *aInstance, otExtAddress *aEui64);
|
||||
|
||||
/**
|
||||
* Get the Joiner ID.
|
||||
*
|
||||
* Joiner ID is the first 64 bits of the result of computing SHA-256 over factory-assigned
|
||||
* IEEE EUI-64, which is used as IEEE 802.15.4 Extended Address during commissioning process.
|
||||
*
|
||||
* @param[in] aInstance A pointer to the OpenThread instance.
|
||||
* @param[out] aHashMacAddress A pointer to where the Hash Mac Address is placed.
|
||||
*
|
||||
*/
|
||||
OTAPI void OTCALL otLinkGetJoinerId(otInstance *aInstance, otExtAddress *aHashMacAddress);
|
||||
|
||||
/**
|
||||
* This function returns the maximum transmit power setting in dBm.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The maximum transmit power setting.
|
||||
*
|
||||
*/
|
||||
OTAPI int8_t OTCALL otLinkGetMaxTransmitPower(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function sets the maximum transmit power in dBm.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPower The maximum transmit power in dBm.
|
||||
*
|
||||
*/
|
||||
OTAPI void OTCALL otLinkSetMaxTransmitPower(otInstance *aInstance, int8_t aPower);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
* @sa otLinkSetPanId
|
||||
*/
|
||||
OTAPI otPanId OTCALL otLinkGetPanId(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPanId The IEEE 802.15.4 PAN ID.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully set the PAN ID.
|
||||
* @retval kThreadErrorInvalidArgs If aPanId is not in the range [0, 65534].
|
||||
*
|
||||
* @sa otLinkGetPanId
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkSetPanId(otInstance *aInstance, otPanId aPanId);
|
||||
|
||||
/**
|
||||
* Get the data poll period of sleepy end device.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns The data poll period of sleepy end device.
|
||||
*
|
||||
* @sa otLinkSetPollPeriod
|
||||
*/
|
||||
OTAPI uint32_t OTCALL otLinkGetPollPeriod(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Set the data poll period for sleepy end device.
|
||||
*
|
||||
* @note This function updates only poll period of sleepy end device. To update child timeout the function
|
||||
* otSetChildTimeout() shall be called.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPollPeriod data poll period.
|
||||
*
|
||||
* @sa otLinkGetPollPeriod
|
||||
*/
|
||||
OTAPI void OTCALL otLinkSetPollPeriod(otInstance *aInstance, uint32_t aPollPeriod);
|
||||
|
||||
/**
|
||||
* Get the IEEE 802.15.4 Short Address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns A pointer to the IEEE 802.15.4 Short Address.
|
||||
*/
|
||||
OTAPI otShortAddress OTCALL otLinkGetShortAddress(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Add an IEEE 802.15.4 Extended Address to the MAC whitelist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully added to the MAC whitelist.
|
||||
* @retval kThreadErrorNoBufs No buffers available for a new MAC whitelist entry.
|
||||
*
|
||||
* @sa otLinkAddWhitelistRssi
|
||||
* @sa otLinkRemoveWhitelist
|
||||
* @sa otLinkClearWhitelist
|
||||
* @sa otLinkGetWhitelistEntry
|
||||
* @sa otLinkSetWhitelistEnabled
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkAddWhitelist(otInstance *aInstance, const uint8_t *aExtAddr);
|
||||
|
||||
/**
|
||||
* Add an IEEE 802.15.4 Extended Address to the MAC whitelist and fix the RSSI value.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
* @param[in] aRssi The RSSI in dBm to use when receiving messages from aExtAddr.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully added to the MAC whitelist.
|
||||
* @retval kThreadErrorNoBufs No buffers available for a new MAC whitelist entry.
|
||||
*
|
||||
* @sa otLinkAddWhitelistRssi
|
||||
* @sa otLinkRemoveWhitelist
|
||||
* @sa otLinkClearWhitelist
|
||||
* @sa otLinkGetWhitelistEntry
|
||||
* @sa otLinkIsWhitelistEnabled
|
||||
* @sa otLinkSetWhitelistEnabled
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkAddWhitelistRssi(otInstance *aInstance, const uint8_t *aExtAddr, int8_t aRssi);
|
||||
|
||||
/**
|
||||
* Remove an IEEE 802.15.4 Extended Address from the MAC whitelist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @sa otLinkAddWhitelist
|
||||
* @sa otLinkAddWhitelistRssi
|
||||
* @sa otLinkClearWhitelist
|
||||
* @sa otLinkGetWhitelistEntry
|
||||
* @sa otLinkIsWhitelistEnabled
|
||||
* @sa otLinkSetWhitelistEnabled
|
||||
*/
|
||||
OTAPI void OTCALL otLinkRemoveWhitelist(otInstance *aInstance, const uint8_t *aExtAddr);
|
||||
|
||||
/**
|
||||
* This function gets a MAC whitelist entry.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aIndex An index into the MAC whitelist table.
|
||||
* @param[out] aEntry A pointer to where the information is placed.
|
||||
*
|
||||
* @retval kThreadError_None Successfully retrieved the MAC whitelist entry.
|
||||
* @retval kThreadError_InvalidArgs @p aIndex is out of bounds or @p aEntry is NULL.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkGetWhitelistEntry(otInstance *aInstance, uint8_t aIndex, otMacWhitelistEntry *aEntry);
|
||||
|
||||
/**
|
||||
* Remove all entries from the MAC whitelist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @sa otLinkAddWhitelist
|
||||
* @sa otLinkAddWhitelistRssi
|
||||
* @sa otLinkRemoveWhitelist
|
||||
* @sa otLinkGetWhitelistEntry
|
||||
* @sa otLinkIsWhitelistEnabled
|
||||
* @sa otLinkSetWhitelistEnabled
|
||||
*/
|
||||
OTAPI void OTCALL otLinkClearWhitelist(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Enable MAC whitelist filtering.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aEnabled TRUE to enable the whitelist, FALSE otherwise.
|
||||
*
|
||||
* @sa otLinkAddWhitelist
|
||||
* @sa otLinkAddWhitelistRssi
|
||||
* @sa otLinkRemoveWhitelist
|
||||
* @sa otLinkClearWhitelist
|
||||
* @sa otLinkGetWhitelistEntry
|
||||
* @sa otLinkIsWhitelistEnabled
|
||||
*/
|
||||
OTAPI void OTCALL otLinkSetWhitelistEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not the MAC whitelist is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns TRUE if the MAC whitelist is enabled, FALSE otherwise.
|
||||
*
|
||||
* @sa otLinkAddWhitelist
|
||||
* @sa otLinkAddWhitelistRssi
|
||||
* @sa otLinkRemoveWhitelist
|
||||
* @sa otLinkClearWhitelist
|
||||
* @sa otLinkGetWhitelistEntry
|
||||
* @sa otLinkSetWhitelistEnabled
|
||||
*/
|
||||
OTAPI bool OTCALL otLinkIsWhitelistEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Add an IEEE 802.15.4 Extended Address to the MAC blacklist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @retval kThreadErrorNone Successfully added to the MAC blacklist.
|
||||
* @retval kThreadErrorNoBufs No buffers available for a new MAC blacklist entry.
|
||||
*
|
||||
* @sa otLinkRemoveBlacklist
|
||||
* @sa otLinkClearBlacklist
|
||||
* @sa otLinkGetBlacklistEntry
|
||||
* @sa otLinkIsBlacklistEnabled
|
||||
* @sa otLinkSetBlacklistEnabled
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkAddBlacklist(otInstance *aInstance, const uint8_t *aExtAddr);
|
||||
|
||||
/**
|
||||
* Remove an IEEE 802.15.4 Extended Address from the MAC blacklist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
*
|
||||
* @sa otLinkAddBlacklist
|
||||
* @sa otLinkClearBlacklist
|
||||
* @sa otLinkGetBlacklistEntry
|
||||
* @sa otLinkIsBlacklistEnabled
|
||||
* @sa otLinkSetBlacklistEnabled
|
||||
*/
|
||||
OTAPI void OTCALL otLinkRemoveBlacklist(otInstance *aInstance, const uint8_t *aExtAddr);
|
||||
|
||||
/**
|
||||
* This function gets a MAC Blacklist entry.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aIndex An index into the MAC Blacklist table.
|
||||
* @param[out] aEntry A pointer to where the information is placed.
|
||||
*
|
||||
* @retval kThreadError_None Successfully retrieved the MAC Blacklist entry.
|
||||
* @retval kThreadError_InvalidArgs @p aIndex is out of bounds or @p aEntry is NULL.
|
||||
*
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkGetBlacklistEntry(otInstance *aInstance, uint8_t aIndex, otMacBlacklistEntry *aEntry);
|
||||
|
||||
/**
|
||||
* Remove all entries from the MAC Blacklist.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @sa otLinkAddBlacklist
|
||||
* @sa otLinkRemoveBlacklist
|
||||
* @sa otLinkGetBlacklistEntry
|
||||
* @sa otLinkIsBlacklistEnabled
|
||||
* @sa otLinkSetBlacklistEnabled
|
||||
*/
|
||||
OTAPI void OTCALL otLinkClearBlacklist(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Enable MAC Blacklist filtering.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @parma[in] aEnabled TRUE to enable the blacklist, FALSE otherwise.
|
||||
*
|
||||
* @sa otLinkAddBlacklist
|
||||
* @sa otLinkRemoveBlacklist
|
||||
* @sa otLinkClearBlacklist
|
||||
* @sa otLinkGetBlacklistEntry
|
||||
* @sa otLinkIsBlacklistEnabled
|
||||
*/
|
||||
OTAPI void OTCALL otLinkSetBlacklistEnabled(otInstance *aInstance, bool aEnabled);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not the MAC Blacklist is enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns TRUE if the MAC Blacklist is enabled, FALSE otherwise.
|
||||
*
|
||||
* @sa otLinkAddBlacklist
|
||||
* @sa otLinkRemoveBlacklist
|
||||
* @sa otLinkClearBlacklist
|
||||
* @sa otLinkGetBlacklistEntry
|
||||
* @sa otLinkSetBlacklistEnabled
|
||||
*
|
||||
*/
|
||||
OTAPI bool OTCALL otLinkIsBlacklistEnabled(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* Get the assigned link quality which is on the link to a given extended address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
* @param[in] aLinkQuality A pointer to the assigned link quality.
|
||||
*
|
||||
* @retval kThreadError_None Successfully retrieved the link quality to aLinkQuality.
|
||||
* @retval kThreadError_InvalidState No attached child matches with a given extended address.
|
||||
*
|
||||
* @sa otLinkSetAssignLinkQuality
|
||||
*/
|
||||
OTAPI ThreadError OTCALL otLinkGetAssignLinkQuality(otInstance *aInstance, const uint8_t *aExtAddr,
|
||||
uint8_t *aLinkQuality);
|
||||
|
||||
/**
|
||||
* Set the link quality which is on the link to a given extended address.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aExtAddr A pointer to the IEEE 802.15.4 Extended Address.
|
||||
* @param[in] aLinkQuality The link quality to be set on the link.
|
||||
*
|
||||
* @sa otLinkGetAssignLinkQuality
|
||||
*/
|
||||
OTAPI void OTCALL otLinkSetAssignLinkQuality(otInstance *aInstance, const uint8_t *aExtAddr, uint8_t aLinkQuality);
|
||||
|
||||
/**
|
||||
* Get the MAC layer counters.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns A pointer to the MAC layer counters.
|
||||
*/
|
||||
OTAPI const otMacCounters *OTCALL otLinkGetCounters(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function pointer is called when an IEEE 802.15.4 frame is received.
|
||||
*
|
||||
* @note This callback is called after FCS processing and @p aFrame may not contain the actual FCS that was received.
|
||||
*
|
||||
* @note This callback is called before IEEE 802.15.4 security processing and mSecurityValid in @p aFrame will
|
||||
* always be false.
|
||||
*
|
||||
* @param[in] aFrame A pointer to the received IEEE 802.15.4 frame.
|
||||
* @param[in] aContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
typedef void (*otLinkPcapCallback)(const RadioPacket *aFrame, void *aContext);
|
||||
|
||||
/**
|
||||
* This function registers a callback to provide received raw IEEE 802.15.4 frames.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPcapCallback A pointer to a function that is called when receiving an IEEE 802.15.4 link frame or
|
||||
* NULL to disable the callback.
|
||||
* @param[in] aCallbackContext A pointer to application-specific context.
|
||||
*
|
||||
*/
|
||||
void otLinkSetPcapCallback(otInstance *aInstance, otLinkPcapCallback aPcapCallback, void *aCallbackContext);
|
||||
|
||||
/**
|
||||
* This function indicates whether or not promiscuous mode is enabled at the link layer.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @retval true Promiscuous mode is enabled.
|
||||
* @retval false Promiscuous mode is not enabled.
|
||||
*
|
||||
*/
|
||||
bool otLinkIsPromiscuous(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* This function enables or disables the link layer promiscuous mode.
|
||||
*
|
||||
* @note Promiscuous mode may only be enabled when the Thread interface is disabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
* @param[in] aPromiscuous true to enable promiscuous mode, or false otherwise.
|
||||
*
|
||||
* @retval kThreadError_None Successfully enabled promiscuous mode.
|
||||
* @retval kThreadError_InvalidState Could not enable promiscuous mode because
|
||||
* the Thread interface is enabled.
|
||||
*
|
||||
*/
|
||||
ThreadError otLinkSetPromiscuous(otInstance *aInstance, bool aPromiscuous);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_LINK_H_
|
||||
+36
-36
@@ -349,7 +349,7 @@ void Interpreter::ProcessBlacklist(int argc, char *argv[])
|
||||
|
||||
if (argcur >= argc)
|
||||
{
|
||||
if (otIsMacBlacklistEnabled(mInstance))
|
||||
if (otLinkIsBlacklistEnabled(mInstance))
|
||||
{
|
||||
sServer->OutputFormat("Enabled\r\n");
|
||||
}
|
||||
@@ -360,7 +360,7 @@ void Interpreter::ProcessBlacklist(int argc, char *argv[])
|
||||
|
||||
for (uint8_t i = 0; ; i++)
|
||||
{
|
||||
if (otGetMacBlacklistEntry(mInstance, i, &entry) != kThreadError_None)
|
||||
if (otLinkGetBlacklistEntry(mInstance, i, &entry) != kThreadError_None)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -380,26 +380,26 @@ void Interpreter::ProcessBlacklist(int argc, char *argv[])
|
||||
VerifyOrExit(++argcur < argc, error = kThreadError_Parse);
|
||||
VerifyOrExit(Hex2Bin(argv[argcur], extAddr, sizeof(extAddr)) == sizeof(extAddr), error = kThreadError_Parse);
|
||||
|
||||
otAddMacBlacklist(mInstance, extAddr);
|
||||
VerifyOrExit(otAddMacBlacklist(mInstance, extAddr) == kThreadError_None, error = kThreadError_Parse);
|
||||
otLinkAddBlacklist(mInstance, extAddr);
|
||||
VerifyOrExit(otLinkAddBlacklist(mInstance, extAddr) == kThreadError_None, error = kThreadError_Parse);
|
||||
}
|
||||
else if (strcmp(argv[argcur], "clear") == 0)
|
||||
{
|
||||
otClearMacBlacklist(mInstance);
|
||||
otLinkClearBlacklist(mInstance);
|
||||
}
|
||||
else if (strcmp(argv[argcur], "disable") == 0)
|
||||
{
|
||||
otDisableMacBlacklist(mInstance);
|
||||
otLinkSetBlacklistEnabled(mInstance, false);
|
||||
}
|
||||
else if (strcmp(argv[argcur], "enable") == 0)
|
||||
{
|
||||
otEnableMacBlacklist(mInstance);
|
||||
otLinkSetBlacklistEnabled(mInstance, true);
|
||||
}
|
||||
else if (strcmp(argv[argcur], "remove") == 0)
|
||||
{
|
||||
VerifyOrExit(++argcur < argc, error = kThreadError_Parse);
|
||||
VerifyOrExit(Hex2Bin(argv[argcur], extAddr, sizeof(extAddr)) == sizeof(extAddr), error = kThreadError_Parse);
|
||||
otRemoveMacBlacklist(mInstance, extAddr);
|
||||
otLinkRemoveBlacklist(mInstance, extAddr);
|
||||
}
|
||||
|
||||
exit:
|
||||
@@ -434,12 +434,12 @@ void Interpreter::ProcessChannel(int argc, char *argv[])
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
sServer->OutputFormat("%d\r\n", otGetChannel(mInstance));
|
||||
sServer->OutputFormat("%d\r\n", otLinkGetChannel(mInstance));
|
||||
}
|
||||
else
|
||||
{
|
||||
SuccessOrExit(error = ParseLong(argv[0], value));
|
||||
otSetChannel(mInstance, static_cast<uint8_t>(value));
|
||||
otLinkSetChannel(mInstance, static_cast<uint8_t>(value));
|
||||
}
|
||||
|
||||
exit:
|
||||
@@ -620,7 +620,7 @@ void Interpreter::ProcessCounters(int argc, char *argv[])
|
||||
{
|
||||
if (strcmp(argv[0], "mac") == 0)
|
||||
{
|
||||
otMacCountersPtr counters(otGetMacCounters(mInstance));
|
||||
otMacCountersPtr counters(otLinkGetCounters(mInstance));
|
||||
sServer->OutputFormat("TxTotal: %d\r\n", counters->mTxTotal);
|
||||
sServer->OutputFormat(" TxUnicast: %d\r\n", counters->mTxUnicast);
|
||||
sServer->OutputFormat(" TxBroadcast: %d\r\n", counters->mTxBroadcast);
|
||||
@@ -746,7 +746,7 @@ void Interpreter::ProcessEui64(int argc, char *argv[])
|
||||
|
||||
VerifyOrExit(argc == 0, error = kThreadError_Parse);
|
||||
|
||||
otGetFactoryAssignedIeeeEui64(mInstance, &extAddress);
|
||||
otLinkGetFactoryAssignedIeeeEui64(mInstance, &extAddress);
|
||||
OutputBytes(extAddress.m8, OT_EXT_ADDRESS_SIZE);
|
||||
sServer->OutputFormat("\r\n");
|
||||
|
||||
@@ -761,7 +761,7 @@ void Interpreter::ProcessExtAddress(int argc, char *argv[])
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
otBufferPtr extAddress(otGetExtendedAddress(mInstance));
|
||||
otBufferPtr extAddress(otLinkGetExtendedAddress(mInstance));
|
||||
OutputBytes(extAddress, OT_EXT_ADDRESS_SIZE);
|
||||
sServer->OutputFormat("\r\n");
|
||||
}
|
||||
@@ -771,7 +771,7 @@ void Interpreter::ProcessExtAddress(int argc, char *argv[])
|
||||
|
||||
VerifyOrExit(Hex2Bin(argv[0], extAddress.m8, sizeof(otExtAddress)) >= 0, error = kThreadError_Parse);
|
||||
|
||||
otSetExtendedAddress(mInstance, &extAddress);
|
||||
otLinkSetExtendedAddress(mInstance, &extAddress);
|
||||
}
|
||||
|
||||
exit:
|
||||
@@ -824,7 +824,7 @@ void Interpreter::ProcessHashMacAddress(int argc, char *argv[])
|
||||
|
||||
VerifyOrExit(argc == 0, error = kThreadError_Parse);
|
||||
|
||||
otGetHashMacAddress(mInstance, &hashMacAddress);
|
||||
otLinkGetJoinerId(mInstance, &hashMacAddress);
|
||||
OutputBytes(hashMacAddress.m8, OT_EXT_ADDRESS_SIZE);
|
||||
sServer->OutputFormat("\r\n");
|
||||
|
||||
@@ -1138,14 +1138,14 @@ void Interpreter::ProcessLinkQuality(int argc, char *argv[])
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
VerifyOrExit(otGetAssignLinkQuality(mInstance, extAddress, &linkQuality) == kThreadError_None,
|
||||
VerifyOrExit(otLinkGetAssignLinkQuality(mInstance, extAddress, &linkQuality) == kThreadError_None,
|
||||
error = kThreadError_InvalidArgs);
|
||||
sServer->OutputFormat("%d\r\n", linkQuality);
|
||||
}
|
||||
else
|
||||
{
|
||||
SuccessOrExit(error = ParseLong(argv[1], value));
|
||||
otSetAssignLinkQuality(mInstance, extAddress, static_cast<uint8_t>(value));
|
||||
otLinkSetAssignLinkQuality(mInstance, extAddress, static_cast<uint8_t>(value));
|
||||
}
|
||||
|
||||
exit:
|
||||
@@ -1303,12 +1303,12 @@ void Interpreter::ProcessPanId(int argc, char *argv[])
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
sServer->OutputFormat("%04x\r\n", otGetPanId(mInstance));
|
||||
sServer->OutputFormat("%04x\r\n", otLinkGetPanId(mInstance));
|
||||
}
|
||||
else
|
||||
{
|
||||
SuccessOrExit(error = ParseLong(argv[0], value));
|
||||
otSetPanId(mInstance, static_cast<otPanId>(value));
|
||||
otLinkSetPanId(mInstance, static_cast<otPanId>(value));
|
||||
}
|
||||
|
||||
exit:
|
||||
@@ -1470,12 +1470,12 @@ void Interpreter::ProcessPollPeriod(int argc, char *argv[])
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
sServer->OutputFormat("%d\r\n", (otGetPollPeriod(mInstance) / 1000)); // ms->s
|
||||
sServer->OutputFormat("%d\r\n", (otLinkGetPollPeriod(mInstance) / 1000)); // ms->s
|
||||
}
|
||||
else
|
||||
{
|
||||
SuccessOrExit(error = ParseLong(argv[0], value));
|
||||
otSetPollPeriod(mInstance, static_cast<uint32_t>(value * 1000)); // s->ms
|
||||
otLinkSetPollPeriod(mInstance, static_cast<uint32_t>(value * 1000)); // s->ms
|
||||
}
|
||||
|
||||
exit:
|
||||
@@ -1489,7 +1489,7 @@ void Interpreter::ProcessPromiscuous(int argc, char *argv[])
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
if (otIsLinkPromiscuous(mInstance) && otPlatRadioGetPromiscuous(mInstance))
|
||||
if (otLinkIsPromiscuous(mInstance) && otPlatRadioGetPromiscuous(mInstance))
|
||||
{
|
||||
sServer->OutputFormat("Enabled\r\n");
|
||||
}
|
||||
@@ -1502,13 +1502,13 @@ void Interpreter::ProcessPromiscuous(int argc, char *argv[])
|
||||
{
|
||||
if (strcmp(argv[0], "enable") == 0)
|
||||
{
|
||||
otSetLinkPcapCallback(mInstance, &s_HandleLinkPcapReceive, this);
|
||||
SuccessOrExit(error = otSetLinkPromiscuous(mInstance, true));
|
||||
otLinkSetPcapCallback(mInstance, &s_HandleLinkPcapReceive, this);
|
||||
SuccessOrExit(error = otLinkSetPromiscuous(mInstance, true));
|
||||
}
|
||||
else if (strcmp(argv[0], "disable") == 0)
|
||||
{
|
||||
otSetLinkPcapCallback(mInstance, NULL, NULL);
|
||||
SuccessOrExit(error = otSetLinkPromiscuous(mInstance, false));
|
||||
otLinkSetPcapCallback(mInstance, NULL, NULL);
|
||||
SuccessOrExit(error = otLinkSetPromiscuous(mInstance, false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2142,7 +2142,7 @@ void Interpreter::ProcessScan(int argc, char *argv[])
|
||||
|
||||
sServer->OutputFormat("| J | Network Name | Extended PAN | PAN | MAC Address | Ch | dBm | LQI |\r\n");
|
||||
sServer->OutputFormat("+---+------------------+------------------+------+------------------+----+-----+-----+\r\n");
|
||||
SuccessOrExit(error = otActiveScan(mInstance, scanChannels, 0, &Interpreter::s_HandleActiveScanResult, this));
|
||||
SuccessOrExit(error = otLinkActiveScan(mInstance, scanChannels, 0, &Interpreter::s_HandleActiveScanResult, this));
|
||||
|
||||
return;
|
||||
|
||||
@@ -2645,7 +2645,7 @@ void Interpreter::ProcessWhitelist(int argc, char *argv[])
|
||||
|
||||
if (argcur >= argc)
|
||||
{
|
||||
if (otIsMacWhitelistEnabled(mInstance))
|
||||
if (otLinkIsWhitelistEnabled(mInstance))
|
||||
{
|
||||
sServer->OutputFormat("Enabled\r\n");
|
||||
}
|
||||
@@ -2656,7 +2656,7 @@ void Interpreter::ProcessWhitelist(int argc, char *argv[])
|
||||
|
||||
for (uint8_t i = 0; ; i++)
|
||||
{
|
||||
if (otGetMacWhitelistEntry(mInstance, i, &entry) != kThreadError_None)
|
||||
if (otLinkGetWhitelistEntry(mInstance, i, &entry) != kThreadError_None)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -2684,31 +2684,31 @@ void Interpreter::ProcessWhitelist(int argc, char *argv[])
|
||||
if (++argcur < argc)
|
||||
{
|
||||
rssi = static_cast<int8_t>(strtol(argv[argcur], NULL, 0));
|
||||
VerifyOrExit(otAddMacWhitelistRssi(mInstance, extAddr, rssi) == kThreadError_None, error = kThreadError_Parse);
|
||||
VerifyOrExit(otLinkAddWhitelistRssi(mInstance, extAddr, rssi) == kThreadError_None, error = kThreadError_Parse);
|
||||
}
|
||||
else
|
||||
{
|
||||
otAddMacWhitelist(mInstance, extAddr);
|
||||
VerifyOrExit(otAddMacWhitelist(mInstance, extAddr) == kThreadError_None, error = kThreadError_Parse);
|
||||
otLinkAddWhitelist(mInstance, extAddr);
|
||||
VerifyOrExit(otLinkAddWhitelist(mInstance, extAddr) == kThreadError_None, error = kThreadError_Parse);
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[argcur], "clear") == 0)
|
||||
{
|
||||
otClearMacWhitelist(mInstance);
|
||||
otLinkClearWhitelist(mInstance);
|
||||
}
|
||||
else if (strcmp(argv[argcur], "disable") == 0)
|
||||
{
|
||||
otDisableMacWhitelist(mInstance);
|
||||
otLinkSetWhitelistEnabled(mInstance, false);
|
||||
}
|
||||
else if (strcmp(argv[argcur], "enable") == 0)
|
||||
{
|
||||
otEnableMacWhitelist(mInstance);
|
||||
otLinkSetWhitelistEnabled(mInstance, true);
|
||||
}
|
||||
else if (strcmp(argv[argcur], "remove") == 0)
|
||||
{
|
||||
VerifyOrExit(++argcur < argc, error = kThreadError_Parse);
|
||||
VerifyOrExit(Hex2Bin(argv[argcur], extAddr, sizeof(extAddr)) == sizeof(extAddr), error = kThreadError_Parse);
|
||||
otRemoveMacWhitelist(mInstance, extAddr);
|
||||
otLinkRemoveWhitelist(mInstance, extAddr);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
@@ -42,6 +42,7 @@ SOURCES_COMMON = \
|
||||
openthread.cpp \
|
||||
api/crypto_api.cpp \
|
||||
api/ip6_api.cpp \
|
||||
api/link_api.cpp \
|
||||
api/message_api.cpp \
|
||||
api/tasklet_api.cpp \
|
||||
api/udp_api.cpp \
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 OpenThread Link API.
|
||||
*/
|
||||
|
||||
#include "openthread/link.h"
|
||||
|
||||
#include "openthread-instance.h"
|
||||
|
||||
using namespace Thread;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static void HandleActiveScanResult(void *aContext, Mac::Frame *aFrame);
|
||||
static void HandleEnergyScanResult(void *aContext, otEnergyScanResult *aResult);
|
||||
|
||||
uint8_t otLinkGetChannel(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetChannel();
|
||||
}
|
||||
|
||||
ThreadError otLinkSetChannel(otInstance *aInstance, uint8_t aChannel)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().SetChannel(aChannel);
|
||||
}
|
||||
|
||||
const uint8_t *otLinkGetExtendedAddress(otInstance *aInstance)
|
||||
{
|
||||
return reinterpret_cast<const uint8_t *>(aInstance->mThreadNetif.GetMac().GetExtAddress());
|
||||
}
|
||||
|
||||
ThreadError otLinkSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtAddress)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aExtAddress != NULL, error = kThreadError_InvalidArgs);
|
||||
|
||||
aInstance->mThreadNetif.GetMac().SetExtAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
|
||||
|
||||
SuccessOrExit(error = aInstance->mThreadNetif.GetMle().UpdateLinkLocalAddress());
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void otLinkGetFactoryAssignedIeeeEui64(otInstance *aInstance, otExtAddress *aEui64)
|
||||
{
|
||||
otPlatRadioGetIeeeEui64(aInstance, aEui64->m8);
|
||||
}
|
||||
|
||||
void otLinkGetJoinerId(otInstance *aInstance, otExtAddress *aHashMacAddress)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetHashMacAddress(static_cast<Mac::ExtAddress *>(aHashMacAddress));
|
||||
}
|
||||
|
||||
int8_t otLinkGetMaxTransmitPower(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetMaxTransmitPower();
|
||||
}
|
||||
|
||||
void otLinkSetMaxTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().SetMaxTransmitPower(aPower);
|
||||
}
|
||||
|
||||
otPanId otLinkGetPanId(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetPanId();
|
||||
}
|
||||
|
||||
ThreadError otLinkSetPanId(otInstance *aInstance, otPanId aPanId)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
// do not allow setting PAN ID to broadcast if Thread is running
|
||||
VerifyOrExit(aPanId != Mac::kPanIdBroadcast ||
|
||||
aInstance->mThreadNetif.GetMle().GetDeviceState() != Mle::kDeviceStateDisabled,
|
||||
error = kThreadError_InvalidState);
|
||||
|
||||
error = aInstance->mThreadNetif.GetMac().SetPanId(aPanId);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
uint32_t otLinkGetPollPeriod(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMeshForwarder().GetAssignPollPeriod();
|
||||
}
|
||||
|
||||
void otLinkSetPollPeriod(otInstance *aInstance, uint32_t aPollPeriod)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMeshForwarder().SetAssignPollPeriod(aPollPeriod);
|
||||
}
|
||||
|
||||
otShortAddress otLinkGetShortAddress(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetShortAddress();
|
||||
}
|
||||
|
||||
ThreadError otLinkAddWhitelist(otInstance *aInstance, const uint8_t *aExtAddr)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
if (aInstance->mThreadNetif.GetMac().GetWhitelist().Add(*reinterpret_cast<const Mac::ExtAddress *>(aExtAddr)) == NULL)
|
||||
{
|
||||
error = kThreadError_NoBufs;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
ThreadError otLinkAddWhitelistRssi(otInstance *aInstance, const uint8_t *aExtAddr, int8_t aRssi)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
otMacWhitelistEntry *entry;
|
||||
|
||||
entry = aInstance->mThreadNetif.GetMac().GetWhitelist().Add(*reinterpret_cast<const Mac::ExtAddress *>(aExtAddr));
|
||||
VerifyOrExit(entry != NULL, error = kThreadError_NoBufs);
|
||||
aInstance->mThreadNetif.GetMac().GetWhitelist().SetFixedRssi(*entry, aRssi);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void otLinkRemoveWhitelist(otInstance *aInstance, const uint8_t *aExtAddr)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetWhitelist().Remove(*reinterpret_cast<const Mac::ExtAddress *>(aExtAddr));
|
||||
}
|
||||
|
||||
void otLinkClearWhitelist(otInstance *aInstance)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetWhitelist().Clear();
|
||||
}
|
||||
|
||||
ThreadError otLinkGetWhitelistEntry(otInstance *aInstance, uint8_t aIndex, otMacWhitelistEntry *aEntry)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aEntry != NULL, error = kThreadError_InvalidArgs);
|
||||
error = aInstance->mThreadNetif.GetMac().GetWhitelist().GetEntry(aIndex, *aEntry);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void otLinkSetWhitelistEnabled(otInstance *aInstance, bool aEnabled)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetWhitelist().SetEnabled(aEnabled);
|
||||
}
|
||||
|
||||
bool otLinkIsWhitelistEnabled(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetWhitelist().IsEnabled();
|
||||
}
|
||||
|
||||
ThreadError otLinkAddBlacklist(otInstance *aInstance, const uint8_t *aExtAddr)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
if (aInstance->mThreadNetif.GetMac().GetBlacklist().Add(*reinterpret_cast<const Mac::ExtAddress *>(aExtAddr)) == NULL)
|
||||
{
|
||||
error = kThreadError_NoBufs;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void otLinkRemoveBlacklist(otInstance *aInstance, const uint8_t *aExtAddr)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetBlacklist().Remove(*reinterpret_cast<const Mac::ExtAddress *>(aExtAddr));
|
||||
}
|
||||
|
||||
void otLinkClearBlacklist(otInstance *aInstance)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetBlacklist().Clear();
|
||||
}
|
||||
|
||||
ThreadError otLinkGetBlacklistEntry(otInstance *aInstance, uint8_t aIndex, otMacBlacklistEntry *aEntry)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aEntry != NULL, error = kThreadError_InvalidArgs);
|
||||
error = aInstance->mThreadNetif.GetMac().GetBlacklist().GetEntry(aIndex, *aEntry);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void otLinkSetBlacklistEnabled(otInstance *aInstance, bool aEnabled)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetBlacklist().SetEnabled(aEnabled);
|
||||
}
|
||||
|
||||
bool otLinkIsBlacklistEnabled(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetBlacklist().IsEnabled();
|
||||
}
|
||||
|
||||
ThreadError otLinkGetAssignLinkQuality(otInstance *aInstance, const uint8_t *aExtAddr, uint8_t *aLinkQuality)
|
||||
{
|
||||
Mac::ExtAddress extAddress;
|
||||
|
||||
memset(&extAddress, 0, sizeof(extAddress));
|
||||
memcpy(extAddress.m8, aExtAddr, OT_EXT_ADDRESS_SIZE);
|
||||
|
||||
return aInstance->mThreadNetif.GetMle().GetAssignLinkQuality(extAddress, *aLinkQuality);
|
||||
}
|
||||
|
||||
void otLinkSetAssignLinkQuality(otInstance *aInstance, const uint8_t *aExtAddr, uint8_t aLinkQuality)
|
||||
{
|
||||
Mac::ExtAddress extAddress;
|
||||
|
||||
memset(&extAddress, 0, sizeof(extAddress));
|
||||
memcpy(extAddress.m8, aExtAddr, OT_EXT_ADDRESS_SIZE);
|
||||
|
||||
aInstance->mThreadNetif.GetMle().SetAssignLinkQuality(extAddress, aLinkQuality);
|
||||
}
|
||||
|
||||
void otLinkSetPcapCallback(otInstance *aInstance, otLinkPcapCallback aPcapCallback, void *aCallbackContext)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().SetPcapCallback(aPcapCallback, aCallbackContext);
|
||||
}
|
||||
|
||||
bool otLinkIsPromiscuous(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().IsPromiscuous();
|
||||
}
|
||||
|
||||
ThreadError otLinkSetPromiscuous(otInstance *aInstance, bool aPromiscuous)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
// cannot enable IEEE 802.15.4 promiscuous mode if the Thread interface is enabled
|
||||
VerifyOrExit(aInstance->mThreadNetif.IsUp() == false, error = kThreadError_InvalidState);
|
||||
|
||||
aInstance->mThreadNetif.GetMac().SetPromiscuous(aPromiscuous);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
const otMacCounters *otLinkGetCounters(otInstance *aInstance)
|
||||
{
|
||||
return &aInstance->mThreadNetif.GetMac().GetCounters();
|
||||
}
|
||||
|
||||
ThreadError otLinkActiveScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration,
|
||||
otHandleActiveScanResult aCallback, void *aCallbackContext)
|
||||
{
|
||||
aInstance->mActiveScanCallback = aCallback;
|
||||
aInstance->mActiveScanCallbackContext = aCallbackContext;
|
||||
return aInstance->mThreadNetif.GetMac().ActiveScan(aScanChannels, aScanDuration, &HandleActiveScanResult, aInstance);
|
||||
}
|
||||
|
||||
bool otLinkIsActiveScanInProgress(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().IsActiveScanInProgress();
|
||||
}
|
||||
|
||||
void HandleActiveScanResult(void *aContext, Mac::Frame *aFrame)
|
||||
{
|
||||
otInstance *aInstance = static_cast<otInstance *>(aContext);
|
||||
otActiveScanResult result;
|
||||
Mac::Address address;
|
||||
Mac::Beacon *beacon;
|
||||
uint8_t payloadLength;
|
||||
|
||||
memset(&result, 0, sizeof(otActiveScanResult));
|
||||
|
||||
if (aFrame == NULL)
|
||||
{
|
||||
aInstance->mActiveScanCallback(NULL, aInstance->mActiveScanCallbackContext);
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
SuccessOrExit(aFrame->GetSrcAddr(address));
|
||||
VerifyOrExit(address.mLength == sizeof(address.mExtAddress), ;);
|
||||
memcpy(&result.mExtAddress, &address.mExtAddress, sizeof(result.mExtAddress));
|
||||
|
||||
aFrame->GetSrcPanId(result.mPanId);
|
||||
result.mChannel = aFrame->GetChannel();
|
||||
result.mRssi = aFrame->GetPower();
|
||||
result.mLqi = aFrame->GetLqi();
|
||||
|
||||
payloadLength = aFrame->GetPayloadLength();
|
||||
beacon = reinterpret_cast<Mac::Beacon *>(aFrame->GetPayload());
|
||||
|
||||
if (payloadLength >= sizeof(*beacon) && beacon->IsValid())
|
||||
{
|
||||
result.mVersion = beacon->GetProtocolVersion();
|
||||
result.mIsJoinable = beacon->IsJoiningPermitted();
|
||||
result.mIsNative = beacon->IsNative();
|
||||
memcpy(&result.mNetworkName, beacon->GetNetworkName(), sizeof(result.mNetworkName));
|
||||
memcpy(&result.mExtendedPanId, beacon->GetExtendedPanId(), sizeof(result.mExtendedPanId));
|
||||
}
|
||||
|
||||
aInstance->mActiveScanCallback(&result, aInstance->mActiveScanCallbackContext);
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadError otLinkEnergyScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration,
|
||||
otHandleEnergyScanResult aCallback, void *aCallbackContext)
|
||||
{
|
||||
aInstance->mEnergyScanCallback = aCallback;
|
||||
aInstance->mEnergyScanCallbackContext = aCallbackContext;
|
||||
return aInstance->mThreadNetif.GetMac().EnergyScan(aScanChannels, aScanDuration, &HandleEnergyScanResult, aInstance);
|
||||
}
|
||||
|
||||
void HandleEnergyScanResult(void *aContext, otEnergyScanResult *aResult)
|
||||
{
|
||||
otInstance *aInstance = static_cast<otInstance *>(aContext);
|
||||
|
||||
aInstance->mEnergyScanCallback(aResult, aInstance->mEnergyScanCallbackContext);
|
||||
}
|
||||
|
||||
bool otLinkIsEnergyScanInProgress(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().IsEnergyScanInProgress();
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
@@ -49,21 +49,16 @@ Blacklist::Blacklist(void)
|
||||
}
|
||||
}
|
||||
|
||||
void Blacklist::Enable(void)
|
||||
{
|
||||
mEnabled = true;
|
||||
}
|
||||
|
||||
void Blacklist::Disable(void)
|
||||
{
|
||||
mEnabled = false;
|
||||
}
|
||||
|
||||
bool Blacklist::IsEnabled(void) const
|
||||
{
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
void Blacklist::SetEnabled(bool aEnabled)
|
||||
{
|
||||
mEnabled = aEnabled;
|
||||
}
|
||||
|
||||
int Blacklist::GetMaxEntries(void) const
|
||||
{
|
||||
return kMaxEntries;
|
||||
|
||||
@@ -69,18 +69,6 @@ public:
|
||||
*/
|
||||
Blacklist(void);
|
||||
|
||||
/**
|
||||
* This method enables the blacklist filter.
|
||||
*
|
||||
*/
|
||||
void Enable(void);
|
||||
|
||||
/**
|
||||
* This method disables the blacklist filter.
|
||||
*
|
||||
*/
|
||||
void Disable(void);
|
||||
|
||||
/**
|
||||
* This method indicates whether or not the blacklist filter is enabled.
|
||||
*
|
||||
@@ -90,6 +78,14 @@ public:
|
||||
*/
|
||||
bool IsEnabled(void) const;
|
||||
|
||||
/**
|
||||
* This method enables the blacklist filter.
|
||||
*
|
||||
* @param[in] aEnabled TRUE to enable the blacklist filter, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
void SetEnabled(bool aEnabled);
|
||||
|
||||
/**
|
||||
* This method returns the maximum number of blacklist entries.
|
||||
*
|
||||
|
||||
@@ -49,21 +49,16 @@ Whitelist::Whitelist(void)
|
||||
}
|
||||
}
|
||||
|
||||
void Whitelist::Enable(void)
|
||||
{
|
||||
mEnabled = true;
|
||||
}
|
||||
|
||||
void Whitelist::Disable(void)
|
||||
{
|
||||
mEnabled = false;
|
||||
}
|
||||
|
||||
bool Whitelist::IsEnabled(void) const
|
||||
{
|
||||
return mEnabled;
|
||||
}
|
||||
|
||||
void Whitelist::SetEnabled(bool aEnabled)
|
||||
{
|
||||
mEnabled = aEnabled;
|
||||
}
|
||||
|
||||
int Whitelist::GetMaxEntries(void) const
|
||||
{
|
||||
return kMaxEntries;
|
||||
|
||||
@@ -69,18 +69,6 @@ public:
|
||||
*/
|
||||
Whitelist(void);
|
||||
|
||||
/**
|
||||
* This method enables the whitelist filter.
|
||||
*
|
||||
*/
|
||||
void Enable(void);
|
||||
|
||||
/**
|
||||
* This method disables the whitelist filter.
|
||||
*
|
||||
*/
|
||||
void Disable(void);
|
||||
|
||||
/**
|
||||
* This method indicates whether or not the whitelist filter is enabled.
|
||||
*
|
||||
@@ -90,6 +78,14 @@ public:
|
||||
*/
|
||||
bool IsEnabled(void) const;
|
||||
|
||||
/**
|
||||
* This method enables the whitelist filter.
|
||||
*
|
||||
* @param[in] aEnabled TRUE to enable the whitelist filter, FALSE otherwise.
|
||||
*
|
||||
*/
|
||||
void SetEnabled(bool aEnabled);
|
||||
|
||||
/**
|
||||
* This method returns the maximum number of whitelist entries.
|
||||
*
|
||||
|
||||
@@ -88,19 +88,6 @@ otInstance::otInstance(void) :
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
static void HandleActiveScanResult(void *aContext, Mac::Frame *aFrame);
|
||||
static void HandleEnergyScanResult(void *aContext, otEnergyScanResult *aResult);
|
||||
|
||||
uint8_t otGetChannel(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetChannel();
|
||||
}
|
||||
|
||||
ThreadError otSetChannel(otInstance *aInstance, uint8_t aChannel)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().SetChannel(aChannel);
|
||||
}
|
||||
|
||||
ThreadError otSetDelayTimerMinimal(otInstance *aInstance, uint32_t aDelayTimerMinimal)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetLeader().SetDelayTimerMinimal(aDelayTimerMinimal);
|
||||
@@ -135,25 +122,6 @@ void otSetChildTimeout(otInstance *aInstance, uint32_t aTimeout)
|
||||
aInstance->mThreadNetif.GetMle().SetTimeout(aTimeout);
|
||||
}
|
||||
|
||||
const uint8_t *otGetExtendedAddress(otInstance *aInstance)
|
||||
{
|
||||
return reinterpret_cast<const uint8_t *>(aInstance->mThreadNetif.GetMac().GetExtAddress());
|
||||
}
|
||||
|
||||
ThreadError otSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtAddress)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aExtAddress != NULL, error = kThreadError_InvalidArgs);
|
||||
|
||||
aInstance->mThreadNetif.GetMac().SetExtAddress(*static_cast<const Mac::ExtAddress *>(aExtAddress));
|
||||
|
||||
SuccessOrExit(error = aInstance->mThreadNetif.GetMle().UpdateLinkLocalAddress());
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
const uint8_t *otGetExtendedPanId(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetExtendedPanId();
|
||||
@@ -172,16 +140,6 @@ void otSetExtendedPanId(otInstance *aInstance, const uint8_t *aExtendedPanId)
|
||||
aInstance->mThreadNetif.GetMle().SetMeshLocalPrefix(mlPrefix);
|
||||
}
|
||||
|
||||
void otGetFactoryAssignedIeeeEui64(otInstance *aInstance, otExtAddress *aEui64)
|
||||
{
|
||||
otPlatRadioGetIeeeEui64(aInstance, aEui64->m8);
|
||||
}
|
||||
|
||||
void otGetHashMacAddress(otInstance *aInstance, otExtAddress *aHashMacAddress)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetHashMacAddress(static_cast<Mac::ExtAddress *>(aHashMacAddress));
|
||||
}
|
||||
|
||||
ThreadError otGetLeaderRloc(otInstance *aInstance, otIp6Address *aAddress)
|
||||
{
|
||||
ThreadError error;
|
||||
@@ -261,16 +219,6 @@ ThreadError otSetMasterKey(otInstance *aInstance, const uint8_t *aKey, uint8_t a
|
||||
return aInstance->mThreadNetif.GetKeyManager().SetMasterKey(aKey, aKeyLength);
|
||||
}
|
||||
|
||||
int8_t otGetMaxTransmitPower(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetMaxTransmitPower();
|
||||
}
|
||||
|
||||
void otSetMaxTransmitPower(otInstance *aInstance, int8_t aPower)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().SetMaxTransmitPower(aPower);
|
||||
}
|
||||
|
||||
const otIp6Address *otGetMeshLocalEid(otInstance *aInstance)
|
||||
{
|
||||
return &aInstance->mThreadNetif.GetMle().GetMeshLocal64();
|
||||
@@ -320,26 +268,6 @@ ThreadError otSetNetworkName(otInstance *aInstance, const char *aNetworkName)
|
||||
return aInstance->mThreadNetif.GetMac().SetNetworkName(aNetworkName);
|
||||
}
|
||||
|
||||
otPanId otGetPanId(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetPanId();
|
||||
}
|
||||
|
||||
ThreadError otSetPanId(otInstance *aInstance, otPanId aPanId)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
// do not allow setting PAN ID to broadcast if Thread is running
|
||||
VerifyOrExit(aPanId != Mac::kPanIdBroadcast ||
|
||||
aInstance->mThreadNetif.GetMle().GetDeviceState() != Mle::kDeviceStateDisabled,
|
||||
error = kThreadError_InvalidState);
|
||||
|
||||
error = aInstance->mThreadNetif.GetMac().SetPanId(aPanId);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
bool otIsRouterRoleEnabled(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().IsRouterRoleEnabled();
|
||||
@@ -350,11 +278,6 @@ void otSetRouterRoleEnabled(otInstance *aInstance, bool aEnabled)
|
||||
aInstance->mThreadNetif.GetMle().SetRouterRoleEnabled(aEnabled);
|
||||
}
|
||||
|
||||
otShortAddress otGetShortAddress(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetShortAddress();
|
||||
}
|
||||
|
||||
uint8_t otGetLocalLeaderWeight(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().GetLeaderWeight();
|
||||
@@ -522,67 +445,6 @@ ThreadError otReleaseRouterId(otInstance *aInstance, uint8_t aRouterId)
|
||||
return aInstance->mThreadNetif.GetMle().ReleaseRouterId(aRouterId);
|
||||
}
|
||||
|
||||
ThreadError otAddMacWhitelist(otInstance *aInstance, const uint8_t *aExtAddr)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
if (aInstance->mThreadNetif.GetMac().GetWhitelist().Add(*reinterpret_cast<const Mac::ExtAddress *>(aExtAddr)) == NULL)
|
||||
{
|
||||
error = kThreadError_NoBufs;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
ThreadError otAddMacWhitelistRssi(otInstance *aInstance, const uint8_t *aExtAddr, int8_t aRssi)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
otMacWhitelistEntry *entry;
|
||||
|
||||
entry = aInstance->mThreadNetif.GetMac().GetWhitelist().Add(*reinterpret_cast<const Mac::ExtAddress *>(aExtAddr));
|
||||
VerifyOrExit(entry != NULL, error = kThreadError_NoBufs);
|
||||
aInstance->mThreadNetif.GetMac().GetWhitelist().SetFixedRssi(*entry, aRssi);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void otRemoveMacWhitelist(otInstance *aInstance, const uint8_t *aExtAddr)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetWhitelist().Remove(*reinterpret_cast<const Mac::ExtAddress *>(aExtAddr));
|
||||
}
|
||||
|
||||
void otClearMacWhitelist(otInstance *aInstance)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetWhitelist().Clear();
|
||||
}
|
||||
|
||||
ThreadError otGetMacWhitelistEntry(otInstance *aInstance, uint8_t aIndex, otMacWhitelistEntry *aEntry)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aEntry != NULL, error = kThreadError_InvalidArgs);
|
||||
error = aInstance->mThreadNetif.GetMac().GetWhitelist().GetEntry(aIndex, *aEntry);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void otDisableMacWhitelist(otInstance *aInstance)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetWhitelist().Disable();
|
||||
}
|
||||
|
||||
void otEnableMacWhitelist(otInstance *aInstance)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetWhitelist().Enable();
|
||||
}
|
||||
|
||||
bool otIsMacWhitelistEnabled(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetWhitelist().IsEnabled();
|
||||
}
|
||||
|
||||
ThreadError otBecomeDetached(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().BecomeDetached();
|
||||
@@ -621,74 +483,6 @@ ThreadError otBecomeLeader(otInstance *aInstance)
|
||||
return aInstance->mThreadNetif.GetMle().BecomeLeader();
|
||||
}
|
||||
|
||||
ThreadError otAddMacBlacklist(otInstance *aInstance, const uint8_t *aExtAddr)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
if (aInstance->mThreadNetif.GetMac().GetBlacklist().Add(*reinterpret_cast<const Mac::ExtAddress *>(aExtAddr)) == NULL)
|
||||
{
|
||||
error = kThreadError_NoBufs;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void otRemoveMacBlacklist(otInstance *aInstance, const uint8_t *aExtAddr)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetBlacklist().Remove(*reinterpret_cast<const Mac::ExtAddress *>(aExtAddr));
|
||||
}
|
||||
|
||||
void otClearMacBlacklist(otInstance *aInstance)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetBlacklist().Clear();
|
||||
}
|
||||
|
||||
ThreadError otGetMacBlacklistEntry(otInstance *aInstance, uint8_t aIndex, otMacBlacklistEntry *aEntry)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aEntry != NULL, error = kThreadError_InvalidArgs);
|
||||
error = aInstance->mThreadNetif.GetMac().GetBlacklist().GetEntry(aIndex, *aEntry);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
void otDisableMacBlacklist(otInstance *aInstance)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetBlacklist().Disable();
|
||||
}
|
||||
|
||||
void otEnableMacBlacklist(otInstance *aInstance)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().GetBlacklist().Enable();
|
||||
}
|
||||
|
||||
bool otIsMacBlacklistEnabled(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().GetBlacklist().IsEnabled();
|
||||
}
|
||||
|
||||
ThreadError otGetAssignLinkQuality(otInstance *aInstance, const uint8_t *aExtAddr, uint8_t *aLinkQuality)
|
||||
{
|
||||
Mac::ExtAddress extAddress;
|
||||
|
||||
memset(&extAddress, 0, sizeof(extAddress));
|
||||
memcpy(extAddress.m8, aExtAddr, OT_EXT_ADDRESS_SIZE);
|
||||
|
||||
return aInstance->mThreadNetif.GetMle().GetAssignLinkQuality(extAddress, *aLinkQuality);
|
||||
}
|
||||
|
||||
void otSetAssignLinkQuality(otInstance *aInstance, const uint8_t *aExtAddr, uint8_t aLinkQuality)
|
||||
{
|
||||
Mac::ExtAddress extAddress;
|
||||
|
||||
memset(&extAddress, 0, sizeof(extAddress));
|
||||
memcpy(extAddress.m8, aExtAddr, OT_EXT_ADDRESS_SIZE);
|
||||
|
||||
aInstance->mThreadNetif.GetMle().SetAssignLinkQuality(extAddress, aLinkQuality);
|
||||
}
|
||||
|
||||
void otPlatformReset(otInstance *aInstance)
|
||||
{
|
||||
otPlatReset(aInstance);
|
||||
@@ -907,34 +701,6 @@ uint8_t otGetStableNetworkDataVersion(otInstance *aInstance)
|
||||
return aInstance->mThreadNetif.GetMle().GetLeaderDataTlv().GetStableDataVersion();
|
||||
}
|
||||
|
||||
void otSetLinkPcapCallback(otInstance *aInstance, otLinkPcapCallback aPcapCallback, void *aCallbackContext)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMac().SetPcapCallback(aPcapCallback, aCallbackContext);
|
||||
}
|
||||
|
||||
bool otIsLinkPromiscuous(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().IsPromiscuous();
|
||||
}
|
||||
|
||||
ThreadError otSetLinkPromiscuous(otInstance *aInstance, bool aPromiscuous)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
// cannot enable IEEE 802.15.4 promiscuous mode if the Thread interface is enabled
|
||||
VerifyOrExit(aInstance->mThreadNetif.IsUp() == false, error = kThreadError_InvalidState);
|
||||
|
||||
aInstance->mThreadNetif.GetMac().SetPromiscuous(aPromiscuous);
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
const otMacCounters *otGetMacCounters(otInstance *aInstance)
|
||||
{
|
||||
return &aInstance->mThreadNetif.GetMac().GetCounters();
|
||||
}
|
||||
|
||||
ThreadError otSetStateChangedCallback(otInstance *aInstance, otStateChangedCallback aCallback, void *aCallbackContext)
|
||||
{
|
||||
ThreadError error = kThreadError_NoBufs;
|
||||
@@ -1004,16 +770,6 @@ const char *otGetVersionString(void)
|
||||
return sVersion;
|
||||
}
|
||||
|
||||
uint32_t otGetPollPeriod(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMeshForwarder().GetAssignPollPeriod();
|
||||
}
|
||||
|
||||
void otSetPollPeriod(otInstance *aInstance, uint32_t aPollPeriod)
|
||||
{
|
||||
aInstance->mThreadNetif.GetMeshForwarder().SetAssignPollPeriod(aPollPeriod);
|
||||
}
|
||||
|
||||
ThreadError otSetPreferredRouterId(otInstance *aInstance, uint8_t aRouterId)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMle().SetPreferredRouterId(aRouterId);
|
||||
@@ -1197,82 +953,6 @@ bool otIsSingleton(otInstance *aInstance)
|
||||
return aInstance->mThreadNetif.GetMle().IsSingleton();
|
||||
}
|
||||
|
||||
ThreadError otActiveScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration,
|
||||
otHandleActiveScanResult aCallback, void *aCallbackContext)
|
||||
{
|
||||
aInstance->mActiveScanCallback = aCallback;
|
||||
aInstance->mActiveScanCallbackContext = aCallbackContext;
|
||||
return aInstance->mThreadNetif.GetMac().ActiveScan(aScanChannels, aScanDuration, &HandleActiveScanResult, aInstance);
|
||||
}
|
||||
|
||||
bool otIsActiveScanInProgress(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().IsActiveScanInProgress();
|
||||
}
|
||||
|
||||
void HandleActiveScanResult(void *aContext, Mac::Frame *aFrame)
|
||||
{
|
||||
otInstance *aInstance = static_cast<otInstance *>(aContext);
|
||||
otActiveScanResult result;
|
||||
Mac::Address address;
|
||||
Mac::Beacon *beacon;
|
||||
uint8_t payloadLength;
|
||||
|
||||
memset(&result, 0, sizeof(otActiveScanResult));
|
||||
|
||||
if (aFrame == NULL)
|
||||
{
|
||||
aInstance->mActiveScanCallback(NULL, aInstance->mActiveScanCallbackContext);
|
||||
ExitNow();
|
||||
}
|
||||
|
||||
SuccessOrExit(aFrame->GetSrcAddr(address));
|
||||
VerifyOrExit(address.mLength == sizeof(address.mExtAddress), ;);
|
||||
memcpy(&result.mExtAddress, &address.mExtAddress, sizeof(result.mExtAddress));
|
||||
|
||||
aFrame->GetSrcPanId(result.mPanId);
|
||||
result.mChannel = aFrame->GetChannel();
|
||||
result.mRssi = aFrame->GetPower();
|
||||
result.mLqi = aFrame->GetLqi();
|
||||
|
||||
payloadLength = aFrame->GetPayloadLength();
|
||||
beacon = reinterpret_cast<Mac::Beacon *>(aFrame->GetPayload());
|
||||
|
||||
if (payloadLength >= sizeof(*beacon) && beacon->IsValid())
|
||||
{
|
||||
result.mVersion = beacon->GetProtocolVersion();
|
||||
result.mIsJoinable = beacon->IsJoiningPermitted();
|
||||
result.mIsNative = beacon->IsNative();
|
||||
memcpy(&result.mNetworkName, beacon->GetNetworkName(), sizeof(result.mNetworkName));
|
||||
memcpy(&result.mExtendedPanId, beacon->GetExtendedPanId(), sizeof(result.mExtendedPanId));
|
||||
}
|
||||
|
||||
aInstance->mActiveScanCallback(&result, aInstance->mActiveScanCallbackContext);
|
||||
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
ThreadError otEnergyScan(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration,
|
||||
otHandleEnergyScanResult aCallback, void *aCallbackContext)
|
||||
{
|
||||
aInstance->mEnergyScanCallback = aCallback;
|
||||
aInstance->mEnergyScanCallbackContext = aCallbackContext;
|
||||
return aInstance->mThreadNetif.GetMac().EnergyScan(aScanChannels, aScanDuration, &HandleEnergyScanResult, aInstance);
|
||||
}
|
||||
|
||||
void HandleEnergyScanResult(void *aContext, otEnergyScanResult *aResult)
|
||||
{
|
||||
otInstance *aInstance = static_cast<otInstance *>(aContext);
|
||||
|
||||
aInstance->mEnergyScanCallback(aResult, aInstance->mEnergyScanCallbackContext);
|
||||
}
|
||||
|
||||
bool otIsEnergyScanInProgress(otInstance *aInstance)
|
||||
{
|
||||
return aInstance->mThreadNetif.GetMac().IsEnergyScanInProgress();
|
||||
}
|
||||
|
||||
ThreadError otDiscover(otInstance *aInstance, uint32_t aScanChannels, uint16_t aScanDuration, uint16_t aPanId,
|
||||
otHandleActiveScanResult aCallback, void *aCallbackContext)
|
||||
{
|
||||
|
||||
+28
-36
@@ -536,9 +536,9 @@ NcpBase::NcpBase(otInstance *aInstance):
|
||||
|
||||
otSetStateChangedCallback(mInstance, &NcpBase::HandleNetifStateChanged, this);
|
||||
otIp6SetReceiveCallback(mInstance, &NcpBase::HandleDatagramFromStack, this);
|
||||
otSetLinkPcapCallback(mInstance, &NcpBase::HandleRawFrame, static_cast<void*>(this));
|
||||
otIcmp6SetEchoEnabled(mInstance, false);
|
||||
otIp6SetReceiveFilterEnabled(mInstance, true);
|
||||
otLinkSetPcapCallback(mInstance, &NcpBase::HandleRawFrame, static_cast<void*>(this));
|
||||
otIcmp6SetEchoEnabled(mInstance, false);
|
||||
|
||||
mUpdateChangedPropsTask.Post();
|
||||
|
||||
@@ -1791,7 +1791,7 @@ ThreadError NcpBase::GetPropertyHandler_POWER_STATE(uint8_t header, spinel_prop_
|
||||
ThreadError NcpBase::GetPropertyHandler_HWADDR(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
otExtAddress hwAddr;
|
||||
otGetFactoryAssignedIeeeEui64(mInstance, &hwAddr);
|
||||
otLinkGetFactoryAssignedIeeeEui64(mInstance, &hwAddr);
|
||||
|
||||
return SendPropertyUpdate(
|
||||
header,
|
||||
@@ -1828,7 +1828,7 @@ ThreadError NcpBase::GetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_
|
||||
ThreadError NcpBase::GetPropertyHandler_PHY_FREQ(uint8_t header, spinel_prop_key_t key)
|
||||
{
|
||||
uint32_t freq_khz(0);
|
||||
const uint8_t chan(otGetChannel(mInstance));
|
||||
const uint8_t chan(otLinkGetChannel(mInstance));
|
||||
|
||||
if (chan == 0)
|
||||
{
|
||||
@@ -1864,7 +1864,7 @@ ThreadError NcpBase::GetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key
|
||||
SPINEL_CMD_PROP_VALUE_IS,
|
||||
key,
|
||||
SPINEL_DATATYPE_UINT8_S,
|
||||
otGetChannel(mInstance)
|
||||
otLinkGetChannel(mInstance)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1886,7 +1886,7 @@ ThreadError NcpBase::GetPropertyHandler_PHY_TX_POWER(uint8_t header, spinel_prop
|
||||
SPINEL_CMD_PROP_VALUE_IS,
|
||||
key,
|
||||
SPINEL_DATATYPE_INT8_S,
|
||||
otGetMaxTransmitPower(mInstance)
|
||||
otLinkGetMaxTransmitPower(mInstance)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1909,7 +1909,7 @@ ThreadError NcpBase::GetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_pr
|
||||
}
|
||||
else
|
||||
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
if (otIsActiveScanInProgress(mInstance))
|
||||
if (otLinkIsActiveScanInProgress(mInstance))
|
||||
{
|
||||
errorCode = SendPropertyUpdate(
|
||||
header,
|
||||
@@ -1919,7 +1919,7 @@ ThreadError NcpBase::GetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_pr
|
||||
SPINEL_SCAN_STATE_BEACON
|
||||
);
|
||||
}
|
||||
else if (otIsEnergyScanInProgress(mInstance))
|
||||
else if (otLinkIsEnergyScanInProgress(mInstance))
|
||||
{
|
||||
errorCode = SendPropertyUpdate(
|
||||
header,
|
||||
@@ -1987,7 +1987,7 @@ ThreadError NcpBase::GetPropertyHandler_MAC_15_4_PANID(uint8_t header, spinel_pr
|
||||
SPINEL_CMD_PROP_VALUE_IS,
|
||||
key,
|
||||
SPINEL_DATATYPE_UINT16_S,
|
||||
otGetPanId(mInstance)
|
||||
otLinkGetPanId(mInstance)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2011,7 +2011,7 @@ ThreadError NcpBase::GetPropertyHandler_MAC_15_4_LADDR(uint8_t header, spinel_pr
|
||||
SPINEL_CMD_PROP_VALUE_IS,
|
||||
key,
|
||||
SPINEL_DATATYPE_EUI64_S,
|
||||
otGetExtendedAddress(mInstance)
|
||||
otLinkGetExtendedAddress(mInstance)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2022,7 +2022,7 @@ ThreadError NcpBase::GetPropertyHandler_MAC_15_4_SADDR(uint8_t header, spinel_pr
|
||||
SPINEL_CMD_PROP_VALUE_IS,
|
||||
key,
|
||||
SPINEL_DATATYPE_UINT16_S,
|
||||
otGetShortAddress(mInstance)
|
||||
otLinkGetShortAddress(mInstance)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2033,7 +2033,7 @@ ThreadError NcpBase::GetPropertyHandler_MAC_EXTENDED_ADDR(uint8_t header, spinel
|
||||
SPINEL_CMD_PROP_VALUE_IS,
|
||||
key,
|
||||
SPINEL_DATATYPE_EUI64_S,
|
||||
otGetExtendedAddress(mInstance)
|
||||
otLinkGetExtendedAddress(mInstance)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2868,7 +2868,7 @@ ThreadError NcpBase::GetPropertyHandler_MAC_CNTR(uint8_t header, spinel_prop_key
|
||||
const otMacCounters *macCounters;
|
||||
ThreadError errorCode = kThreadError_None;
|
||||
|
||||
macCounters = otGetMacCounters(mInstance);
|
||||
macCounters = otLinkGetCounters(mInstance);
|
||||
|
||||
assert(macCounters != NULL);
|
||||
|
||||
@@ -3144,7 +3144,7 @@ ThreadError NcpBase::GetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_pro
|
||||
|
||||
for (uint8_t i = 0; (i != 255) && (errorCode == kThreadError_None); i++)
|
||||
{
|
||||
errorCode = otGetMacWhitelistEntry(mInstance, i, &entry);
|
||||
errorCode = otLinkGetWhitelistEntry(mInstance, i, &entry);
|
||||
|
||||
if (errorCode != kThreadError_None)
|
||||
{
|
||||
@@ -3176,7 +3176,7 @@ ThreadError NcpBase::GetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t header, sp
|
||||
SPINEL_CMD_PROP_VALUE_IS,
|
||||
key,
|
||||
SPINEL_DATATYPE_BOOL_S,
|
||||
otIsMacWhitelistEnabled(mInstance)
|
||||
otLinkIsWhitelistEnabled(mInstance)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3416,7 +3416,7 @@ ThreadError NcpBase::SetPropertyHandler_PHY_TX_POWER(uint8_t header, spinel_prop
|
||||
|
||||
if (parsedLength > 0)
|
||||
{
|
||||
otSetMaxTransmitPower(mInstance, value);
|
||||
otLinkSetMaxTransmitPower(mInstance, value);
|
||||
|
||||
errorCode = HandleCommandPropertyGet(header, key);
|
||||
}
|
||||
@@ -3444,7 +3444,7 @@ ThreadError NcpBase::SetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key
|
||||
|
||||
if (parsedLength > 0)
|
||||
{
|
||||
errorCode = otSetChannel(mInstance, static_cast<uint8_t>(i));
|
||||
errorCode = otLinkSetChannel(mInstance, static_cast<uint8_t>(i));
|
||||
|
||||
#if OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
|
||||
@@ -3665,7 +3665,7 @@ ThreadError NcpBase::SetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_pr
|
||||
else
|
||||
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
{
|
||||
errorCode = otActiveScan(
|
||||
errorCode = otLinkActiveScan(
|
||||
mInstance,
|
||||
mChannelMask,
|
||||
mScanPeriod,
|
||||
@@ -3714,7 +3714,7 @@ ThreadError NcpBase::SetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_pr
|
||||
else
|
||||
#endif // OPENTHREAD_ENABLE_RAW_LINK_API
|
||||
{
|
||||
errorCode = otEnergyScan(
|
||||
errorCode = otLinkEnergyScan(
|
||||
mInstance,
|
||||
mChannelMask,
|
||||
mScanPeriod,
|
||||
@@ -3768,7 +3768,7 @@ ThreadError NcpBase::SetPropertyHandler_MAC_15_4_PANID(uint8_t header, spinel_pr
|
||||
|
||||
if (parsedLength > 0)
|
||||
{
|
||||
errorCode = otSetPanId(mInstance, tmp);
|
||||
errorCode = otLinkSetPanId(mInstance, tmp);
|
||||
|
||||
if (errorCode == kThreadError_None)
|
||||
{
|
||||
@@ -3803,7 +3803,7 @@ ThreadError NcpBase::SetPropertyHandler_MAC_15_4_LADDR(uint8_t header, spinel_pr
|
||||
|
||||
if (parsedLength > 0)
|
||||
{
|
||||
errorCode = otSetExtendedAddress(mInstance, tmp);
|
||||
errorCode = otLinkSetExtendedAddress(mInstance, tmp);
|
||||
|
||||
if (errorCode == kThreadError_None)
|
||||
{
|
||||
@@ -4742,7 +4742,7 @@ ThreadError NcpBase::SetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_pro
|
||||
spinel_ssize_t parsedLength = 1;
|
||||
|
||||
// First, clear the whitelist.
|
||||
otClearMacWhitelist(mInstance);
|
||||
otLinkClearWhitelist(mInstance);
|
||||
|
||||
while ((errorCode == kThreadError_None)
|
||||
&& (parsedLength > 0)
|
||||
@@ -4779,11 +4779,11 @@ ThreadError NcpBase::SetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_pro
|
||||
|
||||
if (rssi == RSSI_OVERRIDE_DISABLED)
|
||||
{
|
||||
errorCode = otAddMacWhitelist(mInstance, ext_addr->m8);
|
||||
errorCode = otLinkAddWhitelist(mInstance, ext_addr->m8);
|
||||
}
|
||||
else
|
||||
{
|
||||
errorCode = otAddMacWhitelistRssi(mInstance, ext_addr->m8, rssi);
|
||||
errorCode = otLinkAddWhitelistRssi(mInstance, ext_addr->m8, rssi);
|
||||
}
|
||||
|
||||
value_ptr += parsedLength;
|
||||
@@ -4824,15 +4824,7 @@ ThreadError NcpBase::SetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t header, sp
|
||||
|
||||
if (parsedLength > 0)
|
||||
{
|
||||
if (isEnabled)
|
||||
{
|
||||
otEnableMacWhitelist(mInstance);
|
||||
}
|
||||
else
|
||||
{
|
||||
otDisableMacWhitelist(mInstance);
|
||||
}
|
||||
|
||||
otLinkSetWhitelistEnabled(mInstance, isEnabled);
|
||||
errorCode = HandleCommandPropertyGet(header, key);
|
||||
}
|
||||
else
|
||||
@@ -5878,11 +5870,11 @@ ThreadError NcpBase::InsertPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_
|
||||
{
|
||||
if (rssi == RSSI_OVERRIDE_DISABLED)
|
||||
{
|
||||
errorCode = otAddMacWhitelist(mInstance, ext_addr->m8);
|
||||
errorCode = otLinkAddWhitelist(mInstance, ext_addr->m8);
|
||||
}
|
||||
else
|
||||
{
|
||||
errorCode = otAddMacWhitelistRssi(mInstance, ext_addr->m8, rssi);
|
||||
errorCode = otLinkAddWhitelistRssi(mInstance, ext_addr->m8, rssi);
|
||||
}
|
||||
|
||||
if (errorCode == kThreadError_None)
|
||||
@@ -6241,7 +6233,7 @@ ThreadError NcpBase::RemovePropertyHandler_MAC_WHITELIST(uint8_t header, spinel_
|
||||
|
||||
if (parsedLength > 0)
|
||||
{
|
||||
otRemoveMacWhitelist(mInstance, ext_addr.m8);
|
||||
otLinkRemoveWhitelist(mInstance, ext_addr.m8);
|
||||
|
||||
errorCode = SendPropertyUpdate(
|
||||
header,
|
||||
|
||||
@@ -130,7 +130,7 @@ void TestFuzz(uint32_t aSeconds)
|
||||
VerifyOrQuit(aInstance != NULL, "Failed to initialize otInstance");
|
||||
|
||||
// Start the Thread network
|
||||
otSetPanId(aInstance, (otPanId)0xFACE);
|
||||
otLinkSetPanId(aInstance, (otPanId)0xFACE);
|
||||
otIp6SetEnabled(aInstance, true);
|
||||
otThreadStart(aInstance);
|
||||
|
||||
@@ -186,7 +186,7 @@ void TestFuzz(uint32_t aSeconds)
|
||||
#endif
|
||||
|
||||
// Hack to get a receive poll immediately
|
||||
otSetChannel(aInstance, 11);
|
||||
otLinkSetChannel(aInstance, 11);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user