[api] change type from uint8_t* to otExtendedPanId (#2960)

This commit is contained in:
Jonathan Hui
2018-08-15 10:12:49 -07:00
committed by GitHub
parent ae5421ecbd
commit 920197398b
19 changed files with 73 additions and 61 deletions
+6 -5
View File
@@ -1506,7 +1506,7 @@ otLinkSetExtendedAddress(
}
OTAPI
const uint8_t *
const otExtendedPanId *
OTCALL
otThreadGetExtendedPanId(
_In_ otInstance *aInstance
@@ -1515,12 +1515,13 @@ otThreadGetExtendedPanId(
if (aInstance == nullptr) return nullptr;
otExtendedPanId *Result = (otExtendedPanId*)malloc(sizeof(otExtendedPanId));
if (Result && QueryIOCTL(aInstance, IOCTL_OTLWF_OT_EXTENDED_PANID, Result) != ERROR_SUCCESS)
if (Result == nullptr) return nullptr;
if (QueryIOCTL(aInstance, IOCTL_OTLWF_OT_EXTENDED_PANID, Result) != ERROR_SUCCESS)
{
free(Result);
Result = nullptr;
}
return (uint8_t*)Result;
return Result;
}
OTAPI
@@ -1528,11 +1529,11 @@ otError
OTCALL
otThreadSetExtendedPanId(
_In_ otInstance *aInstance,
const uint8_t *aExtendedPanId
const otExtendedPanId *aExtendedPanId
)
{
if (aInstance == nullptr) return OT_ERROR_INVALID_ARGS;
return DwordToThreadError(SetIOCTL(aInstance, IOCTL_OTLWF_OT_EXTENDED_PANID, (const otExtendedPanId*)aExtendedPanId));
return DwordToThreadError(SetIOCTL(aInstance, IOCTL_OTLWF_OT_EXTENDED_PANID, aExtendedPanId));
}
OTAPI
+3 -2
View File
@@ -1256,12 +1256,13 @@ otLwfIoCtl_otExtendedPanId(
if (InBufferLength >= sizeof(otExtendedPanId))
{
status = ThreadErrorToNtstatus(otThreadSetExtendedPanId(pFilter->otCtx, (uint8_t*)InBuffer));
status = ThreadErrorToNtstatus(otThreadSetExtendedPanId(pFilter->otCtx, (otExtendedPanId*)InBuffer));
*OutBufferLength = 0;
}
else if (*OutBufferLength >= sizeof(otExtendedPanId))
{
memcpy(OutBuffer, otThreadGetExtendedPanId(pFilter->otCtx), sizeof(otExtendedPanId));
const otExtendedPanId* aExtendedPanId = otThreadGetExtendedPanId(pFilter->otCtx);
memcpy(OutBuffer, aExtendedPanId, sizeof(otExtendedPanId));
*OutBufferLength = sizeof(otExtendedPanId);
status = STATUS_SUCCESS;
}