mirror of
https://github.com/espressif/openthread.git
synced 2026-08-02 17:17:45 +00:00
Ncp: Change the encoding of child info in prop THREAD_CHILD_TABLE getter (#515)
This commit makes two changes in how the child info is encoded in the getter of property `THREAD_CHILD_TABLE`. First, the child mode flags (e.g., `RxOnWhenIdle`) are sent as a single uint8_t bitmask. Second, the child id is no longer included in the response (as it can be derived from Rloc16).
This commit is contained in:
committed by
Jonathan Hui
parent
0a46feaee1
commit
01f9168d74
+34
-6
@@ -1815,6 +1815,7 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_CHILD_TABLE(uint8_t header, spine
|
||||
ThreadError errorCode = kThreadError_None;
|
||||
otChildInfo childInfo;
|
||||
uint8_t index;
|
||||
uint8_t modeFlags;
|
||||
|
||||
SuccessOrExit(errorCode = OutboundFrameBegin());
|
||||
SuccessOrExit(errorCode = OutboundFrameFeedPacked("Cii", header, SPINEL_CMD_PROP_VALUE_IS, key));
|
||||
@@ -1825,21 +1826,48 @@ ThreadError NcpBase::GetPropertyHandler_THREAD_CHILD_TABLE(uint8_t header, spine
|
||||
{
|
||||
if (childInfo.mTimeout > 0)
|
||||
{
|
||||
modeFlags = 0;
|
||||
|
||||
if (childInfo.mRxOnWhenIdle)
|
||||
{
|
||||
modeFlags |= kThreadMode_RxOnWhenIdle;
|
||||
}
|
||||
|
||||
if (childInfo.mSecureDataRequest)
|
||||
{
|
||||
modeFlags |= kThreadMode_SecureDataRequest;
|
||||
}
|
||||
|
||||
if (childInfo.mFullFunction)
|
||||
{
|
||||
modeFlags |= kThreadMode_FullFunctionDevice;
|
||||
}
|
||||
|
||||
if (childInfo.mFullNetworkData)
|
||||
{
|
||||
modeFlags |= kThreadMode_FullNetworkData;
|
||||
}
|
||||
|
||||
SuccessOrExit(
|
||||
errorCode = OutboundFrameFeedPacked(
|
||||
"T(ESSLLCCcbbbb)",
|
||||
"T("
|
||||
SPINEL_DATATYPE_EUI64_S // EUI64 Address
|
||||
SPINEL_DATATYPE_UINT16_S // Rloc16
|
||||
SPINEL_DATATYPE_UINT32_S // Timeout
|
||||
SPINEL_DATATYPE_UINT32_S // Age
|
||||
SPINEL_DATATYPE_UINT8_S // Network Data Version
|
||||
SPINEL_DATATYPE_UINT8_S // Link Quality In
|
||||
SPINEL_DATATYPE_INT8_S // Average RSS
|
||||
SPINEL_DATATYPE_UINT8_S // Mode (flags)
|
||||
")",
|
||||
childInfo.mExtAddress.m8,
|
||||
childInfo.mChildId,
|
||||
childInfo.mRloc16,
|
||||
childInfo.mTimeout,
|
||||
childInfo.mAge,
|
||||
childInfo.mNetworkDataVersion,
|
||||
childInfo.mLinkQualityIn,
|
||||
childInfo.mAverageRssi,
|
||||
childInfo.mRxOnWhenIdle,
|
||||
childInfo.mSecureDataRequest,
|
||||
childInfo.mFullFunction,
|
||||
childInfo.mFullNetworkData
|
||||
modeFlags
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -425,8 +425,7 @@ typedef enum
|
||||
SPINEL_PROP_THREAD__BEGIN = 0x50,
|
||||
SPINEL_PROP_THREAD_LEADER_ADDR = SPINEL_PROP_THREAD__BEGIN + 0, ///< [6]
|
||||
SPINEL_PROP_THREAD_PARENT = SPINEL_PROP_THREAD__BEGIN + 1, ///< LADDR, SADDR [ES]
|
||||
SPINEL_PROP_THREAD_CHILD_TABLE = SPINEL_PROP_THREAD__BEGIN + 2, ///< [A(T(ESSLLCCcbbbb))]
|
||||
/// array(EUI64,chId,rloc16,timeout,age,netDataVer,inLqi,aveRSS,rxOnInIdle,secureDataReq,fullFunc,fullNetData)
|
||||
SPINEL_PROP_THREAD_CHILD_TABLE = SPINEL_PROP_THREAD__BEGIN + 2, ///< array(EUI64,rloc16,timeout,age,netDataVer,inLqi,aveRSS,mode) [A(T(ESLLCCcC))]
|
||||
SPINEL_PROP_THREAD_LEADER_RID = SPINEL_PROP_THREAD__BEGIN + 3, ///< [C]
|
||||
SPINEL_PROP_THREAD_LEADER_WEIGHT = SPINEL_PROP_THREAD__BEGIN + 4, ///< [C]
|
||||
SPINEL_PROP_THREAD_LOCAL_LEADER_WEIGHT
|
||||
|
||||
Reference in New Issue
Block a user