diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index ce12c9267..ee5fd9d5e 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -428,11 +428,11 @@ const NcpBase::RemovePropertyHandlerEntry NcpBase::mRemovePropertyHandlerTable[] // MARK: Utility Functions // ---------------------------------------------------------------------------- -static spinel_status_t ThreadErrorToSpinelStatus(otError error) +static spinel_status_t ThreadErrorToSpinelStatus(otError aError) { spinel_status_t ret; - switch (error) + switch (aError) { case OT_ERROR_NONE: ret = SPINEL_STATUS_OK; @@ -492,18 +492,18 @@ static spinel_status_t ThreadErrorToSpinelStatus(otError error) default: // Unknown error code. Wrap it as a Spinel status and return that. - ret = static_cast(SPINEL_STATUS_STACK_NATIVE__BEGIN + error); + ret = static_cast(SPINEL_STATUS_STACK_NATIVE__BEGIN + aError); break; } return ret; } -static spinel_status_t ResetReasonToSpinelStatus(otPlatResetReason reason) +static spinel_status_t ResetReasonToSpinelStatus(otPlatResetReason aReason) { spinel_status_t ret; - switch (reason) + switch (aReason) { case OT_PLAT_RESET_REASON_POWER_ON: ret = SPINEL_STATUS_RESET_POWER_ON; @@ -545,41 +545,41 @@ static spinel_status_t ResetReasonToSpinelStatus(otPlatResetReason reason) return ret; } -static uint8_t BorderRouterConfigToFlagByte(const otBorderRouterConfig &config) +static uint8_t BorderRouterConfigToFlagByte(const otBorderRouterConfig &aConfig) { uint8_t flags(0); - if (config.mPreferred) + if (aConfig.mPreferred) { flags |= SPINEL_NET_FLAG_PREFERRED; } - if (config.mSlaac) + if (aConfig.mSlaac) { flags |= SPINEL_NET_FLAG_SLAAC; } - if (config.mDhcp) + if (aConfig.mDhcp) { flags |= SPINEL_NET_FLAG_DHCP; } - if (config.mDefaultRoute) + if (aConfig.mDefaultRoute) { flags |= SPINEL_NET_FLAG_DEFAULT_ROUTE; } - if (config.mConfigure) + if (aConfig.mConfigure) { flags |= SPINEL_NET_FLAG_CONFIGURE; } - if (config.mOnMesh) + if (aConfig.mOnMesh) { flags |= SPINEL_NET_FLAG_ON_MESH; } - flags |= (config.mPreference << SPINEL_NET_FLAG_PREFERENCE_OFFSET); + flags |= (aConfig.mPreference << SPINEL_NET_FLAG_PREFERENCE_OFFSET); return flags; } @@ -753,28 +753,28 @@ void NcpBase::HandleTmfProxyStream(otMessage *aMessage, uint16_t aLocator, uint1 void NcpBase::HandleTmfProxyStream(otMessage *aMessage, uint16_t aLocator, uint16_t aPort) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; uint16_t length = otMessageGetLength(aMessage); - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S SPINEL_DATATYPE_UINT16_S, - SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, - SPINEL_CMD_PROP_VALUE_IS, - SPINEL_PROP_THREAD_TMF_PROXY_STREAM, - length - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S SPINEL_DATATYPE_UINT16_S, + SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, + SPINEL_CMD_PROP_VALUE_IS, + SPINEL_PROP_THREAD_TMF_PROXY_STREAM, + length + )); - SuccessOrExit(errorCode = OutboundFrameFeedMessage(aMessage)); + SuccessOrExit(error = OutboundFrameFeedMessage(aMessage)); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_UINT16_S SPINEL_DATATYPE_UINT16_S, - aLocator, - aPort - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_UINT16_S SPINEL_DATATYPE_UINT16_S, + aLocator, + aPort + )); // Set the `aMessage` pointer to NULL to indicate that it does // not need to be freed at the exit. The `aMessage` is now owned @@ -783,7 +783,7 @@ void NcpBase::HandleTmfProxyStream(otMessage *aMessage, uint16_t aLocator, uint1 // discarded. aMessage = NULL; - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: @@ -792,7 +792,7 @@ exit: otMessageFree(aMessage); } - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { SendLastStatus(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_STATUS_DROPPED); } @@ -810,22 +810,22 @@ void NcpBase::HandleDatagramFromStack(otMessage *aMessage, void *aContext) void NcpBase::HandleDatagramFromStack(otMessage *aMessage) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; bool isSecure = otMessageIsLinkSecurityEnabled(aMessage); uint16_t length = otMessageGetLength(aMessage); - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S SPINEL_DATATYPE_UINT16_S, - SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, - SPINEL_CMD_PROP_VALUE_IS, - isSecure ? SPINEL_PROP_STREAM_NET : SPINEL_PROP_STREAM_NET_INSECURE, - length - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S SPINEL_DATATYPE_UINT16_S, + SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, + SPINEL_CMD_PROP_VALUE_IS, + isSecure ? SPINEL_PROP_STREAM_NET : SPINEL_PROP_STREAM_NET_INSECURE, + length + )); - SuccessOrExit(errorCode = OutboundFrameFeedMessage(aMessage)); + SuccessOrExit(error = OutboundFrameFeedMessage(aMessage)); // Set the `aMessage` pointer to NULL to indicate that it does // not need to be freed at the exit. The `aMessage` is now owned @@ -836,7 +836,7 @@ void NcpBase::HandleDatagramFromStack(otMessage *aMessage) // Append any metadata (rssi, lqi, channel, etc) here! - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: @@ -845,7 +845,7 @@ exit: otMessageFree(aMessage); } - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { SendLastStatus(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_STATUS_DROPPED); mDroppedOutboundIpFrameCounter++; @@ -874,7 +874,7 @@ void NcpBase::HandleRawFrame(const otRadioFrame *aFrame, void *aContext) void NcpBase::HandleRawFrame(const otRadioFrame *aFrame) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; uint16_t flags = 0; if (!mIsRawStreamEnabled) @@ -882,7 +882,7 @@ void NcpBase::HandleRawFrame(const otRadioFrame *aFrame) goto exit; } - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); if (aFrame->mDidTX) { @@ -891,37 +891,37 @@ void NcpBase::HandleRawFrame(const otRadioFrame *aFrame) // Append frame header and frame length SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S SPINEL_DATATYPE_UINT16_S, - SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, - SPINEL_CMD_PROP_VALUE_IS, - SPINEL_PROP_STREAM_RAW, - aFrame->mLength - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S SPINEL_DATATYPE_UINT16_S, + SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, + SPINEL_CMD_PROP_VALUE_IS, + SPINEL_PROP_STREAM_RAW, + aFrame->mLength + )); // Append the frame contents - SuccessOrExit(errorCode = OutboundFrameFeedData(aFrame->mPsdu, aFrame->mLength)); + SuccessOrExit(error = OutboundFrameFeedData(aFrame->mPsdu, aFrame->mLength)); // Append metadata (rssi, etc) SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_INT8_S - SPINEL_DATATYPE_INT8_S - SPINEL_DATATYPE_UINT16_S - SPINEL_DATATYPE_STRUCT_S( // PHY-data - SPINEL_DATATYPE_NULL_S // Empty for now - ) - SPINEL_DATATYPE_STRUCT_S( // Vendor-data - SPINEL_DATATYPE_NULL_S // Empty for now - ), - aFrame->mPower, // TX Power - -128, // Noise Floor (Currently unused) - flags // Flags + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_INT8_S + SPINEL_DATATYPE_INT8_S + SPINEL_DATATYPE_UINT16_S + SPINEL_DATATYPE_STRUCT_S( // PHY-data + SPINEL_DATATYPE_NULL_S // Empty for now + ) + SPINEL_DATATYPE_STRUCT_S( // Vendor-data + SPINEL_DATATYPE_NULL_S // Empty for now + ), + aFrame->mPower, // TX Power + -128, // Noise Floor (Currently unused) + flags // Flags - // Skip PHY and Vendor data for now - )); + // Skip PHY and Vendor data for now + )); - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: return; @@ -939,7 +939,7 @@ void NcpBase::HandleActiveScanResult_Jump(otActiveScanResult *aResult, void *aCo void NcpBase::HandleActiveScanResult(otActiveScanResult *aResult) { - otError errorCode; + otError error; if (aResult) { @@ -982,18 +982,18 @@ void NcpBase::HandleActiveScanResult(otActiveScanResult *aResult) { // We are finished with the scan, so send out // a property update indicating such. - errorCode = SendPropertyUpdate( - SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, - SPINEL_CMD_PROP_VALUE_IS, - SPINEL_PROP_MAC_SCAN_STATE, - SPINEL_DATATYPE_UINT8_S, - SPINEL_SCAN_STATE_IDLE - ); + error = SendPropertyUpdate( + SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, + SPINEL_CMD_PROP_VALUE_IS, + SPINEL_PROP_MAC_SCAN_STATE, + SPINEL_DATATYPE_UINT8_S, + SPINEL_SCAN_STATE_IDLE + ); // If we could not send the end of scan indicator message now (no // buffer space), we set `mShouldSignalEndOfScan` to true to send // it out when buffer space becomes available. - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { mShouldSignalEndOfScan = true; } @@ -1007,7 +1007,7 @@ void NcpBase::HandleEnergyScanResult_Jump(otEnergyScanResult *aResult, void *aCo void NcpBase::HandleEnergyScanResult(otEnergyScanResult *aResult) { - otError errorCode; + otError error; if (aResult) { @@ -1027,18 +1027,18 @@ void NcpBase::HandleEnergyScanResult(otEnergyScanResult *aResult) { // We are finished with the scan, so send out // a property update indicating such. - errorCode = SendPropertyUpdate( - SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, - SPINEL_CMD_PROP_VALUE_IS, - SPINEL_PROP_MAC_SCAN_STATE, - SPINEL_DATATYPE_UINT8_S, - SPINEL_SCAN_STATE_IDLE - ); + error = SendPropertyUpdate( + SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, + SPINEL_CMD_PROP_VALUE_IS, + SPINEL_PROP_MAC_SCAN_STATE, + SPINEL_DATATYPE_UINT8_S, + SPINEL_SCAN_STATE_IDLE + ); // If we could not send the end of scan indicator message now (no // buffer space), we set `mShouldSignalEndOfScan` to true to send // it out when buffer space becomes available. - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { mShouldSignalEndOfScan = true; } @@ -1058,10 +1058,10 @@ void NcpBase::LinkRawReceiveDone(otInstance *, otRadioFrame *aFrame, otError aEr void NcpBase::LinkRawReceiveDone(otRadioFrame *aFrame, otError aError) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; uint16_t flags = 0; - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); if (aFrame->mDidTX) { @@ -1070,42 +1070,42 @@ void NcpBase::LinkRawReceiveDone(otRadioFrame *aFrame, otError aError) // Append frame header and frame length SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S SPINEL_DATATYPE_UINT16_S, - SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, - SPINEL_CMD_PROP_VALUE_IS, - SPINEL_PROP_STREAM_RAW, - (aError == OT_ERROR_NONE) ? aFrame->mLength : 0 - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S SPINEL_DATATYPE_UINT16_S, + SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, + SPINEL_CMD_PROP_VALUE_IS, + SPINEL_PROP_STREAM_RAW, + (aError == OT_ERROR_NONE) ? aFrame->mLength : 0 + )); if (aError == OT_ERROR_NONE) { // Append the frame contents - SuccessOrExit(errorCode = OutboundFrameFeedData(aFrame->mPsdu, aFrame->mLength)); + SuccessOrExit(error = OutboundFrameFeedData(aFrame->mPsdu, aFrame->mLength)); } // Append metadata (rssi, etc) SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_INT8_S - SPINEL_DATATYPE_INT8_S - SPINEL_DATATYPE_UINT16_S - SPINEL_DATATYPE_STRUCT_S( // PHY-data - SPINEL_DATATYPE_UINT8_S // 802.15.4 channel - SPINEL_DATATYPE_UINT8_S // 802.15.4 LQI - ) - SPINEL_DATATYPE_STRUCT_S( // Vendor-data - SPINEL_DATATYPE_UINT_PACKED_S - ), - aFrame->mPower, // TX Power - -128, // Noise Floor (Currently unused) - flags, // Flags - aFrame->mChannel, // Receive channel - aFrame->mLqi, // Link quality indicator - aError // Receive error - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_INT8_S + SPINEL_DATATYPE_INT8_S + SPINEL_DATATYPE_UINT16_S + SPINEL_DATATYPE_STRUCT_S( // PHY-data + SPINEL_DATATYPE_UINT8_S // 802.15.4 channel + SPINEL_DATATYPE_UINT8_S // 802.15.4 LQI + ) + SPINEL_DATATYPE_STRUCT_S( // Vendor-data + SPINEL_DATATYPE_UINT_PACKED_S + ), + aFrame->mPower, // TX Power + -128, // Noise Floor (Currently unused) + flags, // Flags + aFrame->mChannel, // Receive channel + aFrame->mLqi, // Link quality indicator + aError // Receive error + )); - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: return; @@ -1175,18 +1175,18 @@ void NcpBase::LinkRawEnergyScanDone(int8_t aEnergyScanMaxRssi) // MARK: Address Table Changed Glue // ---------------------------------------------------------------------------- -void NcpBase::HandleNetifStateChanged(uint32_t flags, void *context) +void NcpBase::HandleNetifStateChanged(uint32_t aFlags, void *aContext) { - NcpBase *obj = static_cast(context); + NcpBase *obj = static_cast(aContext); - obj->mChangedFlags |= flags; + obj->mChangedFlags |= aFlags; obj->mUpdateChangedPropsTask.Post(); } -void NcpBase::UpdateChangedProps(void *context) +void NcpBase::UpdateChangedProps(void *aContext) { - NcpBase *obj = static_cast(context); + NcpBase *obj = static_cast(aContext); obj->UpdateChangedProps(); } @@ -1364,34 +1364,34 @@ exit: otError NcpBase::OutboundFrameSend(void) { - otError errorCode; + otError error; - SuccessOrExit(errorCode = OutboundFrameEnd()); + SuccessOrExit(error = OutboundFrameEnd()); mTxSpinelFrameCounter++; exit: - return errorCode; + return error; } -void NcpBase::HandleReceive(const uint8_t *buf, uint16_t bufLength) +void NcpBase::HandleReceive(const uint8_t *aBuf, uint16_t aBufLength) { uint8_t header = 0; unsigned int command = 0; spinel_ssize_t parsedLength; - const uint8_t *arg_ptr = NULL; - unsigned int arg_len = 0; - otError errorCode = OT_ERROR_NONE; + const uint8_t *argPtr = NULL; + unsigned int argLen = 0; + otError error = OT_ERROR_NONE; spinel_tid_t tid = 0; parsedLength = spinel_datatype_unpack( - buf, - bufLength, + aBuf, + aBufLength, SPINEL_DATATYPE_COMMAND_S SPINEL_DATATYPE_DATA_S, &header, &command, - &arg_ptr, - &arg_len + &argPtr, + &argLen ); tid = SPINEL_HEADER_GET_TID(header); @@ -1400,9 +1400,9 @@ void NcpBase::HandleReceive(const uint8_t *buf, uint16_t bufLength) mHostPowerState = SPINEL_HOST_POWER_STATE_ONLINE; mHostPowerStateInProgress = false; - if (parsedLength == bufLength) + if (parsedLength == aBufLength) { - errorCode = HandleCommand(header, command, arg_ptr, static_cast(arg_len)); + error = HandleCommand(header, command, argPtr, static_cast(argLen)); // Check if we may have missed a `tid` in the sequence. if ((mNextExpectedTid != 0) && (tid != mNextExpectedTid)) @@ -1414,10 +1414,10 @@ void NcpBase::HandleReceive(const uint8_t *buf, uint16_t bufLength) } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); } - if (errorCode == OT_ERROR_NO_BUFS) + if (error == OT_ERROR_NO_BUFS) { // If we cannot send a response due to buffer space not being // available, we remember the TID of command so to send an @@ -1445,7 +1445,8 @@ void NcpBase::HandleReceive(const uint8_t *buf, uint16_t bufLength) mRxSpinelFrameCounter++; } -void NcpBase::HandleFrameRemovedFromNcpBuffer(void *aContext, NcpFrameBuffer::FrameTag aFrameTag, NcpFrameBuffer *aNcpBuffer) +void NcpBase::HandleFrameRemovedFromNcpBuffer(void *aContext, NcpFrameBuffer::FrameTag aFrameTag, + NcpFrameBuffer *aNcpBuffer) { (void)aNcpBuffer; static_cast(aContext)->HandleFrameRemovedFromNcpBuffer(aFrameTag); @@ -1561,23 +1562,23 @@ void NcpBase::IncrementFrameErrorCounter(void) // MARK: Inbound Command Handlers // ---------------------------------------------------------------------------- -otError NcpBase::HandleCommand(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len) +otError NcpBase::HandleCommand(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen) { unsigned i; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; // Skip if this isn't a spinel frame - VerifyOrExit((SPINEL_HEADER_FLAG & header) == SPINEL_HEADER_FLAG, errorCode = OT_ERROR_INVALID_ARGS); + VerifyOrExit((SPINEL_HEADER_FLAG & aHeader) == SPINEL_HEADER_FLAG, error = OT_ERROR_INVALID_ARGS); // We only support IID zero for now. VerifyOrExit( - SPINEL_HEADER_GET_IID(header) == 0, - errorCode = SendLastStatus(header, SPINEL_STATUS_INVALID_INTERFACE) + SPINEL_HEADER_GET_IID(aHeader) == 0, + error = SendLastStatus(aHeader, SPINEL_STATUS_INVALID_INTERFACE) ); for (i = 0; i < sizeof(mCommandHandlerTable) / sizeof(mCommandHandlerTable[0]); i++) { - if (mCommandHandlerTable[i].mCommand == command) + if (mCommandHandlerTable[i].mCommand == aCommand) { break; } @@ -1585,25 +1586,25 @@ otError NcpBase::HandleCommand(uint8_t header, unsigned int command, const uint8 if (i < sizeof(mCommandHandlerTable) / sizeof(mCommandHandlerTable[0])) { - errorCode = (this->*mCommandHandlerTable[i].mHandler)(header, command, arg_ptr, arg_len); + error = (this->*mCommandHandlerTable[i].mHandler)(aHeader, aCommand, aArgPtr, aArgLen); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_INVALID_COMMAND); + error = SendLastStatus(aHeader, SPINEL_STATUS_INVALID_COMMAND); } exit: - return errorCode; + return error; } -otError NcpBase::HandleCommandPropertyGet(uint8_t header, spinel_prop_key_t key) +otError NcpBase::HandleCommandPropertyGet(uint8_t aHeader, spinel_prop_key_t aKey) { unsigned i; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; for (i = 0; i < sizeof(mGetPropertyHandlerTable) / sizeof(mGetPropertyHandlerTable[0]); i++) { - if (mGetPropertyHandlerTable[i].mPropKey == key) + if (mGetPropertyHandlerTable[i].mPropKey == aKey) { break; } @@ -1611,25 +1612,25 @@ otError NcpBase::HandleCommandPropertyGet(uint8_t header, spinel_prop_key_t key) if (i < sizeof(mGetPropertyHandlerTable) / sizeof(mGetPropertyHandlerTable[0])) { - errorCode = (this->*mGetPropertyHandlerTable[i].mHandler)(header, key); + error = (this->*mGetPropertyHandlerTable[i].mHandler)(aHeader, aKey); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PROP_NOT_FOUND); + error = SendLastStatus(aHeader, SPINEL_STATUS_PROP_NOT_FOUND); } - return errorCode; + return error; } -otError NcpBase::HandleCommandPropertySet(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::HandleCommandPropertySet(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { unsigned i; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; for (i = 0; i < sizeof(mSetPropertyHandlerTable) / sizeof(mSetPropertyHandlerTable[0]); i++) { - if (mSetPropertyHandlerTable[i].mPropKey == key) + if (mSetPropertyHandlerTable[i].mPropKey == aKey) { break; } @@ -1637,25 +1638,25 @@ otError NcpBase::HandleCommandPropertySet(uint8_t header, spinel_prop_key_t key, if (i < sizeof(mSetPropertyHandlerTable) / sizeof(mSetPropertyHandlerTable[0])) { - errorCode = (this->*mSetPropertyHandlerTable[i].mHandler)(header, key, value_ptr, value_len); + error = (this->*mSetPropertyHandlerTable[i].mHandler)(aHeader, aKey, aValuePtr, aValueLen); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PROP_NOT_FOUND); + error = SendLastStatus(aHeader, SPINEL_STATUS_PROP_NOT_FOUND); } - return errorCode; + return error; } -otError NcpBase::HandleCommandPropertyInsert(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::HandleCommandPropertyInsert(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { unsigned i; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; for (i = 0; i < sizeof(mInsertPropertyHandlerTable) / sizeof(mInsertPropertyHandlerTable[0]); i++) { - if (mInsertPropertyHandlerTable[i].mPropKey == key) + if (mInsertPropertyHandlerTable[i].mPropKey == aKey) { break; } @@ -1663,25 +1664,25 @@ otError NcpBase::HandleCommandPropertyInsert(uint8_t header, spinel_prop_key_t k if (i < sizeof(mInsertPropertyHandlerTable) / sizeof(mInsertPropertyHandlerTable[0])) { - errorCode = (this->*mInsertPropertyHandlerTable[i].mHandler)(header, key, value_ptr, value_len); + error = (this->*mInsertPropertyHandlerTable[i].mHandler)(aHeader, aKey, aValuePtr, aValueLen); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PROP_NOT_FOUND); + error = SendLastStatus(aHeader, SPINEL_STATUS_PROP_NOT_FOUND); } - return errorCode; + return error; } -otError NcpBase::HandleCommandPropertyRemove(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::HandleCommandPropertyRemove(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { unsigned i; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; for (i = 0; i < sizeof(mRemovePropertyHandlerTable) / sizeof(mRemovePropertyHandlerTable[0]); i++) { - if (mRemovePropertyHandlerTable[i].mPropKey == key) + if (mRemovePropertyHandlerTable[i].mPropKey == aKey) { break; } @@ -1689,14 +1690,14 @@ otError NcpBase::HandleCommandPropertyRemove(uint8_t header, spinel_prop_key_t k if (i < sizeof(mRemovePropertyHandlerTable) / sizeof(mRemovePropertyHandlerTable[0])) { - errorCode = (this->*mRemovePropertyHandlerTable[i].mHandler)(header, key, value_ptr, value_len); + error = (this->*mRemovePropertyHandlerTable[i].mHandler)(aHeader, aKey, aValuePtr, aValueLen); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PROP_NOT_FOUND); + error = SendLastStatus(aHeader, SPINEL_STATUS_PROP_NOT_FOUND); } - return errorCode; + return error; } @@ -1705,60 +1706,60 @@ otError NcpBase::HandleCommandPropertyRemove(uint8_t header, spinel_prop_key_t k // ---------------------------------------------------------------------------- -otError NcpBase::SendLastStatus(uint8_t header, spinel_status_t lastStatus) +otError NcpBase::SendLastStatus(uint8_t aHeader, spinel_status_t aLastStatus) { - if (SPINEL_HEADER_GET_IID(header) == 0) + if (SPINEL_HEADER_GET_IID(aHeader) == 0) { - mLastStatus = lastStatus; + mLastStatus = aLastStatus; } return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_LAST_STATUS, SPINEL_DATATYPE_UINT_PACKED_S, - lastStatus + aLastStatus ); } -otError NcpBase::SendPropertyUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, - const char *pack_format, ...) +otError NcpBase::SendPropertyUpdate(uint8_t aHeader, uint8_t aCommand, spinel_prop_key_t aKey, + const char *aPackFormat, ...) { - otError errorCode = OT_ERROR_NONE; - va_list args; + otError error = OT_ERROR_NONE; + va_list args; - va_start(args, pack_format); - SuccessOrExit(errorCode = OutboundFrameBegin()); - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_COMMAND_PROP_S, header, command, key)); - SuccessOrExit(errorCode = OutboundFrameFeedVPacked(pack_format, args)); - SuccessOrExit(errorCode = OutboundFrameSend()); + va_start(args, aPackFormat); + SuccessOrExit(error = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_COMMAND_PROP_S, aHeader, aCommand, aKey)); + SuccessOrExit(error = OutboundFrameFeedVPacked(aPackFormat, args)); + SuccessOrExit(error = OutboundFrameSend()); exit: va_end(args); - return errorCode; + return error; } -otError NcpBase::SendPropertyUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SendPropertyUpdate(uint8_t aHeader, uint8_t aCommand, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - SuccessOrExit(errorCode = OutboundFrameBegin()); - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_COMMAND_PROP_S, header, command, key)); - SuccessOrExit(errorCode = OutboundFrameFeedData(value_ptr, value_len)); - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_COMMAND_PROP_S, aHeader, aCommand, aKey)); + SuccessOrExit(error = OutboundFrameFeedData(aValuePtr, aValueLen)); + SuccessOrExit(error = OutboundFrameSend()); exit: - return errorCode; + return error; } -otError NcpBase::SendPropertyUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, otMessage *aMessage) +otError NcpBase::SendPropertyUpdate(uint8_t aHeader, uint8_t aCommand, spinel_prop_key_t aKey, otMessage *aMessage) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - SuccessOrExit(errorCode = OutboundFrameBegin()); - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_COMMAND_PROP_S, header, command, key)); - SuccessOrExit(errorCode = OutboundFrameFeedMessage(aMessage)); + SuccessOrExit(error = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_COMMAND_PROP_S, aHeader, aCommand, aKey)); + SuccessOrExit(error = OutboundFrameFeedMessage(aMessage)); // Set the `aMessage` pointer to NULL to indicate that it does // not need to be freed at the exit. The `aMessage` is now owned @@ -1767,7 +1768,7 @@ otError NcpBase::SendPropertyUpdate(uint8_t header, uint8_t command, spinel_prop // discarded. aMessage = NULL; - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: @@ -1776,60 +1777,60 @@ exit: otMessageFree(aMessage); } - return errorCode; + return error; } -otError NcpBase::OutboundFrameFeedVPacked(const char *pack_format, va_list args) +otError NcpBase::OutboundFrameFeedVPacked(const char *aPackFormat, va_list aArgs) { uint8_t buf[96]; - otError errorCode = OT_ERROR_NO_BUFS; - spinel_ssize_t packed_len; + otError error = OT_ERROR_NO_BUFS; + spinel_ssize_t packedLen; - packed_len = spinel_datatype_vpack(buf, sizeof(buf), pack_format, args); + packedLen = spinel_datatype_vpack(buf, sizeof(buf), aPackFormat, aArgs); - if ((packed_len > 0) && (packed_len <= static_cast(sizeof(buf)))) + if ((packedLen > 0) && (packedLen <= static_cast(sizeof(buf)))) { - errorCode = OutboundFrameFeedData(buf, static_cast(packed_len)); + error = OutboundFrameFeedData(buf, static_cast(packedLen)); } - return errorCode; + return error; } -otError NcpBase::OutboundFrameFeedPacked(const char *pack_format, ...) +otError NcpBase::OutboundFrameFeedPacked(const char *aPackFormat, ...) { - otError errorCode; + otError error; va_list args; - va_start(args, pack_format); - errorCode = OutboundFrameFeedVPacked(pack_format, args); + va_start(args, aPackFormat); + error = OutboundFrameFeedVPacked(aPackFormat, args); va_end(args); - return errorCode; + return error; } // ---------------------------------------------------------------------------- // MARK: Individual Command Handlers // ---------------------------------------------------------------------------- -otError NcpBase::CommandHandler_NOOP(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len) +otError NcpBase::CommandHandler_NOOP(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen) { - (void)command; - (void)arg_ptr; - (void)arg_len; + (void)aCommand; + (void)aArgPtr; + (void)aArgLen; - return SendLastStatus(header, SPINEL_STATUS_OK); + return SendLastStatus(aHeader, SPINEL_STATUS_OK); } -otError NcpBase::CommandHandler_RESET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len) +otError NcpBase::CommandHandler_RESET(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, + uint16_t aArgLen) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; // We aren't using any of the arguments to this function. - (void)header; - (void)command; - (void)arg_ptr; - (void)arg_len; + (void)aHeader; + (void)aCommand; + (void)aArgPtr; + (void)aArgLen; // Signal a platform reset. If implemented, this function // shouldn't return. @@ -1842,194 +1843,194 @@ otError NcpBase::CommandHandler_RESET(uint8_t header, unsigned int command, cons otThreadSetEnabled(mInstance, false); otIp6SetEnabled(mInstance, false); - errorCode = SendLastStatus(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_STATUS_RESET_SOFTWARE); + error = SendLastStatus(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_STATUS_RESET_SOFTWARE); - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { mChangedFlags |= NCP_PLAT_RESET_REASON; mUpdateChangedPropsTask.Post(); } - return errorCode; + return error; } -otError NcpBase::CommandHandler_PROP_VALUE_GET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len) +otError NcpBase::CommandHandler_PROP_VALUE_GET(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, + uint16_t aArgLen) { unsigned int propKey = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - parsedLength = spinel_datatype_unpack(arg_ptr, arg_len, SPINEL_DATATYPE_UINT_PACKED_S, &propKey); + parsedLength = spinel_datatype_unpack(aArgPtr, aArgLen, SPINEL_DATATYPE_UINT_PACKED_S, &propKey); if (parsedLength > 0) { - errorCode = HandleCommandPropertyGet(header, static_cast(propKey)); + error = HandleCommandPropertyGet(aHeader, static_cast(propKey)); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - (void)command; + (void)aCommand; - return errorCode; + return error; } -otError NcpBase::CommandHandler_PROP_VALUE_SET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len) +otError NcpBase::CommandHandler_PROP_VALUE_SET(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, + uint16_t aArgLen) { unsigned int propKey = 0; spinel_ssize_t parsedLength; - const uint8_t *value_ptr; - unsigned int value_len; - otError errorCode = OT_ERROR_NONE; + const uint8_t *valuePtr; + unsigned int valueLen; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - arg_ptr, - arg_len, + aArgPtr, + aArgLen, SPINEL_DATATYPE_UINT_PACKED_S SPINEL_DATATYPE_DATA_S, &propKey, - &value_ptr, - &value_len + &valuePtr, + &valueLen ); - if (parsedLength == arg_len) + if (parsedLength == aArgLen) { - errorCode = HandleCommandPropertySet( - header, + error = HandleCommandPropertySet( + aHeader, static_cast(propKey), - value_ptr, - static_cast(value_len) + valuePtr, + static_cast(valueLen) ); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - (void)command; + (void)aCommand; - return errorCode; + return error; } -otError NcpBase::CommandHandler_PROP_VALUE_INSERT(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len) +otError NcpBase::CommandHandler_PROP_VALUE_INSERT(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, + uint16_t aArgLen) { unsigned int propKey = 0; spinel_ssize_t parsedLength; - const uint8_t *value_ptr; - unsigned int value_len; - otError errorCode = OT_ERROR_NONE; + const uint8_t *valuePtr; + unsigned int valueLen; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - arg_ptr, - arg_len, + aArgPtr, + aArgLen, SPINEL_DATATYPE_UINT_PACKED_S SPINEL_DATATYPE_DATA_S, &propKey, - &value_ptr, - &value_len + &valuePtr, + &valueLen ); - if (parsedLength == arg_len) + if (parsedLength == aArgLen) { - errorCode = HandleCommandPropertyInsert( - header, - static_cast(propKey), - value_ptr, - static_cast(value_len) - ); + error = HandleCommandPropertyInsert( + aHeader, + static_cast(propKey), + valuePtr, + static_cast(valueLen) + ); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - (void)command; + (void)aCommand; - return errorCode; + return error; } -otError NcpBase::CommandHandler_PROP_VALUE_REMOVE(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len) +otError NcpBase::CommandHandler_PROP_VALUE_REMOVE(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, + uint16_t aArgLen) { unsigned int propKey = 0; spinel_ssize_t parsedLength; - const uint8_t *value_ptr; - unsigned int value_len; - otError errorCode = OT_ERROR_NONE; + const uint8_t *valuePtr; + unsigned int valueLen; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - arg_ptr, - arg_len, + aArgPtr, + aArgLen, SPINEL_DATATYPE_UINT_PACKED_S SPINEL_DATATYPE_DATA_S, &propKey, - &value_ptr, - &value_len + &valuePtr, + &valueLen ); - if (parsedLength == arg_len) + if (parsedLength == aArgLen) { - errorCode = HandleCommandPropertyRemove( - header, - static_cast(propKey), - value_ptr, - static_cast(value_len) - ); + error = HandleCommandPropertyRemove( + aHeader, + static_cast(propKey), + valuePtr, + static_cast(valueLen) + ); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - (void)command; + (void)aCommand; - return errorCode; + return error; } -otError NcpBase::CommandHandler_NET_SAVE(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len) +otError NcpBase::CommandHandler_NET_SAVE(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, + uint16_t aArgLen) { - (void)command; - (void)arg_ptr; - (void)arg_len; + (void)aCommand; + (void)aArgPtr; + (void)aArgLen; - return SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED); + return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } -otError NcpBase::CommandHandler_NET_CLEAR(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len) +otError NcpBase::CommandHandler_NET_CLEAR(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, + uint16_t aArgLen) { - (void)command; - (void)arg_ptr; - (void)arg_len; + (void)aCommand; + (void)aArgPtr; + (void)aArgLen; - return SendLastStatus(header, ThreadErrorToSpinelStatus(otInstanceErasePersistentInfo(mInstance))); + return SendLastStatus(aHeader, ThreadErrorToSpinelStatus(otInstanceErasePersistentInfo(mInstance))); } -otError NcpBase::CommandHandler_NET_RECALL(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len) +otError NcpBase::CommandHandler_NET_RECALL(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, + uint16_t aArgLen) { - (void)command; - (void)arg_ptr; - (void)arg_len; + (void)aCommand; + (void)aArgPtr; + (void)aArgLen; - return SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED); + return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } #if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE -otError NcpBase::CommandHandler_PEEK(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len) +otError NcpBase::CommandHandler_PEEK(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen) { spinel_ssize_t parsedLength; uint32_t address; uint16_t count; - spinel_status_t spinel_error = SPINEL_STATUS_OK; - otError errorCode = OT_ERROR_NONE; + spinel_status_t spinelError = SPINEL_STATUS_OK; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - arg_ptr, - arg_len, + aArgPtr, + aArgLen, ( SPINEL_DATATYPE_UINT32_S // Address SPINEL_DATATYPE_UINT16_S // Count @@ -2038,55 +2039,55 @@ otError NcpBase::CommandHandler_PEEK(uint8_t header, unsigned int command, const &count ); - VerifyOrExit(parsedLength == arg_len, spinel_error = SPINEL_STATUS_PARSE_ERROR); + VerifyOrExit(parsedLength == aArgLen, spinelError = SPINEL_STATUS_PARSE_ERROR); - VerifyOrExit(count != 0, spinel_error = SPINEL_STATUS_INVALID_ARGUMENT); + VerifyOrExit(count != 0, spinelError = SPINEL_STATUS_INVALID_ARGUMENT); if (mAllowPeekDelegate != NULL) { - VerifyOrExit(mAllowPeekDelegate(address, count), spinel_error = SPINEL_STATUS_INVALID_ARGUMENT); + VerifyOrExit(mAllowPeekDelegate(address, count), spinelError = SPINEL_STATUS_INVALID_ARGUMENT); } - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - ( - SPINEL_DATATYPE_COMMAND_S // Header and Command - SPINEL_DATATYPE_UINT32_S // Address - SPINEL_DATATYPE_UINT16_S // Count - ), - header, - SPINEL_CMD_PEEK_RET, - address, - count - )); - SuccessOrExit(errorCode = OutboundFrameFeedData(reinterpret_cast(address), count)); - SuccessOrExit(errorCode = OutboundFrameSend()); + error = OutboundFrameFeedPacked( + ( + SPINEL_DATATYPE_COMMAND_S // Header and Command + SPINEL_DATATYPE_UINT32_S // Address + SPINEL_DATATYPE_UINT16_S // Count + ), + aHeader, + SPINEL_CMD_PEEK_RET, + address, + count + )); + SuccessOrExit(error = OutboundFrameFeedData(reinterpret_cast(address), count)); + SuccessOrExit(error = OutboundFrameSend()); exit: - if (spinel_error != SPINEL_STATUS_OK) + if (spinelError != SPINEL_STATUS_OK) { - errorCode = SendLastStatus(header, spinel_error); + error = SendLastStatus(aHeader, spinelError); } - (void)command; + (void)aCommand; - return errorCode; + return error; } -otError NcpBase::CommandHandler_POKE(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len) +otError NcpBase::CommandHandler_POKE(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen) { spinel_ssize_t parsedLength; uint32_t address; uint16_t count; - const uint8_t *data_ptr = NULL; - spinel_size_t data_len; - spinel_status_t spinel_error = SPINEL_STATUS_OK; - otError errorCode = OT_ERROR_NONE; + const uint8_t *dataPtr = NULL; + spinel_size_t dataLen; + spinel_status_t spinelError = SPINEL_STATUS_OK; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - arg_ptr, - arg_len, + aArgPtr, + aArgLen, ( SPINEL_DATATYPE_UINT32_S // Address SPINEL_DATATYPE_UINT16_S // Count @@ -2094,28 +2095,28 @@ otError NcpBase::CommandHandler_POKE(uint8_t header, unsigned int command, const ), &address, &count, - &data_ptr, - &data_len + &dataPtr, + &dataLen ); - VerifyOrExit(parsedLength == arg_len, spinel_error = SPINEL_STATUS_PARSE_ERROR); + VerifyOrExit(parsedLength == aArgLen, spinelError = SPINEL_STATUS_PARSE_ERROR); - VerifyOrExit(count != 0, spinel_error = SPINEL_STATUS_INVALID_ARGUMENT); - VerifyOrExit(count <= data_len, spinel_error = SPINEL_STATUS_INVALID_ARGUMENT); + VerifyOrExit(count != 0, spinelError = SPINEL_STATUS_INVALID_ARGUMENT); + VerifyOrExit(count <= dataLen, spinelError = SPINEL_STATUS_INVALID_ARGUMENT); if (mAllowPokeDelegate != NULL) { - VerifyOrExit(mAllowPokeDelegate(address, count), spinel_error = SPINEL_STATUS_INVALID_ARGUMENT); + VerifyOrExit(mAllowPokeDelegate(address, count), spinelError = SPINEL_STATUS_INVALID_ARGUMENT); } - memcpy(reinterpret_cast(address), data_ptr, count); + memcpy(reinterpret_cast(address), dataPtr, count); exit: - errorCode = SendLastStatus(header, spinel_error); + error = SendLastStatus(aHeader, spinelError); - (void)command; + (void)aCommand; - return errorCode; + return error; } #endif // OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE @@ -2125,17 +2126,17 @@ exit: // ---------------------------------------------------------------------------- -otError NcpBase::GetPropertyHandler_LAST_STATUS(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_LAST_STATUS(uint8_t aHeader, spinel_prop_key_t aKey) { - return SendPropertyUpdate(header, SPINEL_CMD_PROP_VALUE_IS, key, SPINEL_DATATYPE_UINT_PACKED_S, mLastStatus); + return SendPropertyUpdate(aHeader, SPINEL_CMD_PROP_VALUE_IS, aKey, SPINEL_DATATYPE_UINT_PACKED_S, mLastStatus); } -otError NcpBase::GetPropertyHandler_PROTOCOL_VERSION(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_PROTOCOL_VERSION(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, ( SPINEL_DATATYPE_UINT_PACKED_S // Major SPINEL_DATATYPE_UINT_PACKED_S // Minor @@ -2145,170 +2146,162 @@ otError NcpBase::GetPropertyHandler_PROTOCOL_VERSION(uint8_t header, spinel_prop ); } -otError NcpBase::GetPropertyHandler_INTERFACE_TYPE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_INTERFACE_TYPE(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_PROTOCOL_TYPE_THREAD ); } -otError NcpBase::GetPropertyHandler_VENDOR_ID(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_VENDOR_ID(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT_PACKED_S, 0 // Vendor ID. Zero for unknown. ); } -otError NcpBase::GetPropertyHandler_CAPS(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_CAPS(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); // Begin adding capabilities ////////////////////////////////////////////// - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_NET_THREAD_1_0)); - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_COUNTERS)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_NET_THREAD_1_0)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_COUNTERS)); #if OPENTHREAD_ENABLE_MAC_WHITELIST - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_MAC_WHITELIST)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_MAC_WHITELIST)); #endif #if OPENTHREAD_ENABLE_RAW_LINK_API - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_MAC_RAW)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_MAC_RAW)); #endif #if OPENTHREAD_ENABLE_JAM_DETECTION - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_JAM_DETECT)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_JAM_DETECT)); #endif #if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_OOB_STEERING_DATA)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_OOB_STEERING_DATA)); #endif #if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_PEEK_POKE)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_PEEK_POKE)); #endif // TODO: Somehow get the following capability from the radio. - SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_UINT_PACKED_S, - SPINEL_CAP_802_15_4_2450MHZ_OQPSK - )); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_802_15_4_2450MHZ_OQPSK)); #if OPENTHREAD_CONFIG_MAX_CHILDREN > 0 - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_ROLE_ROUTER)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_ROLE_ROUTER)); #endif #if OPENTHREAD_ENABLE_LEGACY - SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_UINT_PACKED_S, - SPINEL_CAP_NEST_LEGACY_INTERFACE - )); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_NEST_LEGACY_INTERFACE)); #endif #if OPENTHREAD_ENABLE_TMF_PROXY && OPENTHREAD_FTD - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_THREAD_TMF_PROXY)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT_PACKED_S, SPINEL_CAP_THREAD_TMF_PROXY)); #endif // End adding capabilities ///////////////////////////////////////////////// - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_NCP_VERSION(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NCP_VERSION(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UTF8_S, otGetVersionString() ); } -otError NcpBase::GetPropertyHandler_INTERFACE_COUNT(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_INTERFACE_COUNT(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, 1 // Only one interface for now ); } -otError NcpBase::GetPropertyHandler_POWER_STATE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_POWER_STATE(uint8_t aHeader, spinel_prop_key_t aKey) { // Always online at the moment return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, SPINEL_POWER_STATE_ONLINE ); } -otError NcpBase::GetPropertyHandler_HWADDR(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_HWADDR(uint8_t aHeader, spinel_prop_key_t aKey) { otExtAddress hwAddr; otLinkGetFactoryAssignedIeeeEui64(mInstance, &hwAddr); return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_EUI64_S, hwAddr.m8 ); } -otError NcpBase::GetPropertyHandler_LOCK(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_LOCK(uint8_t aHeader, spinel_prop_key_t aKey) { // TODO: Implement property lock (Needs API!) - (void)key; + (void)aKey; - return SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED); + return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } -otError NcpBase::GetPropertyHandler_HOST_POWER_STATE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_HOST_POWER_STATE(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, mHostPowerState ); } -otError NcpBase::GetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_PHY_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, #if OPENTHREAD_ENABLE_RAW_LINK_API otLinkRawIsEnabled(mInstance) @@ -2318,7 +2311,7 @@ otError NcpBase::GetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_ ); } -otError NcpBase::GetPropertyHandler_PHY_FREQ(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_PHY_FREQ(uint8_t aHeader, spinel_prop_key_t aKey) { uint32_t freq_khz(0); const uint8_t chan(otLinkGetChannel(mInstance)); @@ -2337,75 +2330,75 @@ otError NcpBase::GetPropertyHandler_PHY_FREQ(uint8_t header, spinel_prop_key_t k } return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT32_S, freq_khz ); } -otError NcpBase::GetPropertyHandler_PHY_CHAN_SUPPORTED(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_PHY_CHAN_SUPPORTED(uint8_t aHeader, spinel_prop_key_t aKey) { - return GetPropertyHandler_ChannelMaskHelper(header, key, mSupportedChannelMask); + return GetPropertyHandler_ChannelMaskHelper(aHeader, aKey, mSupportedChannelMask); } -otError NcpBase::GetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_PHY_CHAN(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otLinkGetChannel(mInstance) ); } -otError NcpBase::GetPropertyHandler_PHY_RSSI(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_PHY_RSSI(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_INT8_S, otPlatRadioGetRssi(mInstance) ); } -otError NcpBase::GetPropertyHandler_PHY_TX_POWER(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_PHY_TX_POWER(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_INT8_S, otLinkGetMaxTransmitPower(mInstance) ); } -otError NcpBase::GetPropertyHandler_PHY_RX_SENSITIVITY(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_PHY_RX_SENSITIVITY(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_INT8_S, otPlatRadioGetReceiveSensitivity(mInstance) ); } -otError NcpBase::GetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_SCAN_STATE(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; #if OPENTHREAD_ENABLE_RAW_LINK_API if (otLinkRawIsEnabled(mInstance)) { - errorCode = SendPropertyUpdate( - header, + error = SendPropertyUpdate( + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, mCurScanChannel == NCP_INVALID_SCAN_CHANNEL ? SPINEL_SCAN_STATE_IDLE @@ -2419,109 +2412,109 @@ otError NcpBase::GetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_prop_k { if (otLinkIsActiveScanInProgress(mInstance)) { - errorCode = SendPropertyUpdate( - header, + error = SendPropertyUpdate( + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, SPINEL_SCAN_STATE_BEACON ); } else if (otLinkIsEnergyScanInProgress(mInstance)) { - errorCode = SendPropertyUpdate( - header, + error = SendPropertyUpdate( + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, SPINEL_SCAN_STATE_ENERGY ); } else if (otThreadIsDiscoverInProgress(mInstance)) { - errorCode = SendPropertyUpdate( - header, + error = SendPropertyUpdate( + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, SPINEL_SCAN_STATE_DISCOVER ); } else { - errorCode = SendPropertyUpdate( - header, + error = SendPropertyUpdate( + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, SPINEL_SCAN_STATE_IDLE ); } } - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_MAC_SCAN_PERIOD(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_SCAN_PERIOD(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT16_S, mScanPeriod ); } -otError NcpBase::GetPropertyHandler_ChannelMaskHelper(uint8_t header, spinel_prop_key_t key, uint32_t channel_mask) +otError NcpBase::GetPropertyHandler_ChannelMaskHelper(uint8_t aHeader, spinel_prop_key_t aKey, uint32_t aChannelMask) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); for (int i = 0; i < 32; i++) { - if (0 != (channel_mask & (1 << i))) + if (0 != (aChannelMask & (1 << i))) { - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT8_S, i)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT8_S, i)); } } - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_MAC_SCAN_MASK(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_SCAN_MASK(uint8_t aHeader, spinel_prop_key_t aKey) { - return GetPropertyHandler_ChannelMaskHelper(header, key, mChannelMask); + return GetPropertyHandler_ChannelMaskHelper(aHeader, aKey, mChannelMask); } -otError NcpBase::GetPropertyHandler_MAC_15_4_PANID(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_15_4_PANID(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT16_S, otLinkGetPanId(mInstance) ); } -otError NcpBase::GetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_INT8_S, otPlatRadioGetPromiscuous(mInstance) ? SPINEL_MAC_PROMISCUOUS_MODE_FULL @@ -2529,84 +2522,84 @@ otError NcpBase::GetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t header, spinel_ ); } -otError NcpBase::GetPropertyHandler_MAC_15_4_LADDR(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_15_4_LADDR(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_EUI64_S, otLinkGetExtendedAddress(mInstance) ); } -otError NcpBase::GetPropertyHandler_MAC_15_4_SADDR(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_15_4_SADDR(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT16_S, otLinkGetShortAddress(mInstance) ); } -otError NcpBase::GetPropertyHandler_MAC_EXTENDED_ADDR(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_EXTENDED_ADDR(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_EUI64_S, otLinkGetExtendedAddress(mInstance) ); } -otError NcpBase::GetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, mIsRawStreamEnabled ); } -otError NcpBase::GetPropertyHandler_NET_SAVED(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_SAVED(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, otDatasetIsCommissioned(mInstance) ); } -otError NcpBase::GetPropertyHandler_NET_IF_UP(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_IF_UP(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, otIp6IsEnabled(mInstance) ); } -otError NcpBase::GetPropertyHandler_NET_STACK_UP(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_STACK_UP(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, otThreadGetDeviceRole(mInstance) != OT_DEVICE_ROLE_DISABLED ); } -otError NcpBase::GetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_ROLE(uint8_t aHeader, spinel_prop_key_t aKey) { spinel_net_role_t role(SPINEL_NET_ROLE_DETACHED); @@ -2631,333 +2624,333 @@ otError NcpBase::GetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key_t k } return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, role ); } -otError NcpBase::GetPropertyHandler_NET_NETWORK_NAME(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_NETWORK_NAME(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UTF8_S, otThreadGetNetworkName(mInstance) ); } -otError NcpBase::GetPropertyHandler_NET_XPANID(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_XPANID(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_DATA_S, otThreadGetExtendedPanId(mInstance), sizeof(spinel_net_xpanid_t) ); } -otError NcpBase::GetPropertyHandler_NET_MASTER_KEY(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_MASTER_KEY(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_DATA_S, otThreadGetMasterKey(mInstance)->m8, OT_MASTER_KEY_SIZE ); } -otError NcpBase::GetPropertyHandler_NET_KEY_SEQUENCE_COUNTER(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_KEY_SEQUENCE_COUNTER(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT32_S, otThreadGetKeySequenceCounter(mInstance) ); } -otError NcpBase::GetPropertyHandler_NET_PARTITION_ID(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_PARTITION_ID(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT32_S, otThreadGetPartitionId(mInstance) ); } -otError NcpBase::GetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT32_S, otThreadGetKeySwitchGuardTime(mInstance) ); } -otError NcpBase::GetPropertyHandler_THREAD_NETWORK_DATA_VERSION(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_NETWORK_DATA_VERSION(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otNetDataGetVersion(mInstance) ); } -otError NcpBase::GetPropertyHandler_THREAD_STABLE_NETWORK_DATA_VERSION(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_STABLE_NETWORK_DATA_VERSION(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otNetDataGetStableVersion(mInstance) ); } #if OPENTHREAD_ENABLE_BORDER_ROUTER -otError NcpBase::GetPropertyHandler_THREAD_NETWORK_DATA(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_NETWORK_DATA(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; - uint8_t network_data[255]; - uint8_t network_data_len = 255; + otError error = OT_ERROR_NONE; + uint8_t networkData[255]; + uint8_t networkDataLen = 255; otBorderRouterGetNetData( mInstance, false, // Stable? - network_data, - &network_data_len + networkData, + &networkDataLen ); - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); - SuccessOrExit(errorCode = OutboundFrameFeedData(network_data, network_data_len)); - SuccessOrExit(errorCode = OutboundFrameSend()); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); + SuccessOrExit(error = OutboundFrameFeedData(networkData, networkDataLen)); + SuccessOrExit(error = OutboundFrameSend()); exit: - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_THREAD_STABLE_NETWORK_DATA(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_STABLE_NETWORK_DATA(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; - uint8_t network_data[255]; - uint8_t network_data_len = 255; + otError error = OT_ERROR_NONE; + uint8_t networkData[255]; + uint8_t networkDataLen = 255; otBorderRouterGetNetData( mInstance, true, // Stable? - network_data, - &network_data_len + networkData, + &networkDataLen ); - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); - SuccessOrExit(errorCode = OutboundFrameFeedData(network_data, network_data_len)); - SuccessOrExit(errorCode = OutboundFrameSend()); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); + SuccessOrExit(error = OutboundFrameFeedData(networkData, networkDataLen)); + SuccessOrExit(error = OutboundFrameSend()); exit: - return errorCode; + return error; } #endif // OPENTHREAD_ENABLE_BORDER_ROUTER -otError NcpBase::GetPropertyHandler_THREAD_LEADER_NETWORK_DATA(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_LEADER_NETWORK_DATA(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; - uint8_t network_data[255]; - uint8_t network_data_len = 255; + otError error = OT_ERROR_NONE; + uint8_t networkData[255]; + uint8_t networkDataLen = 255; otNetDataGet( mInstance, false, // Stable? - network_data, - &network_data_len + networkData, + &networkDataLen ); - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); - SuccessOrExit(errorCode = OutboundFrameFeedData(network_data, network_data_len)); - SuccessOrExit(errorCode = OutboundFrameSend()); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); + SuccessOrExit(error = OutboundFrameFeedData(networkData, networkDataLen)); + SuccessOrExit(error = OutboundFrameSend()); exit: - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_THREAD_STABLE_LEADER_NETWORK_DATA(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_STABLE_LEADER_NETWORK_DATA(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; - uint8_t network_data[255]; - uint8_t network_data_len = 255; + otError error = OT_ERROR_NONE; + uint8_t networkData[255]; + uint8_t networkDataLen = 255; otNetDataGet( mInstance, true, // Stable? - network_data, - &network_data_len + networkData, + &networkDataLen ); - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); - SuccessOrExit(errorCode = OutboundFrameFeedData(network_data, network_data_len)); - SuccessOrExit(errorCode = OutboundFrameSend()); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); + SuccessOrExit(error = OutboundFrameFeedData(networkData, networkDataLen)); + SuccessOrExit(error = OutboundFrameSend()); exit: - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_THREAD_LEADER_RID(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_LEADER_RID(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otThreadGetLeaderRouterId(mInstance) ); } #if OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otThreadGetLocalLeaderWeight(mInstance) ); } #endif // OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_LEADER_WEIGHT(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otThreadGetLeaderWeight(mInstance) ); } -otError NcpBase::GetPropertyHandler_THREAD_LEADER_ADDR(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_LEADER_ADDR(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; otIp6Address address; - errorCode = otThreadGetLeaderRloc(mInstance, &address); + error = otThreadGetLeaderRloc(mInstance, &address); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - SPINEL_DATATYPE_IPv6ADDR_S, - &address - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + SPINEL_DATATYPE_IPv6ADDR_S, + &address + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_THREAD_PARENT(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_PARENT(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; otRouterInfo parentInfo; - errorCode = otThreadGetParentInfo(mInstance, &parentInfo); + error = otThreadGetParentInfo(mInstance, &parentInfo); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - ( - SPINEL_DATATYPE_EUI64_S // Parent's extended address - SPINEL_DATATYPE_UINT16_S // Parent's rloc16 - ), - parentInfo.mExtAddress.m8, - parentInfo.mRloc16 - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + ( + SPINEL_DATATYPE_EUI64_S // Parent's extended address + SPINEL_DATATYPE_UINT16_S // Parent's rloc16 + ), + parentInfo.mExtAddress.m8, + parentInfo.mRloc16 + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - return errorCode; + return error; } #if OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_CHILD_TABLE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_CHILD_TABLE(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; otChildInfo childInfo; uint8_t maxChildren; uint8_t modeFlags; mDisableStreamWrite = true; - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); maxChildren = otThreadGetMaxAllowedChildren(mInstance); for (uint8_t index = 0; index < maxChildren; index++) { - errorCode = otThreadGetChildInfoByIndex(mInstance, index, &childInfo); + error = otThreadGetChildInfoByIndex(mInstance, index, &childInfo); - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { continue; } @@ -2985,50 +2978,50 @@ otError NcpBase::GetPropertyHandler_THREAD_CHILD_TABLE(uint8_t header, spinel_pr } SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_STRUCT_S( - 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) - SPINEL_DATATYPE_INT8_S // Most recent RSS - ), - childInfo.mExtAddress.m8, - childInfo.mRloc16, - childInfo.mTimeout, - childInfo.mAge, - childInfo.mNetworkDataVersion, - childInfo.mLinkQualityIn, - childInfo.mAverageRssi, - modeFlags, - childInfo.mLastRssi - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_STRUCT_S( + 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) + SPINEL_DATATYPE_INT8_S // Most recent RSS + ), + childInfo.mExtAddress.m8, + childInfo.mRloc16, + childInfo.mTimeout, + childInfo.mAge, + childInfo.mNetworkDataVersion, + childInfo.mLinkQualityIn, + childInfo.mAverageRssi, + modeFlags, + childInfo.mLastRssi + )); } - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: mDisableStreamWrite = false; - return errorCode; + return error; } #endif // OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_NEIGHBOR_TABLE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_NEIGHBOR_TABLE(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; otNeighborInfoIterator iter = OT_NEIGHBOR_INFO_ITERATOR_INIT; otNeighborInfo neighInfo; uint8_t modeFlags; mDisableStreamWrite = true; - SuccessOrExit(errorCode = OutboundFrameBegin()); - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_COMMAND_PROP_S, header, SPINEL_CMD_PROP_VALUE_IS, - key)); + SuccessOrExit(error = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_COMMAND_PROP_S, aHeader, SPINEL_CMD_PROP_VALUE_IS, + aKey)); while (otThreadGetNextNeighborInfo(mInstance, &iter, &neighInfo) == OT_ERROR_NONE) { @@ -3055,448 +3048,448 @@ otError NcpBase::GetPropertyHandler_THREAD_NEIGHBOR_TABLE(uint8_t header, spinel } SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_STRUCT_S( - SPINEL_DATATYPE_EUI64_S // EUI64 Address - SPINEL_DATATYPE_UINT16_S // Rloc16 - SPINEL_DATATYPE_UINT32_S // Age - SPINEL_DATATYPE_UINT8_S // Link Quality In - SPINEL_DATATYPE_INT8_S // Average RSS - SPINEL_DATATYPE_UINT8_S // Mode (flags) - SPINEL_DATATYPE_BOOL_S // Is Child - SPINEL_DATATYPE_UINT32_S // Link Frame Counter - SPINEL_DATATYPE_UINT32_S // MLE Frame Counter - SPINEL_DATATYPE_INT8_S // Most recent RSS - ), - neighInfo.mExtAddress.m8, - neighInfo.mRloc16, - neighInfo.mAge, - neighInfo.mLinkQualityIn, - neighInfo.mAverageRssi, - modeFlags, - neighInfo.mIsChild, - neighInfo.mLinkFrameCounter, - neighInfo.mMleFrameCounter, - neighInfo.mLastRssi - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_STRUCT_S( + SPINEL_DATATYPE_EUI64_S // EUI64 Address + SPINEL_DATATYPE_UINT16_S // Rloc16 + SPINEL_DATATYPE_UINT32_S // Age + SPINEL_DATATYPE_UINT8_S // Link Quality In + SPINEL_DATATYPE_INT8_S // Average RSS + SPINEL_DATATYPE_UINT8_S // Mode (flags) + SPINEL_DATATYPE_BOOL_S // Is Child + SPINEL_DATATYPE_UINT32_S // Link Frame Counter + SPINEL_DATATYPE_UINT32_S // MLE Frame Counter + SPINEL_DATATYPE_INT8_S // Most recent RSS + ), + neighInfo.mExtAddress.m8, + neighInfo.mRloc16, + neighInfo.mAge, + neighInfo.mLinkQualityIn, + neighInfo.mAverageRssi, + modeFlags, + neighInfo.mIsChild, + neighInfo.mLinkFrameCounter, + neighInfo.mMleFrameCounter, + neighInfo.mLastRssi + )); } - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: mDisableStreamWrite = false; - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; - uint8_t num_entries = 0; - const uint16_t *ports = otIp6GetUnsecurePorts(mInstance, &num_entries); + otError error = OT_ERROR_NONE; + uint8_t numEntries = 0; + const uint16_t *ports = otIp6GetUnsecurePorts(mInstance, &numEntries); - SuccessOrExit(errorCode = OutboundFrameBegin()); - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_COMMAND_PROP_S, header, SPINEL_CMD_PROP_VALUE_IS, - key)); + SuccessOrExit(error = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_COMMAND_PROP_S, aHeader, SPINEL_CMD_PROP_VALUE_IS, + aKey)); - for (; num_entries != 0; ports++, num_entries--) + for (; numEntries != 0; ports++, numEntries--) { - SuccessOrExit(errorCode = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT16_S, *ports)); + SuccessOrExit(error = OutboundFrameFeedPacked(SPINEL_DATATYPE_UINT16_S, *ports)); } - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, mAllowLocalNetworkDataChange ); } #if OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, otThreadIsRouterRoleEnabled(mInstance) ); } #endif // OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_ON_MESH_NETS(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; - otBorderRouterConfig border_router_config; + otError error = OT_ERROR_NONE; + otBorderRouterConfig borderRouterConfig; uint8_t flags; mDisableStreamWrite = true; - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); // Fill from non-local network data first for (otNetworkDataIterator iter = OT_NETWORK_DATA_ITERATOR_INIT ;;) { - errorCode = otNetDataGetNextOnMeshPrefix(mInstance, &iter, &border_router_config); + error = otNetDataGetNextOnMeshPrefix(mInstance, &iter, &borderRouterConfig); - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { break; } - flags = BorderRouterConfigToFlagByte(border_router_config); + flags = BorderRouterConfigToFlagByte(borderRouterConfig); - SuccessOrExit(errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_STRUCT_S( - SPINEL_DATATYPE_IPv6ADDR_S // IPv6 Prefix - SPINEL_DATATYPE_UINT8_S // Prefix Length (in bits) - SPINEL_DATATYPE_BOOL_S // isStable - SPINEL_DATATYPE_UINT8_S // Flags - SPINEL_DATATYPE_BOOL_S // isLocal - ), - &border_router_config.mPrefix, - 64, - border_router_config.mStable, - flags, - false - )); + SuccessOrExit(error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_STRUCT_S( + SPINEL_DATATYPE_IPv6ADDR_S // IPv6 Prefix + SPINEL_DATATYPE_UINT8_S // Prefix Length (in bits) + SPINEL_DATATYPE_BOOL_S // isStable + SPINEL_DATATYPE_UINT8_S // Flags + SPINEL_DATATYPE_BOOL_S // isLocal + ), + &borderRouterConfig.mPrefix, + 64, + borderRouterConfig.mStable, + flags, + false + )); } #if OPENTHREAD_ENABLE_BORDER_ROUTER // Fill from local network data last for (otNetworkDataIterator iter = OT_NETWORK_DATA_ITERATOR_INIT ;;) { - errorCode = otBorderRouterGetNextOnMeshPrefix(mInstance, &iter, &border_router_config); + error = otBorderRouterGetNextOnMeshPrefix(mInstance, &iter, &borderRouterConfig); - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { break; } - flags = BorderRouterConfigToFlagByte(border_router_config); + flags = BorderRouterConfigToFlagByte(borderRouterConfig); - SuccessOrExit(errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_STRUCT_S( - SPINEL_DATATYPE_IPv6ADDR_S // IPv6 Prefix - SPINEL_DATATYPE_UINT8_S // Prefix Length (in bits) - SPINEL_DATATYPE_BOOL_S // isStable - SPINEL_DATATYPE_UINT8_S // Flags - SPINEL_DATATYPE_BOOL_S // isLocal - ), - &border_router_config.mPrefix, - 64, - border_router_config.mStable, - flags, - true - )); + SuccessOrExit(error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_STRUCT_S( + SPINEL_DATATYPE_IPv6ADDR_S // IPv6 Prefix + SPINEL_DATATYPE_UINT8_S // Prefix Length (in bits) + SPINEL_DATATYPE_BOOL_S // isStable + SPINEL_DATATYPE_UINT8_S // Flags + SPINEL_DATATYPE_BOOL_S // isLocal + ), + &borderRouterConfig.mPrefix, + 64, + borderRouterConfig.mStable, + flags, + true + )); } #endif // OPENTHREAD_ENABLE_BORDER_ROUTER - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: mDisableStreamWrite = false; - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_THREAD_DISCOVERY_SCAN_JOINER_FLAG(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_DISCOVERY_SCAN_JOINER_FLAG(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, mDiscoveryScanJoinerFlag ); } -otError NcpBase::GetPropertyHandler_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, mDiscoveryScanEnableFiltering ); } -otError NcpBase::GetPropertyHandler_THREAD_DISCOVERY_SCAN_PANID(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_DISCOVERY_SCAN_PANID(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT16_S, mDiscoveryScanPanId ); } -otError NcpBase::GetPropertyHandler_IPV6_ML_PREFIX(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_IPV6_ML_PREFIX(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; - const uint8_t *ml_prefix = otThreadGetMeshLocalPrefix(mInstance); + otError error = OT_ERROR_NONE; + const uint8_t *mlPrefix = otThreadGetMeshLocalPrefix(mInstance); - if (ml_prefix) + if (mlPrefix) { otIp6Address addr; - memcpy(addr.mFields.m8, ml_prefix, 8); + memcpy(addr.mFields.m8, mlPrefix, 8); // Zero out the last 8 bytes. memset(addr.mFields.m8 + 8, 0, 8); - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - ( - SPINEL_DATATYPE_IPv6ADDR_S // Mesh-local IPv6 address - SPINEL_DATATYPE_UINT8_S // Prefix length (in bits) - ), - &addr, - 64 - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + ( + SPINEL_DATATYPE_IPv6ADDR_S // Mesh-local IPv6 address + SPINEL_DATATYPE_UINT8_S // Prefix length (in bits) + ), + &addr, + 64 + ); } else { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - SPINEL_DATATYPE_VOID_S - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + SPINEL_DATATYPE_VOID_S + ); } - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_IPV6_ML_ADDR(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_IPV6_ML_ADDR(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; const otIp6Address *ml64 = otThreadGetMeshLocalEid(mInstance); if (ml64) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - SPINEL_DATATYPE_IPv6ADDR_S, - ml64 - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + SPINEL_DATATYPE_IPv6ADDR_S, + ml64 + ); } else { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - SPINEL_DATATYPE_VOID_S - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + SPINEL_DATATYPE_VOID_S + ); } - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_IPV6_LL_ADDR(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_IPV6_LL_ADDR(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; const otIp6Address *address = otThreadGetLinkLocalIp6Address(mInstance); if (address) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - SPINEL_DATATYPE_IPv6ADDR_S, - address - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + SPINEL_DATATYPE_IPv6ADDR_S, + address + ); } else { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - SPINEL_DATATYPE_VOID_S - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + SPINEL_DATATYPE_VOID_S + ); } - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; mDisableStreamWrite = true; - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); for (const otNetifAddress *address = otIp6GetUnicastAddresses(mInstance); address; address = address->mNext) { SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_STRUCT_S( - SPINEL_DATATYPE_IPv6ADDR_S // IPv6 address - SPINEL_DATATYPE_UINT8_S // Prefix length (in bits) - SPINEL_DATATYPE_UINT32_S // Preferred lifetime - SPINEL_DATATYPE_UINT32_S // Valid lifetime - ), - &address->mAddress, - address->mPrefixLength, - address->mPreferred ? 0xffffffff : 0, - address->mValid ? 0xffffffff : 0 - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_STRUCT_S( + SPINEL_DATATYPE_IPv6ADDR_S // IPv6 address + SPINEL_DATATYPE_UINT8_S // Prefix length (in bits) + SPINEL_DATATYPE_UINT32_S // Preferred lifetime + SPINEL_DATATYPE_UINT32_S // Valid lifetime + ), + &address->mAddress, + address->mPrefixLength, + address->mPreferred ? 0xffffffff : 0, + address->mValid ? 0xffffffff : 0 + )); } - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: mDisableStreamWrite = false; - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_IPV6_ROUTE_TABLE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_IPV6_ROUTE_TABLE(uint8_t aHeader, spinel_prop_key_t aKey) { // TODO: Implement get route table - (void)key; + (void)aKey; - return SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED); + return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } -otError NcpBase::GetPropertyHandler_IPV6_ICMP_PING_OFFLOAD(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_IPV6_ICMP_PING_OFFLOAD(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, otIcmp6IsEchoEnabled(mInstance) ); } -otError NcpBase::GetPropertyHandler_THREAD_RLOC16_DEBUG_PASSTHRU(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_RLOC16_DEBUG_PASSTHRU(uint8_t aHeader, spinel_prop_key_t aKey) { // Note reverse logic: passthru enabled = filter disabled return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, !otIp6IsReceiveFilterEnabled(mInstance) ); } -otError NcpBase::GetPropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; otExternalRouteConfig external_route_config; otNetworkDataIterator iter = OT_NETWORK_DATA_ITERATOR_INIT; mDisableStreamWrite = true; - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); while (otNetDataGetNextRoute(mInstance, &iter, &external_route_config) == OT_ERROR_NONE) { SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_STRUCT_S( - SPINEL_DATATYPE_IPv6ADDR_S // IPv6 Prefix - SPINEL_DATATYPE_UINT8_S // Prefix Length (in bits) - SPINEL_DATATYPE_BOOL_S // IsStable - SPINEL_DATATYPE_UINT8_S // Route Preference Flags - SPINEL_DATATYPE_BOOL_S // IsLocal - SPINEL_DATATYPE_BOOL_S // NextHopIsThisDevice - ), - &external_route_config.mPrefix.mPrefix, - external_route_config.mPrefix.mLength, - external_route_config.mStable, - ExternalRoutePreferenceToFlagByte(external_route_config.mPreference), - false, - external_route_config.mNextHopIsThisDevice - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_STRUCT_S( + SPINEL_DATATYPE_IPv6ADDR_S // IPv6 Prefix + SPINEL_DATATYPE_UINT8_S // Prefix Length (in bits) + SPINEL_DATATYPE_BOOL_S // IsStable + SPINEL_DATATYPE_UINT8_S // Route Preference Flags + SPINEL_DATATYPE_BOOL_S // IsLocal + SPINEL_DATATYPE_BOOL_S // NextHopIsThisDevice + ), + &external_route_config.mPrefix.mPrefix, + external_route_config.mPrefix.mLength, + external_route_config.mStable, + ExternalRoutePreferenceToFlagByte(external_route_config.mPreference), + false, + external_route_config.mNextHopIsThisDevice + )); } #if OPENTHREAD_ENABLE_BORDER_ROUTER while (otBorderRouterGetNextRoute(mInstance, &iter, &external_route_config) == OT_ERROR_NONE) { SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_STRUCT_S( - SPINEL_DATATYPE_IPv6ADDR_S // IPv6 Prefix - SPINEL_DATATYPE_UINT8_S // Prefix Length (in bits) - SPINEL_DATATYPE_BOOL_S // IsStable - SPINEL_DATATYPE_UINT8_S // Route Preference Flags - SPINEL_DATATYPE_BOOL_S // IsLocal - SPINEL_DATATYPE_BOOL_S // NextHopIsThisDevice - ), - &external_route_config.mPrefix.mPrefix, - external_route_config.mPrefix.mLength, - external_route_config.mStable, - ExternalRoutePreferenceToFlagByte(external_route_config.mPreference), - true, - external_route_config.mNextHopIsThisDevice - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_STRUCT_S( + SPINEL_DATATYPE_IPv6ADDR_S // IPv6 Prefix + SPINEL_DATATYPE_UINT8_S // Prefix Length (in bits) + SPINEL_DATATYPE_BOOL_S // IsStable + SPINEL_DATATYPE_UINT8_S // Route Preference Flags + SPINEL_DATATYPE_BOOL_S // IsLocal + SPINEL_DATATYPE_BOOL_S // NextHopIsThisDevice + ), + &external_route_config.mPrefix.mPrefix, + external_route_config.mPrefix.mLength, + external_route_config.mStable, + ExternalRoutePreferenceToFlagByte(external_route_config.mPreference), + true, + external_route_config.mNextHopIsThisDevice + )); } #endif // OPENTHREAD_ENABLE_BORDER_ROUTER - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: mDisableStreamWrite = false; - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_STREAM_NET(uint8_t aHeader, spinel_prop_key_t aKey) { // TODO: Implement explicit data poll. - (void)key; + (void)aKey; - return SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED); + return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } #if OPENTHREAD_ENABLE_TMF_PROXY && OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_TMF_PROXY_ENABLED(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_TMF_PROXY_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, otTmfProxyIsEnabled(mInstance) ); @@ -3505,69 +3498,69 @@ otError NcpBase::GetPropertyHandler_TMF_PROXY_ENABLED(uint8_t header, spinel_pro #if OPENTHREAD_ENABLE_JAM_DETECTION -otError NcpBase::GetPropertyHandler_JAM_DETECT_ENABLE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_JAM_DETECT_ENABLE(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, otJamDetectionIsEnabled(mInstance) ); } -otError NcpBase::GetPropertyHandler_JAM_DETECTED(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_JAM_DETECTED(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, otJamDetectionGetState(mInstance) ); } -otError NcpBase::GetPropertyHandler_JAM_DETECT_RSSI_THRESHOLD(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_JAM_DETECT_RSSI_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_INT8_S, otJamDetectionGetRssiThreshold(mInstance) ); } -otError NcpBase::GetPropertyHandler_JAM_DETECT_WINDOW(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_JAM_DETECT_WINDOW(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otJamDetectionGetWindow(mInstance) ); } -otError NcpBase::GetPropertyHandler_JAM_DETECT_BUSY(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_JAM_DETECT_BUSY(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otJamDetectionGetBusyPeriod(mInstance) ); } -otError NcpBase::GetPropertyHandler_JAM_DETECT_HISTORY_BITMAP(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_JAM_DETECT_HISTORY_BITMAP(uint8_t aHeader, spinel_prop_key_t aKey) { uint64_t historyBitmap = otJamDetectionGetHistoryBitmap(mInstance); return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, ( SPINEL_DATATYPE_UINT32_S // History bitmap - bits 0-31 SPINEL_DATATYPE_UINT32_S // History bitmap - bits 32-63 @@ -3579,17 +3572,17 @@ otError NcpBase::GetPropertyHandler_JAM_DETECT_HISTORY_BITMAP(uint8_t header, sp #endif // OPENTHREAD_ENABLE_JAM_DETECTION -otError NcpBase::GetPropertyHandler_MAC_CNTR(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_CNTR(uint8_t aHeader, spinel_prop_key_t aKey) { uint32_t value; const otMacCounters *macCounters; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; macCounters = otLinkGetCounters(mInstance); assert(macCounters != NULL); - switch (key) + switch (aKey) { case SPINEL_PROP_CNTR_TX_PKT_TOTAL: value = macCounters->mTxTotal; @@ -3716,29 +3709,29 @@ otError NcpBase::GetPropertyHandler_MAC_CNTR(uint8_t header, spinel_prop_key_t k break; default: - errorCode = SendLastStatus(header, SPINEL_STATUS_INTERNAL_ERROR); - goto bail; + error = SendLastStatus(aHeader, SPINEL_STATUS_INTERNAL_ERROR); + ExitNow(); break; } - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - SPINEL_DATATYPE_UINT32_S, - value - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + SPINEL_DATATYPE_UINT32_S, + value + ); -bail: - return errorCode; +exit: + return error; } -otError NcpBase::GetPropertyHandler_NCP_CNTR(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NCP_CNTR(uint8_t aHeader, spinel_prop_key_t aKey) { uint32_t value; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - switch (key) + switch (aKey) { case SPINEL_PROP_CNTR_TX_IP_SEC_TOTAL: value = mInboundSecureIpFrameCounter; @@ -3781,31 +3774,31 @@ otError NcpBase::GetPropertyHandler_NCP_CNTR(uint8_t header, spinel_prop_key_t k break; default: - errorCode = SendLastStatus(header, SPINEL_STATUS_INTERNAL_ERROR); - goto bail; + error = SendLastStatus(aHeader, SPINEL_STATUS_INTERNAL_ERROR); + ExitNow(); break; } - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - SPINEL_DATATYPE_UINT32_S, - value - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + SPINEL_DATATYPE_UINT32_S, + value + ); -bail: - return errorCode; +exit: + return error; } -otError NcpBase::GetPropertyHandler_IP_CNTR(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_IP_CNTR(uint8_t aHeader, spinel_prop_key_t aKey) { uint32_t value; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; const otIpCounters *counters = otThreadGetIp6Counters(mInstance); - switch (key) + switch (aKey) { case SPINEL_PROP_CNTR_IP_TX_SUCCESS: value = counters->mTxSuccess; @@ -3824,84 +3817,84 @@ otError NcpBase::GetPropertyHandler_IP_CNTR(uint8_t header, spinel_prop_key_t ke break; default: - errorCode = SendLastStatus(header, SPINEL_STATUS_INTERNAL_ERROR); - goto bail; + error = SendLastStatus(aHeader, SPINEL_STATUS_INTERNAL_ERROR); + ExitNow(); break; } - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_IS, - key, - SPINEL_DATATYPE_UINT32_S, - value - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey, + SPINEL_DATATYPE_UINT32_S, + value + ); -bail: - return errorCode; +exit: + return error; } -otError NcpBase::GetPropertyHandler_MSG_BUFFER_COUNTERS(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MSG_BUFFER_COUNTERS(uint8_t aHeader, spinel_prop_key_t aKey) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; otBufferInfo bufferInfo; otMessageGetBufferInfo(mInstance, &bufferInfo); - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - ( - SPINEL_DATATYPE_UINT16_S // Total buffers - SPINEL_DATATYPE_UINT16_S // Free buffers - SPINEL_DATATYPE_UINT16_S // Lowpan send messages - SPINEL_DATATYPE_UINT16_S // Lowpan send buffers - SPINEL_DATATYPE_UINT16_S // Lowpan reassembly messages - SPINEL_DATATYPE_UINT16_S // Lowpan reassembly buffers - SPINEL_DATATYPE_UINT16_S // Ip6 messages - SPINEL_DATATYPE_UINT16_S // Ip6 buffers - SPINEL_DATATYPE_UINT16_S // Mpl messages - SPINEL_DATATYPE_UINT16_S // Mpl buffers - SPINEL_DATATYPE_UINT16_S // Mle messages - SPINEL_DATATYPE_UINT16_S // Mle buffers - SPINEL_DATATYPE_UINT16_S // Arp messages - SPINEL_DATATYPE_UINT16_S // Arp buffers - SPINEL_DATATYPE_UINT16_S // Coap messages - SPINEL_DATATYPE_UINT16_S // Coap buffers - ), - bufferInfo.mTotalBuffers, - bufferInfo.mFreeBuffers, - bufferInfo.m6loSendMessages, - bufferInfo.m6loSendBuffers, - bufferInfo.m6loReassemblyMessages, - bufferInfo.m6loReassemblyBuffers, - bufferInfo.mIp6Messages, - bufferInfo.mIp6Buffers, - bufferInfo.mMplMessages, - bufferInfo.mMplBuffers, - bufferInfo.mMleMessages, - bufferInfo.mMleBuffers, - bufferInfo.mArpMessages, - bufferInfo.mArpBuffers, - bufferInfo.mCoapMessages, - bufferInfo.mCoapBuffers - )); + error = OutboundFrameFeedPacked( + ( + SPINEL_DATATYPE_UINT16_S // Total buffers + SPINEL_DATATYPE_UINT16_S // Free buffers + SPINEL_DATATYPE_UINT16_S // Lowpan send messages + SPINEL_DATATYPE_UINT16_S // Lowpan send buffers + SPINEL_DATATYPE_UINT16_S // Lowpan reassembly messages + SPINEL_DATATYPE_UINT16_S // Lowpan reassembly buffers + SPINEL_DATATYPE_UINT16_S // Ip6 messages + SPINEL_DATATYPE_UINT16_S // Ip6 buffers + SPINEL_DATATYPE_UINT16_S // Mpl messages + SPINEL_DATATYPE_UINT16_S // Mpl buffers + SPINEL_DATATYPE_UINT16_S // Mle messages + SPINEL_DATATYPE_UINT16_S // Mle buffers + SPINEL_DATATYPE_UINT16_S // Arp messages + SPINEL_DATATYPE_UINT16_S // Arp buffers + SPINEL_DATATYPE_UINT16_S // Coap messages + SPINEL_DATATYPE_UINT16_S // Coap buffers + ), + bufferInfo.mTotalBuffers, + bufferInfo.mFreeBuffers, + bufferInfo.m6loSendMessages, + bufferInfo.m6loSendBuffers, + bufferInfo.m6loReassemblyMessages, + bufferInfo.m6loReassemblyBuffers, + bufferInfo.mIp6Messages, + bufferInfo.mIp6Buffers, + bufferInfo.mMplMessages, + bufferInfo.mMplBuffers, + bufferInfo.mMleMessages, + bufferInfo.mMleBuffers, + bufferInfo.mArpMessages, + bufferInfo.mArpBuffers, + bufferInfo.mCoapMessages, + bufferInfo.mCoapBuffers + )); - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_DEBUG_TEST_ASSERT(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_DEBUG_TEST_ASSERT(uint8_t aHeader, spinel_prop_key_t aKey) { assert(false); @@ -3911,15 +3904,15 @@ otError NcpBase::GetPropertyHandler_DEBUG_TEST_ASSERT(uint8_t header, spinel_pro // property value to indicate this. return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, false ); } -otError NcpBase::GetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t aHeader, spinel_prop_key_t aKey) { uint8_t logLevel = 0; @@ -3947,9 +3940,9 @@ otError NcpBase::GetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_p } return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, logLevel ); @@ -3957,27 +3950,27 @@ otError NcpBase::GetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_p #if OPENTHREAD_ENABLE_MAC_WHITELIST -otError NcpBase::GetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_WHITELIST(uint8_t aHeader, spinel_prop_key_t aKey) { otMacWhitelistEntry entry; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; mDisableStreamWrite = true; - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); - for (uint8_t i = 0; (i != 255) && (errorCode == OT_ERROR_NONE); i++) + for (uint8_t i = 0; (i != 255) && (error == OT_ERROR_NONE); i++) { - errorCode = otLinkGetWhitelistEntry(mInstance, i, &entry); + error = otLinkGetWhitelistEntry(mInstance, i, &entry); - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { break; } @@ -3990,56 +3983,56 @@ otError NcpBase::GetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_ke } SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_STRUCT_S( - SPINEL_DATATYPE_EUI64_S // Extended address - SPINEL_DATATYPE_INT8_S // Rssi - ), - entry.mExtAddress.m8, - entry.mRssi - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_STRUCT_S( + SPINEL_DATATYPE_EUI64_S // Extended address + SPINEL_DATATYPE_INT8_S // Rssi + ), + entry.mExtAddress.m8, + entry.mRssi + )); } } - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: mDisableStreamWrite = false; - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, otLinkIsWhitelistEnabled(mInstance) ); } -otError NcpBase::GetPropertyHandler_MAC_BLACKLIST(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_BLACKLIST(uint8_t aHeader, spinel_prop_key_t aKey) { otMacBlacklistEntry entry; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; mDisableStreamWrite = true; - SuccessOrExit(errorCode = OutboundFrameBegin()); + SuccessOrExit(error = OutboundFrameBegin()); SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_COMMAND_PROP_S, - header, - SPINEL_CMD_PROP_VALUE_IS, - key - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_COMMAND_PROP_S, + aHeader, + SPINEL_CMD_PROP_VALUE_IS, + aKey + )); - for (uint8_t i = 0; (i != 255) && (errorCode == OT_ERROR_NONE); i++) + for (uint8_t i = 0; (i != 255) && (error == OT_ERROR_NONE); i++) { - errorCode = otLinkGetBlacklistEntry(mInstance, i, &entry); + error = otLinkGetBlacklistEntry(mInstance, i, &entry); - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { break; } @@ -4047,28 +4040,28 @@ otError NcpBase::GetPropertyHandler_MAC_BLACKLIST(uint8_t header, spinel_prop_ke if (entry.mValid) { SuccessOrExit( - errorCode = OutboundFrameFeedPacked( - SPINEL_DATATYPE_STRUCT_S( - SPINEL_DATATYPE_EUI64_S // Extended address - ), - entry.mExtAddress.m8 - )); + error = OutboundFrameFeedPacked( + SPINEL_DATATYPE_STRUCT_S( + SPINEL_DATATYPE_EUI64_S // Extended address + ), + entry.mExtAddress.m8 + )); } } - SuccessOrExit(errorCode = OutboundFrameSend()); + SuccessOrExit(error = OutboundFrameSend()); exit: mDisableStreamWrite = false; - return errorCode; + return error; } -otError NcpBase::GetPropertyHandler_MAC_BLACKLIST_ENABLED(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_MAC_BLACKLIST_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, otLinkIsBlacklistEnabled(mInstance) ); @@ -4078,12 +4071,12 @@ otError NcpBase::GetPropertyHandler_MAC_BLACKLIST_ENABLED(uint8_t header, spinel #endif // OPENTHREAD_ENABLE_MAC_WHITELIST #if OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_NET_PSKC(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_PSKC(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_DATA_S, otThreadGetPSKc(mInstance), sizeof(spinel_net_pskc_t) @@ -4091,126 +4084,126 @@ otError NcpBase::GetPropertyHandler_NET_PSKC(uint8_t header, spinel_prop_key_t k } #endif // OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_MODE(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_MODE(uint8_t aHeader, spinel_prop_key_t aKey) { - uint8_t numeric_mode(0); - otLinkModeConfig mode_config(otThreadGetLinkMode(mInstance)); + uint8_t numericMode = 0; + otLinkModeConfig modeConfig = otThreadGetLinkMode(mInstance); - if (mode_config.mRxOnWhenIdle) + if (modeConfig.mRxOnWhenIdle) { - numeric_mode |= kThreadMode_RxOnWhenIdle; + numericMode |= kThreadMode_RxOnWhenIdle; } - if (mode_config.mSecureDataRequests) + if (modeConfig.mSecureDataRequests) { - numeric_mode |= kThreadMode_SecureDataRequest; + numericMode |= kThreadMode_SecureDataRequest; } - if (mode_config.mDeviceType) + if (modeConfig.mDeviceType) { - numeric_mode |= kThreadMode_FullFunctionDevice; + numericMode |= kThreadMode_FullFunctionDevice; } - if (mode_config.mNetworkData) + if (modeConfig.mNetworkData) { - numeric_mode |= kThreadMode_FullNetworkData; + numericMode |= kThreadMode_FullNetworkData; } return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, - numeric_mode + numericMode ); } #if OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otThreadGetMaxAllowedChildren(mInstance) ); } #endif // OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT32_S, otThreadGetChildTimeout(mInstance) ); } -otError NcpBase::GetPropertyHandler_THREAD_RLOC16(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_RLOC16(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT16_S, otThreadGetRloc16(mInstance) ); } #if OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otThreadGetRouterUpgradeThreshold(mInstance) ); } -otError NcpBase::GetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otThreadGetRouterDowngradeThreshold(mInstance) ); } -otError NcpBase::GetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otThreadGetRouterSelectionJitter(mInstance) ); } -otError NcpBase::GetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT32_S, otThreadGetContextIdReuseDelay(mInstance) ); } -otError NcpBase::GetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, otThreadGetNetworkIdTimeout(mInstance) ); @@ -4218,43 +4211,43 @@ otError NcpBase::GetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t header, sp #endif // OPENTHREAD_FTD #if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD -otError NcpBase::GetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey) { - bool isEnabled = false; + bool enabled = false; if (otCommissionerGetState(mInstance) == OT_COMMISSIONER_STATE_ACTIVE) { - isEnabled = true; + enabled = true; } return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, - isEnabled + enabled ); } #endif -otError NcpBase::GetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_BOOL_S, mRequireJoinExistingNetwork ); } #if OPENTHREAD_ENABLE_LEGACY -otError NcpBase::GetPropertyHandler_NEST_LEGACY_ULA_PREFIX(uint8_t header, spinel_prop_key_t key) +otError NcpBase::GetPropertyHandler_NEST_LEGACY_ULA_PREFIX(uint8_t aHeader, spinel_prop_key_t aKey) { return SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_DATA_S, mLegacyUlaPrefix, sizeof(mLegacyUlaPrefix) @@ -4280,27 +4273,27 @@ otError NcpBase::SendSetPropertyResponse(uint8_t aHeader, spinel_prop_key_t aKey return aError; } -otError NcpBase::SetPropertyHandler_POWER_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_POWER_STATE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { // TODO: Implement POWER_STATE - (void)key; - (void)value_ptr; - (void)value_len; + (void)aKey; + (void)aValuePtr; + (void)aValueLen; - return SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED); + return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } -otError NcpBase::SetPropertyHandler_HOST_POWER_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_HOST_POWER_STATE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { uint8_t value; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &value ); @@ -4330,18 +4323,18 @@ otError NcpBase::SetPropertyHandler_HOST_POWER_STATE(uint8_t header, spinel_prop } else { - errorCode = OT_ERROR_PARSE; + error = OT_ERROR_PARSE; } - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { mHostPowerStateHeader = 0; - errorCode = HandleCommandPropertyGet(header, key); + error = HandleCommandPropertyGet(aHeader, aKey); if (mHostPowerState != SPINEL_HOST_POWER_STATE_ONLINE) { - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { mHostPowerReplyFrameTag = GetLastOutboundFrameTag(); } @@ -4353,42 +4346,42 @@ otError NcpBase::SetPropertyHandler_HOST_POWER_STATE(uint8_t header, spinel_prop mHostPowerStateInProgress = true; } - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { - mHostPowerStateHeader = header; + mHostPowerStateHeader = aHeader; // The reply will be queued when buffer space becomes available // in the NCP tx buffer so we return `success` to avoid sending a // NOMEM status for the same tid through `mDroppedReplyTid` list. - errorCode = OT_ERROR_NONE; + error = OT_ERROR_NONE; } } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - return errorCode; + return error; } #if OPENTHREAD_ENABLE_RAW_LINK_API -otError NcpBase::SetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_PHY_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { bool value = false; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &value ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); if (value == false) { @@ -4398,68 +4391,68 @@ otError NcpBase::SetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_ otLinkRawSleep(mInstance); } - errorCode = otLinkRawSetEnable(mInstance, false); + error = otLinkRawSetEnable(mInstance, false); } else { - errorCode = otLinkRawSetEnable(mInstance, true); + error = otLinkRawSetEnable(mInstance, true); // If we have raw stream enabled already, start receiving - if (errorCode == OT_ERROR_NONE && mIsRawStreamEnabled) + if (error == OT_ERROR_NONE && mIsRawStreamEnabled) { - errorCode = otLinkRawReceive(mInstance, mCurReceiveChannel, &NcpBase::LinkRawReceiveDone); + error = otLinkRawReceive(mInstance, mCurReceiveChannel, &NcpBase::LinkRawReceiveDone); } } exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #endif // OPENTHREAD_ENABLE_RAW_LINK_API -otError NcpBase::SetPropertyHandler_PHY_TX_POWER(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_PHY_TX_POWER(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { int8_t value = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_INT8_S, &value ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otLinkSetMaxTransmitPower(mInstance, value); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_PHY_CHAN(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { unsigned int channel = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT_PACKED_S, &channel ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otLinkSetChannel(mInstance, static_cast(channel)); + error = otLinkSetChannel(mInstance, static_cast(channel)); #if OPENTHREAD_ENABLE_RAW_LINK_API - SuccessOrExit(errorCode); + SuccessOrExit(error); // Cache the channel. If the raw link layer isn't enabled yet, the otSetChannel call // doesn't call into the radio layer to set the channel. We will have to do it @@ -4470,30 +4463,30 @@ otError NcpBase::SetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key_t k // stream enabled already if (otLinkRawIsEnabled(mInstance) && mIsRawStreamEnabled) { - errorCode = otLinkRawReceive(mInstance, mCurReceiveChannel, &NcpBase::LinkRawReceiveDone); + error = otLinkRawReceive(mInstance, mCurReceiveChannel, &NcpBase::LinkRawReceiveDone); } #endif // OPENTHREAD_ENABLE_RAW_LINK_API exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint8_t mode = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &mode ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); switch (mode) { @@ -4507,76 +4500,76 @@ otError NcpBase::SetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t header, spinel_ break; default: - errorCode = OT_ERROR_INVALID_ARGS; + error = OT_ERROR_INVALID_ARGS; break; } exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_MAC_SCAN_MASK(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_SCAN_MASK(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { - uint32_t new_mask = 0; - otError errorCode = OT_ERROR_NONE; + uint32_t newMask = 0; + otError error = OT_ERROR_NONE; - for (; value_len != 0; value_len--, value_ptr++) + for (; aValueLen != 0; aValueLen--, aValuePtr++) { - VerifyOrExit(value_ptr[0] <= 31, errorCode = OT_ERROR_INVALID_ARGS); - VerifyOrExit((mSupportedChannelMask & (1 << value_ptr[0])) != 0, errorCode = OT_ERROR_INVALID_ARGS); + VerifyOrExit(aValuePtr[0] <= 31, error = OT_ERROR_INVALID_ARGS); + VerifyOrExit((mSupportedChannelMask & (1 << aValuePtr[0])) != 0, error = OT_ERROR_INVALID_ARGS); - new_mask |= (1 << value_ptr[0]); + newMask |= (1 << aValuePtr[0]); } - mChannelMask = new_mask; + mChannelMask = newMask; exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_MAC_SCAN_PERIOD(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_SCAN_PERIOD(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { uint16_t period = mScanPeriod; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT16_S, &period ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); mScanPeriod = period; exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool value = mRequireJoinExistingNetwork; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &value ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); mRequireJoinExistingNetwork = value; exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } static bool HasOnly1BitSet(uint32_t aValue) @@ -4596,47 +4589,47 @@ static uint8_t IndexOfMSB(uint32_t aValue) return index; } -otError NcpBase::SetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_SCAN_STATE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { uint8_t state = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &state ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); switch (state) { case SPINEL_SCAN_STATE_IDLE: - errorCode = OT_ERROR_NONE; + error = OT_ERROR_NONE; break; case SPINEL_SCAN_STATE_BEACON: #if OPENTHREAD_ENABLE_RAW_LINK_API if (otLinkRawIsEnabled(mInstance)) { - errorCode = OT_ERROR_NOT_IMPLEMENTED; + error = OT_ERROR_NOT_IMPLEMENTED; } else #endif // OPENTHREAD_ENABLE_RAW_LINK_API { - errorCode = otLinkActiveScan( - mInstance, - mChannelMask, - mScanPeriod, - &HandleActiveScanResult_Jump, - this - ); + error = otLinkActiveScan( + mInstance, + mChannelMask, + mScanPeriod, + &HandleActiveScanResult_Jump, + this + ); } - SuccessOrExit(errorCode); + SuccessOrExit(error); mShouldSignalEndOfScan = false; break; @@ -4648,118 +4641,118 @@ otError NcpBase::SetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_prop_k // Make sure we aren't already scanning and that we have // only 1 bit set for the channel mask. - VerifyOrExit(mCurScanChannel == NCP_INVALID_SCAN_CHANNEL, errorCode = OT_ERROR_INVALID_STATE); - VerifyOrExit(HasOnly1BitSet(mChannelMask), errorCode = OT_ERROR_INVALID_ARGS); + VerifyOrExit(mCurScanChannel == NCP_INVALID_SCAN_CHANNEL, error = OT_ERROR_INVALID_STATE); + VerifyOrExit(HasOnly1BitSet(mChannelMask), error = OT_ERROR_INVALID_ARGS); scanChannel = IndexOfMSB(mChannelMask); mCurScanChannel = (int8_t)scanChannel; - errorCode = otLinkRawEnergyScan( - mInstance, - scanChannel, - mScanPeriod, - LinkRawEnergyScanDone - ); + error = otLinkRawEnergyScan( + mInstance, + scanChannel, + mScanPeriod, + LinkRawEnergyScanDone + ); } else #endif // OPENTHREAD_ENABLE_RAW_LINK_API { - errorCode = otLinkEnergyScan( - mInstance, - mChannelMask, - mScanPeriod, - &HandleEnergyScanResult_Jump, - this - ); + error = otLinkEnergyScan( + mInstance, + mChannelMask, + mScanPeriod, + &HandleEnergyScanResult_Jump, + this + ); } - SuccessOrExit(errorCode); + SuccessOrExit(error); mShouldSignalEndOfScan = false; break; case SPINEL_SCAN_STATE_DISCOVER: - errorCode = otThreadDiscover( - mInstance, - mChannelMask, - mDiscoveryScanPanId, - mDiscoveryScanJoinerFlag, - mDiscoveryScanEnableFiltering, - &HandleActiveScanResult_Jump, - this - ); + error = otThreadDiscover( + mInstance, + mChannelMask, + mDiscoveryScanPanId, + mDiscoveryScanJoinerFlag, + mDiscoveryScanEnableFiltering, + &HandleActiveScanResult_Jump, + this + ); - SuccessOrExit(errorCode); + SuccessOrExit(error); mShouldSignalEndOfScan = false; break; default: - errorCode = OT_ERROR_INVALID_ARGS; + error = OT_ERROR_INVALID_ARGS; break; } exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_MAC_15_4_PANID(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_15_4_PANID(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { uint16_t panid; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT16_S, &panid ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otLinkSetPanId(mInstance, panid); + error = otLinkSetPanId(mInstance, panid); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_MAC_15_4_LADDR(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_15_4_LADDR(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { otExtAddress *extAddress; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_EUI64_S, &extAddress ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otLinkSetExtendedAddress(mInstance, extAddress); + error = otLinkSetExtendedAddress(mInstance, extAddress); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool value = false; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &value ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); #if OPENTHREAD_ENABLE_RAW_LINK_API @@ -4767,11 +4760,11 @@ otError NcpBase::SetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t header, spine { if (value) { - errorCode = otLinkRawReceive(mInstance, mCurReceiveChannel, &NcpBase::LinkRawReceiveDone); + error = otLinkRawReceive(mInstance, mCurReceiveChannel, &NcpBase::LinkRawReceiveDone); } else { - errorCode = otLinkRawSleep(mInstance); + error = otLinkRawSleep(mInstance); } } @@ -4780,65 +4773,65 @@ otError NcpBase::SetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t header, spine mIsRawStreamEnabled = value; exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #if OPENTHREAD_ENABLE_RAW_LINK_API -otError NcpBase::SetPropertyHandler_MAC_15_4_SADDR(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_15_4_SADDR(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { uint16_t shortAddress; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT16_S, &shortAddress ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otLinkRawSetShortAddress(mInstance, shortAddress); + error = otLinkRawSetShortAddress(mInstance, shortAddress); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_STREAM_RAW(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_STREAM_RAW(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { uint8_t *frame_buffer = NULL; otRadioFrame *frame; - unsigned int frame_len = 0; + unsigned int frameLen = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - VerifyOrExit(otLinkRawIsEnabled(mInstance), errorCode = OT_ERROR_INVALID_STATE); + VerifyOrExit(otLinkRawIsEnabled(mInstance), error = OT_ERROR_INVALID_STATE); frame = otLinkRawGetTransmitBuffer(mInstance); parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_DATA_WLEN_S SPINEL_DATATYPE_UINT8_S SPINEL_DATATYPE_INT8_S, &frame_buffer, - &frame_len, + &frameLen, &frame->mChannel, &frame->mPower ); - VerifyOrExit(parsedLength > 0 && frame_len <= OT_RADIO_FRAME_MAX_SIZE, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0 && frameLen <= OT_RADIO_FRAME_MAX_SIZE, error = OT_ERROR_PARSE); // Cache the transaction ID for async response - mCurTransmitTID = SPINEL_HEADER_GET_TID(header); + mCurTransmitTID = SPINEL_HEADER_GET_TID(aHeader); // Update frame buffer and length - frame->mLength = static_cast(frame_len); + frame->mLength = static_cast(frameLen); memcpy(frame->mPsdu, frame_buffer, frame->mLength); // TODO: This should be later added in the STREAM_RAW argument to allow user to directly specify it. @@ -4846,70 +4839,70 @@ otError NcpBase::SetPropertyHandler_STREAM_RAW(uint8_t header, spinel_prop_key_t // Pass frame to the radio layer. Note, this fails if we // haven't enabled raw stream or are already transmitting. - errorCode = otLinkRawTransmit(mInstance, frame, &NcpBase::LinkRawTransmitDone); + error = otLinkRawTransmit(mInstance, frame, &NcpBase::LinkRawTransmitDone); exit: - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { // Don't do anything here yet. We will complete the transaction when we get a transmit done callback } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - (void)key; + (void)aKey; - return errorCode; + return error; } #endif // OPENTHREAD_ENABLE_RAW_LINK_API -otError NcpBase::SetPropertyHandler_NET_IF_UP(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_NET_IF_UP(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { bool enabled = false; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otIp6SetEnabled(mInstance, enabled); + error = otIp6SetEnabled(mInstance, enabled); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_NET_STACK_UP(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_NET_STACK_UP(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { bool enabled = false; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); // If the value has changed... if ((enabled != false) != (otThreadGetDeviceRole(mInstance) != OT_DEVICE_ROLE_DISABLED)) { if (enabled != false) { - errorCode = otThreadSetEnabled(mInstance, true); + error = otThreadSetEnabled(mInstance, true); #if OPENTHREAD_ENABLE_LEGACY mLegacyNodeDidJoin = false; @@ -4922,7 +4915,7 @@ otError NcpBase::SetPropertyHandler_NET_STACK_UP(uint8_t header, spinel_prop_key } else { - errorCode = otThreadSetEnabled(mInstance, false); + error = otThreadSetEnabled(mInstance, false); #if OPENTHREAD_ENABLE_LEGACY mLegacyNodeDidJoin = false; @@ -4936,229 +4929,229 @@ otError NcpBase::SetPropertyHandler_NET_STACK_UP(uint8_t header, spinel_prop_key } exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_NET_ROLE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { unsigned int role = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT_PACKED_S, &role ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); switch (role) { case SPINEL_NET_ROLE_DETACHED: - errorCode = otThreadBecomeDetached(mInstance); + error = otThreadBecomeDetached(mInstance); break; #if OPENTHREAD_FTD case SPINEL_NET_ROLE_ROUTER: - errorCode = otThreadBecomeRouter(mInstance); + error = otThreadBecomeRouter(mInstance); break; case SPINEL_NET_ROLE_LEADER: - errorCode = otThreadBecomeLeader(mInstance); + error = otThreadBecomeLeader(mInstance); break; #endif // OPENTHREAD_FTD case SPINEL_NET_ROLE_CHILD: - errorCode = otThreadBecomeChild(mInstance); + error = otThreadBecomeChild(mInstance); break; } exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_NET_NETWORK_NAME(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_NET_NETWORK_NAME(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { const char *string = NULL; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UTF8_S, &string ); - VerifyOrExit((parsedLength > 0) && (string != NULL), errorCode = OT_ERROR_PARSE); + VerifyOrExit((parsedLength > 0) && (string != NULL), error = OT_ERROR_PARSE); - errorCode = otThreadSetNetworkName(mInstance, string); + error = otThreadSetNetworkName(mInstance, string); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_NET_XPANID(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_NET_XPANID(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { const uint8_t *ptr = NULL; spinel_size_t len; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_DATA_S, &ptr, &len ); - VerifyOrExit((parsedLength > 0) && (len == sizeof(spinel_net_xpanid_t)), errorCode = OT_ERROR_PARSE); + VerifyOrExit((parsedLength > 0) && (len == sizeof(spinel_net_xpanid_t)), error = OT_ERROR_PARSE); - errorCode = otThreadSetExtendedPanId(mInstance, ptr); + error = otThreadSetExtendedPanId(mInstance, ptr); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_NET_MASTER_KEY(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_NET_MASTER_KEY(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { const uint8_t *ptr = NULL; spinel_size_t len; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_DATA_S, &ptr, &len ); - VerifyOrExit((parsedLength > 0) && (len == OT_MASTER_KEY_SIZE), errorCode = OT_ERROR_PARSE); + VerifyOrExit((parsedLength > 0) && (len == OT_MASTER_KEY_SIZE), error = OT_ERROR_PARSE); - errorCode = otThreadSetMasterKey(mInstance, reinterpret_cast(ptr)); + error = otThreadSetMasterKey(mInstance, reinterpret_cast(ptr)); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_NET_KEY_SEQUENCE_COUNTER(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_NET_KEY_SEQUENCE_COUNTER(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { unsigned int keySeqCounter; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT32_S, &keySeqCounter ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otThreadSetKeySequenceCounter(mInstance, keySeqCounter); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { unsigned int keyGuardTime; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT32_S, &keyGuardTime ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otThreadSetKeySwitchGuardTime(mInstance, keyGuardTime); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #if OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint8_t weight; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &weight ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otThreadSetLocalLeaderWeight(mInstance, weight); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #endif // OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_STREAM_NET_INSECURE(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_STREAM_NET_INSECURE(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - const uint8_t *frame_ptr = NULL; - unsigned int frame_len = 0; - const uint8_t *meta_ptr = NULL; - unsigned int meta_len = 0; + const uint8_t *framePtr = NULL; + unsigned int frameLen = 0; + const uint8_t *metaPtr = NULL; + unsigned int metaLen = 0; otMessage *message; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; // STREAM_NET_INSECURE packets are not secured at layer 2. message = otIp6NewMessage(mInstance, false); - VerifyOrExit(message != NULL, errorCode = OT_ERROR_NO_BUFS); + VerifyOrExit(message != NULL, error = OT_ERROR_NO_BUFS); parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, ( SPINEL_DATATYPE_DATA_WLEN_S // Frame data SPINEL_DATATYPE_DATA_S // Meta data ), - &frame_ptr, - &frame_len, - &meta_ptr, - &meta_len + &framePtr, + &frameLen, + &metaPtr, + &metaLen ); // We ignore metadata for now. // May later include TX power, allow retransmits, etc... - (void)meta_ptr; - (void)meta_len; + (void)metaPtr; + (void)metaLen; (void)parsedLength; - SuccessOrExit(errorCode = otMessageAppend(message, frame_ptr, static_cast(frame_len))); + SuccessOrExit(error = otMessageAppend(message, framePtr, static_cast(frameLen))); // Ensure the insecure message is forwarded using direct transmission. otMessageSetDirectTransmission(message, true); - errorCode = otIp6Send(mInstance, message); + error = otIp6Send(mInstance, message); // `otIp6Send()` takes ownership of `message` (in both success or // failure cases). `message` is set to NULL so it is not freed at @@ -5171,65 +5164,65 @@ exit: otMessageFree(message); } - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { mInboundInsecureIpFrameCounter++; - if (SPINEL_HEADER_GET_TID(header) != 0) + if (SPINEL_HEADER_GET_TID(aHeader) != 0) { // Only send a successful status update if - // there was a transaction id in the header. - errorCode = SendLastStatus(header, SPINEL_STATUS_OK); + // there was a transaction id in the aHeader. + error = SendLastStatus(aHeader, SPINEL_STATUS_OK); } } else { mDroppedInboundIpFrameCounter++; - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - (void)key; + (void)aKey; - return errorCode; + return error; } #if OPENTHREAD_ENABLE_TMF_PROXY && OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_THREAD_TMF_PROXY_STREAM(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_TMF_PROXY_STREAM(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - const uint8_t *frame_ptr = NULL; - unsigned int frame_len = 0; + const uint8_t *framePtr = NULL; + unsigned int frameLen = 0; uint16_t locator; uint16_t port; otMessage *message; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; // THREAD_TMF_PROXY_STREAM requires layer 2 security. message = otIp6NewMessage(mInstance, true); - VerifyOrExit(message != NULL, errorCode = OT_ERROR_NO_BUFS); + VerifyOrExit(message != NULL, error = OT_ERROR_NO_BUFS); parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, ( SPINEL_DATATYPE_DATA_WLEN_S // Frame data SPINEL_DATATYPE_UINT16_S // Locator SPINEL_DATATYPE_UINT16_S // Port ), - &frame_ptr, - &frame_len, + &framePtr, + &frameLen, &locator, &port ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - SuccessOrExit(errorCode = otMessageAppend(message, frame_ptr, static_cast(frame_len))); + SuccessOrExit(error = otMessageAppend(message, framePtr, static_cast(frameLen))); - errorCode = otTmfProxySend(mInstance, message, locator, port); + error = otTmfProxySend(mInstance, message, locator, port); // `otTmfProxySend()` takes ownership of `message` (in both success // or failure cases). `message` is set to NULL so it is not freed at @@ -5242,63 +5235,63 @@ exit: otMessageFree(message); } - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - if (SPINEL_HEADER_GET_TID(header) != 0) + if (SPINEL_HEADER_GET_TID(aHeader) != 0) { // Only send a successful status update if - // there was a transaction id in the header. - errorCode = SendLastStatus(header, SPINEL_STATUS_OK); + // there was a transaction id in the aHeader. + error = SendLastStatus(aHeader, SPINEL_STATUS_OK); } } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - (void)key; + (void)aKey; - return errorCode; + return error; } #endif // OPENTHREAD_ENABLE_TMF_PROXY && OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_STREAM_NET(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { - const uint8_t *frame_ptr = NULL; - unsigned int frame_len = 0; - const uint8_t *meta_ptr = NULL; - unsigned int meta_len = 0; + const uint8_t *framePtr = NULL; + unsigned int frameLen = 0; + const uint8_t *metaPtr = NULL; + unsigned int metaLen = 0; otMessage *message; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; // STREAM_NET requires layer 2 security. message = otIp6NewMessage(mInstance, true); - VerifyOrExit(message != NULL, errorCode = OT_ERROR_NO_BUFS); + VerifyOrExit(message != NULL, error = OT_ERROR_NO_BUFS); parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, ( SPINEL_DATATYPE_DATA_WLEN_S // Frame data SPINEL_DATATYPE_DATA_S // Meta data ), - &frame_ptr, - &frame_len, - &meta_ptr, - &meta_len + &framePtr, + &frameLen, + &metaPtr, + &metaLen ); // We ignore metadata for now. // May later include TX power, allow retransmits, etc... - (void)meta_ptr; - (void)meta_len; + (void)metaPtr; + (void)metaLen; (void)parsedLength; - SuccessOrExit(errorCode = otMessageAppend(message, frame_ptr, static_cast(frame_len))); + SuccessOrExit(error = otMessageAppend(message, framePtr, static_cast(frameLen))); - errorCode = otIp6Send(mInstance, message); + error = otIp6Send(mInstance, message); // `otIp6Send()` takes ownership of `message` (in both success or // failure cases). `message` is set to NULL so it is not freed at @@ -5312,187 +5305,187 @@ exit: otMessageFree(message); } - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { mInboundSecureIpFrameCounter++; - if (SPINEL_HEADER_GET_TID(header) != 0) + if (SPINEL_HEADER_GET_TID(aHeader) != 0) { // Only send a successful status update if - // there was a transaction id in the header. - errorCode = SendLastStatus(header, SPINEL_STATUS_OK); + // there was a transaction id in the aHeader. + error = SendLastStatus(aHeader, SPINEL_STATUS_OK); } } else { mDroppedInboundIpFrameCounter++; - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - (void)key; + (void)aKey; - return errorCode; + return error; } -otError NcpBase::SetPropertyHandler_IPV6_ML_PREFIX(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_IPV6_ML_PREFIX(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - VerifyOrExit(value_len >= 8, errorCode = OT_ERROR_PARSE); + VerifyOrExit(aValueLen >= 8, error = OT_ERROR_PARSE); - errorCode = otThreadSetMeshLocalPrefix(mInstance, value_ptr); + error = otThreadSetMeshLocalPrefix(mInstance, aValuePtr); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_IPV6_ICMP_PING_OFFLOAD(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_IPV6_ICMP_PING_OFFLOAD(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool enabled = false; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otIcmp6SetEchoEnabled(mInstance, enabled); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_RLOC16_DEBUG_PASSTHRU(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_RLOC16_DEBUG_PASSTHRU(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool enabled = false; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); // Note reverse logic: passthru enabled = filter disabled otIp6SetReceiveFilterEnabled(mInstance, !enabled); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_DISCOVERY_SCAN_JOINER_FLAG(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_DISCOVERY_SCAN_JOINER_FLAG(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool joinerFlag = false; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &joinerFlag ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); mDiscoveryScanJoinerFlag = joinerFlag; exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, + uint16_t aValueLen) { bool enabled = false; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); mDiscoveryScanEnableFiltering = enabled; exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_DISCOVERY_SCAN_PANID(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_DISCOVERY_SCAN_PANID(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint16_t panid; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT16_S, &panid ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); mDiscoveryScanPanId = panid; exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - uint8_t num_entries = 0; - const uint16_t *ports = otIp6GetUnsecurePorts(mInstance, &num_entries); + uint8_t numEntries = 0; + const uint16_t *ports = otIp6GetUnsecurePorts(mInstance, &numEntries); spinel_ssize_t parsedLength; bool portsChanged = false; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; // First, we need to remove all of the current assisting ports. - for (; num_entries != 0; ports++, num_entries--) + for (; numEntries != 0; ports++, numEntries--) { - SuccessOrExit(errorCode = otIp6RemoveUnsecurePort(mInstance, *ports)); + SuccessOrExit(error = otIp6RemoveUnsecurePort(mInstance, *ports)); portsChanged = true; } - while (value_len >= 2) + while (aValueLen >= 2) { uint16_t port; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT16_S, &port ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - SuccessOrExit(errorCode = otIp6AddUnsecurePort(mInstance, port)); + SuccessOrExit(error = otIp6AddUnsecurePort(mInstance, port)); - value_ptr += parsedLength; - value_len -= parsedLength; + aValuePtr += parsedLength; + aValueLen -= parsedLength; portsChanged = true; } @@ -5502,7 +5495,7 @@ otError NcpBase::SetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spine portsChanged = false; exit: - errorCode = SendSetPropertyResponse(header, key, errorCode); + error = SendSetPropertyResponse(aHeader, aKey, error); if (portsChanged) { @@ -5510,203 +5503,203 @@ exit: // the state of these ports---so we need to report // those incomplete changes via an asynchronous // change event. - HandleCommandPropertyGet(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, key); + HandleCommandPropertyGet(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, aKey); } - return errorCode; + return error; } #if OPENTHREAD_ENABLE_BORDER_ROUTER -otError NcpBase::SetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool value = false; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; - bool should_register_with_leader = false; + otError error = OT_ERROR_NONE; + bool shouldRegisterWithLeader = false; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &value ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); // Register any net data changes on transition from `true` to `false`. - should_register_with_leader = (mAllowLocalNetworkDataChange == true) && (value == false); + shouldRegisterWithLeader = (mAllowLocalNetworkDataChange == true) && (value == false); mAllowLocalNetworkDataChange = value; exit: - errorCode = SendSetPropertyResponse(header, key, errorCode); + error = SendSetPropertyResponse(aHeader, aKey, error); - if (should_register_with_leader) + if (shouldRegisterWithLeader) { otBorderRouterRegister(mInstance); } - return errorCode; + return error; } #endif // OPENTHREAD_ENABLE_BORDER_ROUTER #if OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool enabled; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otThreadSetRouterRoleEnabled(mInstance, enabled); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB -otError NcpBase::SetPropertyHandler_THREAD_THREAD_STEERING_DATA(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_THREAD_STEERING_DATA(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { otExtAddress *extAddress; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_EUI64_S, &extAddress ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otThreadSetSteeringData(mInstance, extAddress); + error = otThreadSetSteeringData(mInstance, extAddress); exit: - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { // Note that there is no get handler for this property. - errorCode = SendPropertyUpdate( - header, + error = SendPropertyUpdate( + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_EUI64_S, extAddress->m8 ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - return errorCode; + return error; } #endif // #if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB #endif // #if OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_CNTR_RESET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_CNTR_RESET(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { uint8_t value = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &value ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - VerifyOrExit(value == 1, errorCode = OT_ERROR_INVALID_ARGS); + VerifyOrExit(value == 1, error = OT_ERROR_INVALID_ARGS); // TODO: Implement counter reset! - errorCode = OT_ERROR_NOT_IMPLEMENTED; + error = OT_ERROR_NOT_IMPLEMENTED; exit: - (void)key; + (void)aKey; // There is currently no getter for PROP_CNTR_RESET, so we just // return SPINEL_STATUS_OK for success when the counters are reset. - return SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + return SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } #if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, + uint16_t aValueLen) { bool enabled = false; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); if (enabled == false) { - errorCode = otCommissionerStop(mInstance); + error = otCommissionerStop(mInstance); } else { - errorCode = otCommissionerStart(mInstance); + error = otCommissionerStart(mInstance); } exit: - (void)key; + (void)aKey; - return SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + return SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } #endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD #if OPENTHREAD_ENABLE_MAC_WHITELIST -otError NcpBase::SetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_WHITELIST(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { bool reportAsync; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; // First, clear the whitelist. otLinkClearWhitelist(mInstance); - while (value_len > 0) + while (aValueLen > 0) { - otExtAddress *ext_addr = NULL; + otExtAddress *extAddress = NULL; int8_t rssi = RSSI_OVERRIDE_DISABLED; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_STRUCT_S( SPINEL_DATATYPE_EUI64_S SPINEL_DATATYPE_INT8_S ), - &ext_addr, + &extAddress, &rssi ); @@ -5714,28 +5707,28 @@ otError NcpBase::SetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_ke { rssi = RSSI_OVERRIDE_DISABLED; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_STRUCT_S( SPINEL_DATATYPE_EUI64_S ), - &ext_addr + &extAddress ); } - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); if (rssi == RSSI_OVERRIDE_DISABLED) { - SuccessOrExit(errorCode = otLinkAddWhitelist(mInstance, ext_addr->m8)); + SuccessOrExit(error = otLinkAddWhitelist(mInstance, extAddress->m8)); } else { - SuccessOrExit(errorCode = otLinkAddWhitelistRssi(mInstance, ext_addr->m8, rssi)); + SuccessOrExit(error = otLinkAddWhitelistRssi(mInstance, extAddress->m8, rssi)); } - value_ptr += parsedLength; - value_len -= parsedLength; + aValuePtr += parsedLength; + aValueLen -= parsedLength; } exit: @@ -5743,69 +5736,69 @@ exit: // the state of the whitelist---so we need to report // those incomplete changes via an asynchronous // change event. - reportAsync = (errorCode != OT_ERROR_NONE); + reportAsync = (error != OT_ERROR_NONE); - errorCode = SendSetPropertyResponse(header, key, errorCode); + error = SendSetPropertyResponse(aHeader, aKey, error); if (reportAsync) { - HandleCommandPropertyGet(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, key); + HandleCommandPropertyGet(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, aKey); } - return errorCode; + return error; } -otError NcpBase::SetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool enabled; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otLinkSetWhitelistEnabled(mInstance, enabled); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_MAC_BLACKLIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_BLACKLIST(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { bool reportAsync; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; // First, clear the blacklist. otLinkClearBlacklist(mInstance); - while (value_len > 0) + while (aValueLen > 0) { otExtAddress *ext_addr = NULL; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_STRUCT_S( SPINEL_DATATYPE_EUI64_S ), &ext_addr ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - SuccessOrExit(errorCode = otLinkAddBlacklist(mInstance, ext_addr->m8)); + SuccessOrExit(error = otLinkAddBlacklist(mInstance, ext_addr->m8)); - value_ptr += parsedLength; - value_len -= parsedLength; + aValuePtr += parsedLength; + aValueLen -= parsedLength; } exit: @@ -5813,406 +5806,402 @@ exit: // the state of the blacklist---so we need to report // those incomplete changes via an asynchronous // change event. - reportAsync = (errorCode != OT_ERROR_NONE); + reportAsync = (error != OT_ERROR_NONE); - errorCode = SendSetPropertyResponse(header, key, errorCode); + error = SendSetPropertyResponse(aHeader, aKey, error); if (reportAsync) { - HandleCommandPropertyGet(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, key); + HandleCommandPropertyGet(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, aKey); } - return errorCode; + return error; } -otError NcpBase::SetPropertyHandler_MAC_BLACKLIST_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_BLACKLIST_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool enabled; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otLinkSetBlacklistEnabled(mInstance, enabled); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #endif // OPENTHREAD_ENABLE_MAC_WHITELIST #if OPENTHREAD_ENABLE_RAW_LINK_API -otError NcpBase::SetPropertyHandler_MAC_SRC_MATCH_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_SRC_MATCH_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool enabled; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otLinkRawSrcMatchEnable(mInstance, enabled); + error = otLinkRawSrcMatchEnable(mInstance, enabled); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - otError errorCode = OT_ERROR_NONE; - spinel_status_t errorStatus = SPINEL_STATUS_OK; - const uint8_t *data = value_ptr; - uint16_t data_len = value_len; + otError error = OT_ERROR_NONE; + spinel_status_t spinelError = SPINEL_STATUS_OK; + const uint8_t *data = aValuePtr; + uint16_t dataLen = aValueLen; // Clear the list first - errorCode = otLinkRawSrcMatchClearShortEntries(mInstance); + error = otLinkRawSrcMatchClearShortEntries(mInstance); - VerifyOrExit(errorCode == OT_ERROR_NONE, - errorStatus = ThreadErrorToSpinelStatus(errorCode)); + VerifyOrExit(error == OT_ERROR_NONE, spinelError = ThreadErrorToSpinelStatus(error)); // Loop through the addresses and add them - while (data_len >= sizeof(uint16_t)) + while (dataLen >= sizeof(uint16_t)) { spinel_ssize_t parsedLength; uint16_t short_address; parsedLength = spinel_datatype_unpack( data, - data_len, + dataLen, SPINEL_DATATYPE_UINT16_S, &short_address ); - VerifyOrExit(parsedLength > 0, errorStatus = SPINEL_STATUS_PARSE_ERROR); + VerifyOrExit(parsedLength > 0, spinelError = SPINEL_STATUS_PARSE_ERROR); data += parsedLength; - data_len -= (uint16_t)parsedLength; + dataLen -= (uint16_t)parsedLength; - errorCode = otLinkRawSrcMatchAddShortEntry(mInstance, short_address); + error = otLinkRawSrcMatchAddShortEntry(mInstance, short_address); - VerifyOrExit(errorCode == OT_ERROR_NONE, - errorStatus = ThreadErrorToSpinelStatus(errorCode)); + VerifyOrExit(error == OT_ERROR_NONE, spinelError = ThreadErrorToSpinelStatus(error)); } - errorCode = + error = SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, - value_ptr, - value_len + aKey, + aValuePtr, + aValueLen ); exit: - if (errorStatus != SPINEL_STATUS_OK) + if (spinelError != SPINEL_STATUS_OK) { - errorCode = SendLastStatus(header, errorStatus); + error = SendLastStatus(aHeader, spinelError); } - return errorCode; + return error; } -otError NcpBase::SetPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - otError errorCode = OT_ERROR_NONE; - spinel_status_t errorStatus = SPINEL_STATUS_OK; - const uint8_t *data = value_ptr; - uint16_t data_len = value_len; + otError error = OT_ERROR_NONE; + spinel_status_t spinelError = SPINEL_STATUS_OK; + const uint8_t *data = aValuePtr; + uint16_t dataLen = aValueLen; // Clear the list first - errorCode = otLinkRawSrcMatchClearExtEntries(mInstance); + error = otLinkRawSrcMatchClearExtEntries(mInstance); - VerifyOrExit(errorCode == OT_ERROR_NONE, - errorStatus = ThreadErrorToSpinelStatus(errorCode)); + VerifyOrExit(error == OT_ERROR_NONE, spinelError = ThreadErrorToSpinelStatus(error)); // Loop through the addresses and add them - while (data_len >= sizeof(otExtAddress)) + while (dataLen >= sizeof(otExtAddress)) { spinel_ssize_t parsedLength; - uint8_t *ext_address; + uint8_t *extAddress; parsedLength = spinel_datatype_unpack( data, - data_len, + dataLen, SPINEL_DATATYPE_EUI64_S, - &ext_address + &extAddress ); - VerifyOrExit(parsedLength > 0, errorStatus = SPINEL_STATUS_PARSE_ERROR); + VerifyOrExit(parsedLength > 0, spinelError = SPINEL_STATUS_PARSE_ERROR); data += parsedLength; - data_len -= (uint16_t)parsedLength; + dataLen -= (uint16_t)parsedLength; - errorCode = otLinkRawSrcMatchAddExtEntry(mInstance, ext_address); + error = otLinkRawSrcMatchAddExtEntry(mInstance, extAddress); - VerifyOrExit(errorCode == OT_ERROR_NONE, - errorStatus = ThreadErrorToSpinelStatus(errorCode)); + VerifyOrExit(error == OT_ERROR_NONE, spinelError = ThreadErrorToSpinelStatus(error)); } - errorCode = + error = SendPropertyUpdate( - header, + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, - value_ptr, - value_len + aKey, + aValuePtr, + aValueLen ); exit: - if (errorStatus != SPINEL_STATUS_OK) + if (spinelError != SPINEL_STATUS_OK) { - errorCode = SendLastStatus(header, errorStatus); + error = SendLastStatus(aHeader, spinelError); } - return errorCode; + return error; } #endif #if OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_NET_PSKC(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_NET_PSKC(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { const uint8_t *ptr = NULL; spinel_size_t len; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_DATA_S, &ptr, &len ); - VerifyOrExit((parsedLength > 0) && (len == sizeof(spinel_net_pskc_t)), errorCode = OT_ERROR_PARSE); + VerifyOrExit((parsedLength > 0) && (len == sizeof(spinel_net_pskc_t)), error = OT_ERROR_PARSE); - errorCode = otThreadSetPSKc(mInstance, ptr); + error = otThreadSetPSKc(mInstance, ptr); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #endif // OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_THREAD_MODE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_MODE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { - uint8_t numeric_mode = 0; - otLinkModeConfig mode_config; + uint8_t numericMode = 0; + otLinkModeConfig modeConfig; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, - &numeric_mode + &numericMode ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - mode_config.mRxOnWhenIdle = ((numeric_mode & kThreadMode_RxOnWhenIdle) == kThreadMode_RxOnWhenIdle); - mode_config.mSecureDataRequests = - ((numeric_mode & kThreadMode_SecureDataRequest) == kThreadMode_SecureDataRequest); - mode_config.mDeviceType = ((numeric_mode & kThreadMode_FullFunctionDevice) == kThreadMode_FullFunctionDevice); - mode_config.mNetworkData = ((numeric_mode & kThreadMode_FullNetworkData) == kThreadMode_FullNetworkData); + modeConfig.mRxOnWhenIdle = ((numericMode & kThreadMode_RxOnWhenIdle) == kThreadMode_RxOnWhenIdle); + modeConfig.mSecureDataRequests = + ((numericMode & kThreadMode_SecureDataRequest) == kThreadMode_SecureDataRequest); + modeConfig.mDeviceType = ((numericMode & kThreadMode_FullFunctionDevice) == kThreadMode_FullFunctionDevice); + modeConfig.mNetworkData = ((numericMode & kThreadMode_FullNetworkData) == kThreadMode_FullNetworkData); - errorCode = otThreadSetLinkMode(mInstance, mode_config); + error = otThreadSetLinkMode(mInstance, modeConfig); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #if OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint8_t maxChildren = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &maxChildren ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otThreadSetMaxAllowedChildren(mInstance, maxChildren); + error = otThreadSetMaxAllowedChildren(mInstance, maxChildren); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint32_t timeout = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT32_S, &timeout ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otThreadSetChildTimeout(mInstance, timeout); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint8_t threshold = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &threshold ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otThreadSetRouterUpgradeThreshold(mInstance, threshold); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint8_t threshold = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &threshold ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otThreadSetRouterDowngradeThreshold(mInstance, threshold); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint8_t jitter = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &jitter ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otThreadSetRouterSelectionJitter(mInstance, jitter); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_PREFERRED_ROUTER_ID(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_PREFERRED_ROUTER_ID(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - uint8_t router_id = 0; + uint8_t routerId = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, - &router_id + &routerId ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otThreadSetPreferredRouterId(mInstance, router_id); + error = otThreadSetPreferredRouterId(mInstance, routerId); exit: - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, + error = SendPropertyUpdate( + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, SPINEL_DATATYPE_UINT8_S, - router_id + routerId ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - return errorCode; + return error; } #endif // OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint8_t spinelNcpLogLevel = 0; otLogLevel logLevel; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &spinelNcpLogLevel ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); switch (spinelNcpLogLevel) { @@ -6240,114 +6229,114 @@ otError NcpBase::SetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_p break; default: - ExitNow(errorCode = OT_ERROR_INVALID_ARGS); + ExitNow(error = OT_ERROR_INVALID_ARGS); break; } - errorCode = otSetDynamicLogLevel(mInstance, logLevel); + error = otSetDynamicLogLevel(mInstance, logLevel); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #if OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint32_t delay = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT32_S, &delay ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otThreadSetContextIdReuseDelay(mInstance, delay); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint8_t timeout = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &timeout ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); otThreadSetNetworkIdTimeout(mInstance, timeout); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #endif // OPENTHREAD_FTD #if OPENTHREAD_ENABLE_TMF_PROXY && OPENTHREAD_FTD -otError NcpBase::SetPropertyHandler_TMF_PROXY_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_TMF_PROXY_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool enabled; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); if (enabled) { - errorCode = otTmfProxyStart(mInstance, &NcpBase::HandleTmfProxyStream, this); + error = otTmfProxyStart(mInstance, &NcpBase::HandleTmfProxyStream, this); } else { - errorCode = otTmfProxyStop(mInstance); + error = otTmfProxyStop(mInstance); } exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #endif // OPENTHREAD_ENABLE_TMF_PROXY && OPENTHREAD_FTD #if OPENTHREAD_ENABLE_JAM_DETECTION -otError NcpBase::SetPropertyHandler_JAM_DETECT_ENABLE(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_JAM_DETECT_ENABLE(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { bool enabled; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_BOOL_S, &enabled ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); if (enabled) { @@ -6359,73 +6348,73 @@ otError NcpBase::SetPropertyHandler_JAM_DETECT_ENABLE(uint8_t header, spinel_pro } exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_JAM_DETECT_RSSI_THRESHOLD(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_JAM_DETECT_RSSI_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { int8_t threshold = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_INT8_S, &threshold ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otJamDetectionSetRssiThreshold(mInstance, threshold); + error = otJamDetectionSetRssiThreshold(mInstance, threshold); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_JAM_DETECT_WINDOW(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_JAM_DETECT_WINDOW(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { uint8_t window = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &window ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otJamDetectionSetWindow(mInstance, window); + error = otJamDetectionSetWindow(mInstance, window); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } -otError NcpBase::SetPropertyHandler_JAM_DETECT_BUSY(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_JAM_DETECT_BUSY(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { uint8_t busy = 0; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, &busy ); - VerifyOrExit(parsedLength > 0, errorCode = OT_ERROR_PARSE); + VerifyOrExit(parsedLength > 0, error = OT_ERROR_PARSE); - errorCode = otJamDetectionSetBusyPeriod(mInstance, busy); + error = otJamDetectionSetBusyPeriod(mInstance, busy); exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } void NcpBase::HandleJamStateChange_Jump(bool aJamState, void *aContext) @@ -6435,9 +6424,9 @@ void NcpBase::HandleJamStateChange_Jump(bool aJamState, void *aContext) void NcpBase::HandleJamStateChange(bool aJamState) { - otError errorCode; + otError error; - errorCode = SendPropertyUpdate( + error = SendPropertyUpdate( SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_JAM_DETECTED, @@ -6448,7 +6437,7 @@ void NcpBase::HandleJamStateChange(bool aJamState) // If we could not send the jam state change indicator (no // buffer space), we set `mShouldSignalJamStateChange` to true to send // it out when buffer space becomes available. - if (errorCode != OT_ERROR_NONE) + if (error != OT_ERROR_NONE) { mShouldSignalJamStateChange = true; } @@ -6458,17 +6447,17 @@ void NcpBase::HandleJamStateChange(bool aJamState) #if OPENTHREAD_ENABLE_DIAG -otError NcpBase::SetPropertyHandler_NEST_STREAM_MFG(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len) +otError NcpBase::SetPropertyHandler_NEST_STREAM_MFG(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen) { char *string = NULL; char *output = NULL; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UTF8_S, &string ); @@ -6478,43 +6467,43 @@ otError NcpBase::SetPropertyHandler_NEST_STREAM_MFG(uint8_t header, spinel_prop_ // all diagnostics related features are processed within diagnostics module output = otDiagProcessCmdLine(string); - errorCode = SendPropertyUpdate( - header, + error = SendPropertyUpdate( + aHeader, SPINEL_CMD_PROP_VALUE_IS, - key, + aKey, reinterpret_cast(output), static_cast(strlen(output) + 1) ); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } #endif // OPENTHREAD_ENABLE_DIAG #if OPENTHREAD_ENABLE_LEGACY -otError NcpBase::SetPropertyHandler_NEST_LEGACY_ULA_PREFIX(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::SetPropertyHandler_NEST_LEGACY_ULA_PREFIX(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { const uint8_t *ptr = NULL; spinel_size_t len; spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_DATA_S, &ptr, &len ); - VerifyOrExit((parsedLength > 0) && (len <= sizeof(mLegacyUlaPrefix)), errorCode = OT_ERROR_PARSE); + VerifyOrExit((parsedLength > 0) && (len <= sizeof(mLegacyUlaPrefix)), error = OT_ERROR_PARSE); memset(mLegacyUlaPrefix, 0, sizeof(mLegacyUlaPrefix)); memcpy(mLegacyUlaPrefix, ptr, len); @@ -6525,7 +6514,7 @@ otError NcpBase::SetPropertyHandler_NEST_LEGACY_ULA_PREFIX(uint8_t header, spine } exit: - return SendSetPropertyResponse(header, key, errorCode); + return SendSetPropertyResponse(aHeader, aKey, error); } #endif // OPENTHREAD_ENABLE_LEGACY @@ -6536,356 +6525,354 @@ exit: #if OPENTHREAD_ENABLE_RAW_LINK_API -otError NcpBase::InsertPropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::InsertPropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; - spinel_status_t errorStatus = SPINEL_STATUS_OK; + otError error = OT_ERROR_NONE; + spinel_status_t spinelError = SPINEL_STATUS_OK; uint16_t short_address; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT16_S, &short_address ); - VerifyOrExit(parsedLength > 0, errorStatus = SPINEL_STATUS_PARSE_ERROR); + VerifyOrExit(parsedLength > 0, spinelError = SPINEL_STATUS_PARSE_ERROR); - errorCode = otLinkRawSrcMatchAddShortEntry(mInstance, short_address); + error = otLinkRawSrcMatchAddShortEntry(mInstance, short_address); - VerifyOrExit(errorCode == OT_ERROR_NONE, - errorStatus = ThreadErrorToSpinelStatus(errorCode)); + VerifyOrExit(error == OT_ERROR_NONE, + spinelError = ThreadErrorToSpinelStatus(error)); - errorCode = - SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_INSERTED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_INSERTED, + aKey, + aValuePtr, + aValueLen + ); exit: - if (errorStatus != SPINEL_STATUS_OK) + if (spinelError != SPINEL_STATUS_OK) { - errorCode = SendLastStatus(header, errorStatus); + error = SendLastStatus(aHeader, spinelError); } - return errorCode; + return error; } -otError NcpBase::InsertPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::InsertPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; - spinel_status_t errorStatus = SPINEL_STATUS_OK; - uint8_t *ext_address = NULL; + otError error = OT_ERROR_NONE; + spinel_status_t spinelError = SPINEL_STATUS_OK; + uint8_t *extAddress = NULL; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_EUI64_S, - &ext_address + &extAddress ); - VerifyOrExit(parsedLength > 0, errorStatus = SPINEL_STATUS_PARSE_ERROR); + VerifyOrExit(parsedLength > 0, spinelError = SPINEL_STATUS_PARSE_ERROR); - errorCode = otLinkRawSrcMatchAddExtEntry(mInstance, ext_address); + error = otLinkRawSrcMatchAddExtEntry(mInstance, extAddress); - VerifyOrExit(errorCode == OT_ERROR_NONE, - errorStatus = ThreadErrorToSpinelStatus(errorCode)); + VerifyOrExit(error == OT_ERROR_NONE, + spinelError = ThreadErrorToSpinelStatus(error)); - errorCode = - SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_INSERTED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_INSERTED, + aKey, + aValuePtr, + aValueLen + ); exit: - if (errorStatus != SPINEL_STATUS_OK) + if (spinelError != SPINEL_STATUS_OK) { - errorCode = SendLastStatus(header, errorStatus); + error = SendLastStatus(aHeader, spinelError); } - return errorCode; + return error; } #endif -otError NcpBase::InsertPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::InsertPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; - spinel_status_t errorStatus = SPINEL_STATUS_OK; - otNetifAddress netif_addr; - otIp6Address *addr_ptr; - uint32_t preferred_lifetime; - uint32_t valid_lifetime; - uint8_t prefix_len; + otError error = OT_ERROR_NONE; + spinel_status_t spinelError = SPINEL_STATUS_OK; + otNetifAddress netifAddr; + otIp6Address *addrPtr; + uint32_t preferredLifetime; + uint32_t validLifetime; + uint8_t prefixLen; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, ( SPINEL_DATATYPE_IPv6ADDR_S // IPv6 address SPINEL_DATATYPE_UINT8_S // Prefix length (in bits) SPINEL_DATATYPE_UINT32_S // Preferred lifetime SPINEL_DATATYPE_UINT32_S // Valid lifetime ), - &addr_ptr, - &prefix_len, - &preferred_lifetime, - &valid_lifetime + &addrPtr, + &prefixLen, + &preferredLifetime, + &validLifetime ); - VerifyOrExit(parsedLength > 0, errorStatus = SPINEL_STATUS_PARSE_ERROR); + VerifyOrExit(parsedLength > 0, spinelError = SPINEL_STATUS_PARSE_ERROR); - netif_addr.mAddress = *addr_ptr; - netif_addr.mPrefixLength = prefix_len; - netif_addr.mPreferred = preferred_lifetime != 0; - netif_addr.mValid = valid_lifetime != 0; + netifAddr.mAddress = *addrPtr; + netifAddr.mPrefixLength = prefixLen; + netifAddr.mPreferred = preferredLifetime != 0; + netifAddr.mValid = validLifetime != 0; - errorCode = otIp6AddUnicastAddress(mInstance, &netif_addr); + error = otIp6AddUnicastAddress(mInstance, &netifAddr); - VerifyOrExit(errorCode == OT_ERROR_NONE, - errorStatus = ThreadErrorToSpinelStatus(errorCode)); + VerifyOrExit(error == OT_ERROR_NONE, + spinelError = ThreadErrorToSpinelStatus(error)); - errorCode = SendPropertyUpdate( - header, + error = SendPropertyUpdate( + aHeader, SPINEL_CMD_PROP_VALUE_INSERTED, - key, - value_ptr, - value_len + aKey, + aValuePtr, + aValueLen ); - errorStatus = SPINEL_STATUS_OK; + spinelError = SPINEL_STATUS_OK; exit: - if (errorStatus != SPINEL_STATUS_OK) + if (spinelError != SPINEL_STATUS_OK) { - errorCode = SendLastStatus(header, errorStatus); + error = SendLastStatus(aHeader, spinelError); } - return errorCode; + return error; } #if OPENTHREAD_ENABLE_BORDER_ROUTER -otError NcpBase::InsertPropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::InsertPropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - otExternalRouteConfig ext_route_config; - otIp6Address *addr_ptr; + otExternalRouteConfig routeConfig; + otIp6Address *addrPtr; bool stable = false; uint8_t flags = 0; - memset(&ext_route_config, 0, sizeof(otExternalRouteConfig)); + memset(&routeConfig, 0, sizeof(otExternalRouteConfig)); VerifyOrExit( mAllowLocalNetworkDataChange == true, - errorCode = SendLastStatus(header, SPINEL_STATUS_INVALID_STATE) + error = SendLastStatus(aHeader, SPINEL_STATUS_INVALID_STATE) ); parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, ( SPINEL_DATATYPE_IPv6ADDR_S // Route prefix SPINEL_DATATYPE_UINT8_S // Prefix length (in bits) SPINEL_DATATYPE_BOOL_S // Stable SPINEL_DATATYPE_UINT8_S // Flags (Route Preference) ), - &addr_ptr, - &ext_route_config.mPrefix.mLength, + &addrPtr, + &routeConfig.mPrefix.mLength, &stable, &flags ); if (parsedLength > 0) { - ext_route_config.mPrefix.mPrefix = *addr_ptr; - ext_route_config.mStable = stable; - ext_route_config.mPreference = FlagByteToExternalRoutePreference(flags); + routeConfig.mPrefix.mPrefix = *addrPtr; + routeConfig.mStable = stable; + routeConfig.mPreference = FlagByteToExternalRoutePreference(flags); - errorCode = otBorderRouterAddRoute(mInstance, &ext_route_config); + error = otBorderRouterAddRoute(mInstance, &routeConfig); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_INSERTED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_INSERTED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } exit: - return errorCode; + return error; } -otError NcpBase::InsertPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::InsertPropertyHandler_THREAD_ON_MESH_NETS(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - otBorderRouterConfig border_router_config; - otIp6Address *addr_ptr; + otBorderRouterConfig borderRouterConfig; + otIp6Address *addrPtr; bool stable = false; uint8_t flags = 0; - memset(&border_router_config, 0, sizeof(otBorderRouterConfig)); + memset(&borderRouterConfig, 0, sizeof(otBorderRouterConfig)); VerifyOrExit( mAllowLocalNetworkDataChange == true, - errorCode = SendLastStatus(header, SPINEL_STATUS_INVALID_STATE) + error = SendLastStatus(aHeader, SPINEL_STATUS_INVALID_STATE) ); parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, ( SPINEL_DATATYPE_IPv6ADDR_S // On-mesh prefix SPINEL_DATATYPE_UINT8_S // Prefix length (in bits) SPINEL_DATATYPE_BOOL_S // Stable SPINEL_DATATYPE_UINT8_S // Flags ), - &addr_ptr, - &border_router_config.mPrefix.mLength, + &addrPtr, + &borderRouterConfig.mPrefix.mLength, &stable, &flags ); if (parsedLength > 0) { - border_router_config.mPrefix.mPrefix = *addr_ptr; - border_router_config.mStable = stable; - border_router_config.mPreference = + borderRouterConfig.mPrefix.mPrefix = *addrPtr; + borderRouterConfig.mStable = stable; + borderRouterConfig.mPreference = ((flags & SPINEL_NET_FLAG_PREFERENCE_MASK) >> SPINEL_NET_FLAG_PREFERENCE_OFFSET); - border_router_config.mPreferred = ((flags & SPINEL_NET_FLAG_PREFERRED) != 0); - border_router_config.mSlaac = ((flags & SPINEL_NET_FLAG_SLAAC) != 0); - border_router_config.mDhcp = ((flags & SPINEL_NET_FLAG_DHCP) != 0); - border_router_config.mConfigure = ((flags & SPINEL_NET_FLAG_CONFIGURE) != 0); - border_router_config.mDefaultRoute = ((flags & SPINEL_NET_FLAG_DEFAULT_ROUTE) != 0); - border_router_config.mOnMesh = ((flags & SPINEL_NET_FLAG_ON_MESH) != 0); + borderRouterConfig.mPreferred = ((flags & SPINEL_NET_FLAG_PREFERRED) != 0); + borderRouterConfig.mSlaac = ((flags & SPINEL_NET_FLAG_SLAAC) != 0); + borderRouterConfig.mDhcp = ((flags & SPINEL_NET_FLAG_DHCP) != 0); + borderRouterConfig.mConfigure = ((flags & SPINEL_NET_FLAG_CONFIGURE) != 0); + borderRouterConfig.mDefaultRoute = ((flags & SPINEL_NET_FLAG_DEFAULT_ROUTE) != 0); + borderRouterConfig.mOnMesh = ((flags & SPINEL_NET_FLAG_ON_MESH) != 0); - errorCode = otBorderRouterAddOnMeshPrefix(mInstance, &border_router_config); + error = otBorderRouterAddOnMeshPrefix(mInstance, &borderRouterConfig); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_INSERTED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_INSERTED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } exit: - return errorCode; + return error; } #endif // OPENTHREAD_ENABLE_BORDER_ROUTER -otError NcpBase::InsertPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::InsertPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; uint16_t port; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT16_S, &port ); if (parsedLength > 0) { - errorCode = otIp6AddUnsecurePort(mInstance, port); + error = otIp6AddUnsecurePort(mInstance, port); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_INSERTED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_INSERTED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } #if OPENTHREAD_ENABLE_MAC_WHITELIST -otError NcpBase::InsertPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::InsertPropertyHandler_MAC_WHITELIST(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; spinel_ssize_t parsedLength; - otExtAddress *ext_addr = NULL; + otExtAddress *extAddress = NULL; int8_t rssi = RSSI_OVERRIDE_DISABLED; - if (value_len > static_cast(sizeof(otExtAddress))) + if (aValueLen > static_cast(sizeof(otExtAddress))) { parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_EUI64_S SPINEL_DATATYPE_INT8_S, - &ext_addr, + &extAddress, &rssi ); } else { parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_EUI64_S, - &ext_addr + &extAddress ); } @@ -6893,149 +6880,149 @@ otError NcpBase::InsertPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop { if (rssi == RSSI_OVERRIDE_DISABLED) { - errorCode = otLinkAddWhitelist(mInstance, ext_addr->m8); + error = otLinkAddWhitelist(mInstance, extAddress->m8); } else { - errorCode = otLinkAddWhitelistRssi(mInstance, ext_addr->m8, rssi); + error = otLinkAddWhitelistRssi(mInstance, extAddress->m8, rssi); } - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_INSERTED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_INSERTED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } -otError NcpBase::InsertPropertyHandler_MAC_BLACKLIST(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::InsertPropertyHandler_MAC_BLACKLIST(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; spinel_ssize_t parsedLength; - otExtAddress *ext_addr = NULL; + otExtAddress *extAddress = NULL; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_EUI64_S, - &ext_addr + &extAddress ); if (parsedLength > 0) { - errorCode = otLinkAddBlacklist(mInstance, ext_addr->m8); + error = otLinkAddBlacklist(mInstance, extAddress->m8); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_INSERTED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_INSERTED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } #endif // OPENTHREAD_ENABLE_MAC_WHITELIST #if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD -otError NcpBase::InsertPropertyHandler_THREAD_JOINERS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::InsertPropertyHandler_THREAD_JOINERS(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; - otExtAddress *ot_ext_address = NULL; + otExtAddress *extAddress = NULL; const char *aPSKd = NULL; - uint32_t joiner_timeout = 0; + uint32_t joinerTimeout = 0; VerifyOrExit( mAllowLocalNetworkDataChange == true, - errorCode = SendLastStatus(header, SPINEL_STATUS_INVALID_STATE) + error = SendLastStatus(aHeader, SPINEL_STATUS_INVALID_STATE) ); parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, ( SPINEL_DATATYPE_UTF8_S // PSK SPINEL_DATATYPE_UINT32_S // Timeout SPINEL_DATATYPE_EUI64_S // Extended address ), &aPSKd, - &joiner_timeout, - &ot_ext_address + &joinerTimeout, + &extAddress ); if (parsedLength <= 0) { parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, ( SPINEL_DATATYPE_UTF8_S // PSK SPINEL_DATATYPE_UINT32_S // Timeout ), &aPSKd, - &joiner_timeout + &joinerTimeout ); - ot_ext_address = NULL; + extAddress = NULL; } if (parsedLength > 0) { - errorCode = otCommissionerAddJoiner(mInstance, ot_ext_address, aPSKd, joiner_timeout); + error = otCommissionerAddJoiner(mInstance, extAddress, aPSKd, joinerTimeout); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_INSERTED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_INSERTED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } exit: - return errorCode; + return error; } #endif // OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD @@ -7045,395 +7032,395 @@ exit: #if OPENTHREAD_ENABLE_RAW_LINK_API -otError NcpBase::RemovePropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::RemovePropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; - uint16_t short_address; + otError error = OT_ERROR_NONE; + uint16_t shortAddress; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT16_S, - &short_address + &shortAddress ); if (parsedLength > 0) { - errorCode = otLinkRawSrcMatchClearShortEntry(mInstance, short_address); + error = otLinkRawSrcMatchClearShortEntry(mInstance, shortAddress); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_REMOVED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_REMOVED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } -otError NcpBase::RemovePropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::RemovePropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; - uint8_t *ext_address; + otError error = OT_ERROR_NONE; + uint8_t *extAddress; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_EUI64_S, - &ext_address + &extAddress ); if (parsedLength > 0) { - errorCode = otLinkRawSrcMatchClearExtEntry(mInstance, ext_address); + error = otLinkRawSrcMatchClearExtEntry(mInstance, extAddress); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_REMOVED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_REMOVED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } #endif -otError NcpBase::RemovePropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::RemovePropertyHandler_IPV6_ADDRESS_TABLE(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; - otIp6Address *addr_ptr; + otError error = OT_ERROR_NONE; + otIp6Address *addrPtr; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_IPv6ADDR_S, - &addr_ptr + &addrPtr ); if (parsedLength > 0) { - errorCode = otIp6RemoveUnicastAddress(mInstance, addr_ptr); + error = otIp6RemoveUnicastAddress(mInstance, addrPtr); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_REMOVED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_REMOVED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } #if OPENTHREAD_ENABLE_BORDER_ROUTER -otError NcpBase::RemovePropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::RemovePropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; + otIp6Prefix ip6Prefix; + otIp6Address *addrPtr; - otIp6Prefix ip6_prefix; - memset(&ip6_prefix, 0, sizeof(otIp6Prefix)); - otIp6Address *addr_ptr; + memset(&ip6Prefix, 0, sizeof(otIp6Prefix)); VerifyOrExit( mAllowLocalNetworkDataChange == true, - errorCode = SendLastStatus(header, SPINEL_STATUS_INVALID_STATE) + error = SendLastStatus(aHeader, SPINEL_STATUS_INVALID_STATE) ); parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, ( SPINEL_DATATYPE_IPv6ADDR_S // Route prefix SPINEL_DATATYPE_UINT8_S // Prefix length (in bits) ), - &addr_ptr, - &ip6_prefix.mLength + &addrPtr, + &ip6Prefix.mLength ); if (parsedLength > 0) { - ip6_prefix.mPrefix = *addr_ptr; - errorCode = otBorderRouterRemoveRoute(mInstance, &ip6_prefix); + ip6Prefix.mPrefix = *addrPtr; + error = otBorderRouterRemoveRoute(mInstance, &ip6Prefix); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_REMOVED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_REMOVED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } exit: - return errorCode; + return error; } -otError NcpBase::RemovePropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::RemovePropertyHandler_THREAD_ON_MESH_NETS(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; + otIp6Prefix ip6Prefix; + otIp6Address *addrPtr; - otIp6Prefix ip6_prefix; - memset(&ip6_prefix, 0, sizeof(otIp6Prefix)); - otIp6Address *addr_ptr; + memset(&ip6Prefix, 0, sizeof(otIp6Prefix)); VerifyOrExit( mAllowLocalNetworkDataChange == true, - errorCode = SendLastStatus(header, SPINEL_STATUS_INVALID_STATE) + error = SendLastStatus(aHeader, SPINEL_STATUS_INVALID_STATE) ); parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, ( SPINEL_DATATYPE_IPv6ADDR_S // On-mesh prefix SPINEL_DATATYPE_UINT8_S // Prefix length (in bits) ), - &addr_ptr, - &ip6_prefix.mLength + &addrPtr, + &ip6Prefix.mLength ); if (parsedLength > 0) { - ip6_prefix.mPrefix = *addr_ptr; - errorCode = otBorderRouterRemoveOnMeshPrefix(mInstance, &ip6_prefix); + ip6Prefix.mPrefix = *addrPtr; + error = otBorderRouterRemoveOnMeshPrefix(mInstance, &ip6Prefix); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_REMOVED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_REMOVED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } exit: - return errorCode; + return error; } #endif -otError NcpBase::RemovePropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::RemovePropertyHandler_THREAD_ASSISTING_PORTS(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; uint16_t port; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT16_S, &port ); if (parsedLength > 0) { - errorCode = otIp6RemoveUnsecurePort(mInstance, port); + error = otIp6RemoveUnsecurePort(mInstance, port); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_REMOVED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_REMOVED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } #if OPENTHREAD_FTD -otError NcpBase::RemovePropertyHandler_THREAD_ACTIVE_ROUTER_IDS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::RemovePropertyHandler_THREAD_ACTIVE_ROUTER_IDS(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { spinel_ssize_t parsedLength; - otError errorCode = OT_ERROR_NONE; - uint8_t router_id; + otError error = OT_ERROR_NONE; + uint8_t routerId; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_UINT8_S, - &router_id + &routerId ); if (parsedLength > 0) { - errorCode = otThreadReleaseRouterId(mInstance, router_id); + error = otThreadReleaseRouterId(mInstance, routerId); - if (errorCode == OT_ERROR_NONE) + if (error == OT_ERROR_NONE) { - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_REMOVED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_REMOVED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode)); + error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } #endif // OPENTHREAD_FTD #if OPENTHREAD_ENABLE_MAC_WHITELIST -otError NcpBase::RemovePropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::RemovePropertyHandler_MAC_WHITELIST(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; spinel_ssize_t parsedLength; - otExtAddress *ext_addr_ptr = NULL; + otExtAddress *extAddress = NULL; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_EUI64_S, - &ext_addr_ptr + &extAddress ); if (parsedLength > 0) { - otLinkRemoveWhitelist(mInstance, ext_addr_ptr->m8); + otLinkRemoveWhitelist(mInstance, extAddress->m8); - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_REMOVED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_REMOVED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } -otError NcpBase::RemovePropertyHandler_MAC_BLACKLIST(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len) +otError NcpBase::RemovePropertyHandler_MAC_BLACKLIST(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; spinel_ssize_t parsedLength; - otExtAddress *ext_addr_ptr = NULL; + otExtAddress *extAddress = NULL; parsedLength = spinel_datatype_unpack( - value_ptr, - value_len, + aValuePtr, + aValueLen, SPINEL_DATATYPE_EUI64_S, - &ext_addr_ptr + &extAddress ); if (parsedLength > 0) { - otLinkRemoveBlacklist(mInstance, ext_addr_ptr->m8); + otLinkRemoveBlacklist(mInstance, extAddress->m8); - errorCode = SendPropertyUpdate( - header, - SPINEL_CMD_PROP_VALUE_REMOVED, - key, - value_ptr, - value_len - ); + error = SendPropertyUpdate( + aHeader, + SPINEL_CMD_PROP_VALUE_REMOVED, + aKey, + aValuePtr, + aValueLen + ); } else { - errorCode = SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR); + error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - return errorCode; + return error; } #endif // OPENTHREAD_ENABLE_MAC_WHITELIST @@ -7519,7 +7506,7 @@ exit: otError NcpBase::StreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; if (aStreamId == 0) { @@ -7528,20 +7515,20 @@ otError NcpBase::StreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLe if (!mDisableStreamWrite) { - errorCode = SendPropertyUpdate( - SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, - SPINEL_CMD_PROP_VALUE_IS, - static_cast(aStreamId), - aDataPtr, - static_cast(aDataLen) - ); + error = SendPropertyUpdate( + SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, + SPINEL_CMD_PROP_VALUE_IS, + static_cast(aStreamId), + aDataPtr, + static_cast(aDataLen) + ); } else { - errorCode = OT_ERROR_INVALID_STATE; + error = OT_ERROR_INVALID_STATE; } - return errorCode; + return error; } #if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE @@ -7563,15 +7550,15 @@ void NcpBase::RegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDel otError otNcpStreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen) { - otError errorCode = OT_ERROR_INVALID_STATE; + otError error = OT_ERROR_INVALID_STATE; ot::NcpBase *ncp = ot::NcpBase::GetNcpInstance(); if (ncp != NULL) { - errorCode = ncp->StreamWrite(aStreamId, aDataPtr, aDataLen); + error = ncp->StreamWrite(aStreamId, aDataPtr, aDataLen); } - return errorCode; + return error; } // ---------------------------------------------------------------------------- @@ -7581,7 +7568,7 @@ otError otNcpStreamWrite(int aStreamId, const uint8_t *aDataPtr, int aDataLen) otError otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDelegate, otNcpDelegateAllowPeekPoke aAllowPokeDelegate) { - otError errorCode = OT_ERROR_NONE; + otError error = OT_ERROR_NONE; #if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE ot::NcpBase *ncp = ot::NcpBase::GetNcpInstance(); @@ -7594,11 +7581,11 @@ otError otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDele (void)aAllowPeekDelegate; (void)aAllowPokeDelegate; - errorCode = OT_ERROR_DISABLED_FEATURE; + error = OT_ERROR_DISABLED_FEATURE; #endif // OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE - return errorCode; + return error; } // ---------------------------------------------------------------------------- diff --git a/src/ncp/ncp_base.hpp b/src/ncp/ncp_base.hpp index 3ddcc465f..fade937b9 100644 --- a/src/ncp/ncp_base.hpp +++ b/src/ncp/ncp_base.hpp @@ -129,7 +129,7 @@ protected: /** * Called by the subclass to indicate when a frame has been received. */ - void HandleReceive(const uint8_t *buf, uint16_t bufLength); + void HandleReceive(const uint8_t *aBuf, uint16_t aBufLength); /** * Called by the subclass to learn when the host wake operation must be issued. @@ -148,140 +148,91 @@ private: NcpFrameBuffer::FrameTag GetLastOutboundFrameTag(void); #if OPENTHREAD_ENABLE_TMF_PROXY && OPENTHREAD_FTD - /** - * Trampoline for HandleTmfProxyStream(). - */ static void HandleTmfProxyStream(otMessage *aMessage, uint16_t aLocator, uint16_t aPort, void *aContext); - void HandleTmfProxyStream(otMessage *aMessage, uint16_t aLocator, uint16_t aPort); #endif // OPENTHREAD_ENABLE_TMF_PROXY && OPENTHREAD_FTD - /** - * Trampoline for NcpFrameBuffer FrameRemoved Callback. - */ static void HandleFrameRemovedFromNcpBuffer(void *aContext, NcpFrameBuffer::FrameTag aFrameTag, NcpFrameBuffer *aNcpBuffer); - void HandleFrameRemovedFromNcpBuffer(NcpFrameBuffer::FrameTag aFrameTag); - /** - * Trampoline for HandleDatagramFromStack(). - */ static void HandleDatagramFromStack(otMessage *aMessage, void *aContext); - void HandleDatagramFromStack(otMessage *aMessage); - /** - * Trampoline for HandleRawFrame(). - */ static void HandleRawFrame(const otRadioFrame *aFrame, void *aContext); - void HandleRawFrame(const otRadioFrame *aFrame); - /** - * Trampoline for HandleActiveScanResult(). - */ - static void HandleActiveScanResult_Jump(otActiveScanResult *result, void *aContext); + static void HandleActiveScanResult_Jump(otActiveScanResult *aResult, void *aContext); + void HandleActiveScanResult(otActiveScanResult *aResult); - void HandleActiveScanResult(otActiveScanResult *result); - - /** - * Trampoline for HandleEnergyScanResult(). - */ static void HandleEnergyScanResult_Jump(otEnergyScanResult *aResult, void *aContext); + void HandleEnergyScanResult(otEnergyScanResult *aResult); - void HandleEnergyScanResult(otEnergyScanResult *result); - - /** - * Trampoline for HandleJamStateChange(). - */ static void HandleJamStateChange_Jump(bool aJamState, void *aContext); - void HandleJamStateChange(bool aJamState); - /** - * Trampoline for UpdateChangedProps(). - */ - static void UpdateChangedProps(void *context); - + static void UpdateChangedProps(void *aContext); void UpdateChangedProps(void); - /** - * Trampoline for SendDoneTask(). - */ - static void SendDoneTask(void *context); - + static void SendDoneTask(void *aContext); void SendDoneTask(void); #if OPENTHREAD_ENABLE_RAW_LINK_API - /** - * Trampoline for LinkRawReceiveDone(). - */ static void LinkRawReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError); - void LinkRawReceiveDone(otRadioFrame *aFrame, otError aError); - /** - * Trampoline for LinkRawTransmitDone(). - */ - static void LinkRawTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, bool aFramePending, - otError aError); - + static void LinkRawTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, bool aFramePending, otError aError); void LinkRawTransmitDone(otRadioFrame *aFrame, bool aFramePending, otError aError); - /** - * Trampoline for LinkRawEnergyScanDone(). - */ static void LinkRawEnergyScanDone(otInstance *aInstance, int8_t aEnergyScanMaxRssi); - void LinkRawEnergyScanDone(int8_t aEnergyScanMaxRssi); #endif // OPENTHREAD_ENABLE_RAW_LINK_API - static void HandleNetifStateChanged(uint32_t flags, void *context); + static void HandleNetifStateChanged(uint32_t aFlags, void *aContext); private: - otError OutboundFrameFeedPacked(const char *pack_format, ...); + otError OutboundFrameFeedPacked(const char *aPackFormat, ...); - otError OutboundFrameFeedVPacked(const char *pack_format, va_list args); + otError OutboundFrameFeedVPacked(const char *aPackFormat, va_list aArgs); private: - otError HandleCommand(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len); + otError HandleCommand(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); - otError HandleCommandPropertyGet(uint8_t header, spinel_prop_key_t key); + otError HandleCommandPropertyGet(uint8_t aHeader, spinel_prop_key_t aKey); - otError HandleCommandPropertySet(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError HandleCommandPropertySet(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen); - otError HandleCommandPropertyInsert(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError HandleCommandPropertyInsert(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen); - otError HandleCommandPropertyRemove(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError HandleCommandPropertyRemove(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen); - otError SendLastStatus(uint8_t header, spinel_status_t lastStatus); + otError SendLastStatus(uint8_t aHeader, spinel_status_t aLastStatus); private: - otError SendPropertyUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError SendPropertyUpdate(uint8_t aHeader, uint8_t aCommand, spinel_prop_key_t aKey, const uint8_t *aValuePtr, + uint16_t aValueLen); - otError SendPropertyUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, otMessage *message); + otError SendPropertyUpdate(uint8_t aHeader, uint8_t aCommand, spinel_prop_key_t aKey, otMessage *message); - otError SendPropertyUpdate(uint8_t header, uint8_t command, spinel_prop_key_t key, const char *format, ...); + otError SendPropertyUpdate(uint8_t aHeader, uint8_t aCommand, spinel_prop_key_t aKey, const char *format, ...); private: - typedef otError(NcpBase::*CommandHandlerType)(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len); + typedef otError(NcpBase::*CommandHandlerType)(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, + uint16_t aArgLen); - typedef otError(NcpBase::*GetPropertyHandlerType)(uint8_t header, spinel_prop_key_t key); + typedef otError(NcpBase::*GetPropertyHandlerType)(uint8_t aHeader, spinel_prop_key_t aKey); - typedef otError(NcpBase::*SetPropertyHandlerType)(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + typedef otError(NcpBase::*SetPropertyHandlerType)(uint8_t aHeader, spinel_prop_key_t aKey, + const uint8_t *aValuePtr, uint16_t aValueLen); struct CommandHandlerEntry { @@ -319,359 +270,255 @@ private: static const InsertPropertyHandlerEntry mInsertPropertyHandlerTable[]; static const RemovePropertyHandlerEntry mRemovePropertyHandlerTable[]; - otError CommandHandler_NOOP(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len); - otError CommandHandler_RESET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len); - otError CommandHandler_PROP_VALUE_GET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len); - otError CommandHandler_PROP_VALUE_SET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len); - otError CommandHandler_PROP_VALUE_INSERT(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len); - otError CommandHandler_PROP_VALUE_REMOVE(uint8_t header, unsigned int command, const uint8_t *arg_ptr, - uint16_t arg_len); - otError CommandHandler_NET_SAVE(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len); - otError CommandHandler_NET_CLEAR(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len); - otError CommandHandler_NET_RECALL(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len); + otError CommandHandler_NOOP(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); + otError CommandHandler_RESET(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); + otError CommandHandler_PROP_VALUE_GET(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); + otError CommandHandler_PROP_VALUE_SET(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); + otError CommandHandler_PROP_VALUE_INSERT(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); + otError CommandHandler_PROP_VALUE_REMOVE(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); + otError CommandHandler_NET_SAVE(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); + otError CommandHandler_NET_CLEAR(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); + otError CommandHandler_NET_RECALL(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); #if OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE - otError CommandHandler_PEEK(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len); - otError CommandHandler_POKE(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len); + otError CommandHandler_PEEK(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); + otError CommandHandler_POKE(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen); #endif - otError GetPropertyHandler_ChannelMaskHelper(uint8_t header, spinel_prop_key_t key, uint32_t channel_mask); + otError GetPropertyHandler_ChannelMaskHelper(uint8_t aHeader, spinel_prop_key_t aKey, uint32_t channel_mask); - otError GetPropertyHandler_LAST_STATUS(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_PROTOCOL_VERSION(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_INTERFACE_TYPE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_VENDOR_ID(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_CAPS(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NCP_VERSION(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_INTERFACE_COUNT(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_POWER_STATE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_HWADDR(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_LOCK(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_HOST_POWER_STATE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_PHY_FREQ(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_PHY_CHAN_SUPPORTED(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_PHY_RSSI(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_PHY_TX_POWER(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_PHY_RX_SENSITIVITY(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_15_4_PANID(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_15_4_LADDR(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_15_4_SADDR(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_EXTENDED_ADDR(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_SAVED(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_IF_UP(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_STACK_UP(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_NETWORK_NAME(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_XPANID(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_MASTER_KEY(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_KEY_SEQUENCE_COUNTER(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_PARTITION_ID(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_LEADER(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_IPV6_ML_PREFIX(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_IPV6_ML_ADDR(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_IPV6_LL_ADDR(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_IPV6_ROUTE_TABLE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_IPV6_ICMP_PING_OFFLOAD(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_RLOC16_DEBUG_PASSTHRU(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_SCAN_MASK(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_SCAN_PERIOD(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_LEADER_ADDR(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_PARENT(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_NEIGHBOR_TABLE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_LEADER_RID(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key); + otError GetPropertyHandler_LAST_STATUS(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_PROTOCOL_VERSION(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_INTERFACE_TYPE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_VENDOR_ID(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_CAPS(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NCP_VERSION(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_INTERFACE_COUNT(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_POWER_STATE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_HWADDR(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_LOCK(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_HOST_POWER_STATE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_PHY_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_PHY_FREQ(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_PHY_CHAN_SUPPORTED(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_PHY_CHAN(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_PHY_RSSI(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_PHY_TX_POWER(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_PHY_RX_SENSITIVITY(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_SCAN_STATE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_15_4_PANID(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_15_4_LADDR(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_15_4_SADDR(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_EXTENDED_ADDR(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_SAVED(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_IF_UP(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_STACK_UP(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_ROLE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_NETWORK_NAME(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_XPANID(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_MASTER_KEY(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_KEY_SEQUENCE_COUNTER(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_PARTITION_ID(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_LEADER(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_IPV6_ML_PREFIX(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_IPV6_ML_ADDR(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_IPV6_LL_ADDR(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_IPV6_ROUTE_TABLE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_IPV6_ICMP_PING_OFFLOAD(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_RLOC16_DEBUG_PASSTHRU(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_STREAM_NET(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_SCAN_MASK(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_SCAN_PERIOD(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_LEADER_ADDR(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_PARENT(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_NEIGHBOR_TABLE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_LEADER_RID(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_LEADER_WEIGHT(uint8_t aHeader, spinel_prop_key_t aKey); #if OPENTHREAD_ENABLE_BORDER_ROUTER - otError GetPropertyHandler_THREAD_NETWORK_DATA(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_STABLE_NETWORK_DATA(uint8_t header, spinel_prop_key_t key); + otError GetPropertyHandler_THREAD_NETWORK_DATA(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_STABLE_NETWORK_DATA(uint8_t aHeader, spinel_prop_key_t aKey); #endif - otError GetPropertyHandler_THREAD_NETWORK_DATA_VERSION(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_STABLE_NETWORK_DATA_VERSION(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_LEADER_NETWORK_DATA(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_STABLE_LEADER_NETWORK_DATA(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_CNTR(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NCP_CNTR(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_IP_CNTR(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MSG_BUFFER_COUNTERS(uint8_t header, spinel_prop_key_t key); + otError GetPropertyHandler_THREAD_NETWORK_DATA_VERSION(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_STABLE_NETWORK_DATA_VERSION(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_LEADER_NETWORK_DATA(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_STABLE_LEADER_NETWORK_DATA(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_CNTR(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NCP_CNTR(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_IP_CNTR(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MSG_BUFFER_COUNTERS(uint8_t aHeader, spinel_prop_key_t aKey); #if OPENTHREAD_ENABLE_MAC_WHITELIST - otError GetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_BLACKLIST(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_MAC_BLACKLIST_ENABLED(uint8_t header, spinel_prop_key_t key); + otError GetPropertyHandler_MAC_WHITELIST(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_BLACKLIST(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_MAC_BLACKLIST_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey); #endif - otError GetPropertyHandler_THREAD_MODE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_RLOC16(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_DEBUG_TEST_ASSERT(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_DISCOVERY_SCAN_JOINER_FLAG(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_DISCOVERY_SCAN_PANID(uint8_t header, spinel_prop_key_t key); - + otError GetPropertyHandler_THREAD_MODE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_RLOC16(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_ON_MESH_NETS(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_DEBUG_TEST_ASSERT(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_DISCOVERY_SCAN_JOINER_FLAG(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_DISCOVERY_SCAN_PANID(uint8_t aHeader, spinel_prop_key_t aKey); #if OPENTHREAD_FTD - otError GetPropertyHandler_THREAD_CHILD_TABLE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_NET_PSKC(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t header, spinel_prop_key_t key); + otError GetPropertyHandler_THREAD_CHILD_TABLE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_NET_PSKC(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t aHeader, spinel_prop_key_t aKey); #endif // #if OPENTHREAD_FTD - #if OPENTHREAD_ENABLE_COMMISSIONER - otError GetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t header, spinel_prop_key_t key); + otError GetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey); #endif - - otError GetPropertyHandler_TMF_PROXY_ENABLED(uint8_t header, spinel_prop_key_t key); - + otError GetPropertyHandler_TMF_PROXY_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey); #if OPENTHREAD_ENABLE_JAM_DETECTION - otError GetPropertyHandler_JAM_DETECT_ENABLE(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_JAM_DETECTED(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_JAM_DETECT_RSSI_THRESHOLD(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_JAM_DETECT_WINDOW(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_JAM_DETECT_BUSY(uint8_t header, spinel_prop_key_t key); - otError GetPropertyHandler_JAM_DETECT_HISTORY_BITMAP(uint8_t header, spinel_prop_key_t key); + otError GetPropertyHandler_JAM_DETECT_ENABLE(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_JAM_DETECTED(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_JAM_DETECT_RSSI_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_JAM_DETECT_WINDOW(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_JAM_DETECT_BUSY(uint8_t aHeader, spinel_prop_key_t aKey); + otError GetPropertyHandler_JAM_DETECT_HISTORY_BITMAP(uint8_t aHeader, spinel_prop_key_t aKey); #endif - #if OPENTHREAD_ENABLE_LEGACY - otError GetPropertyHandler_NEST_LEGACY_ULA_PREFIX(uint8_t header, spinel_prop_key_t key); + otError GetPropertyHandler_NEST_LEGACY_ULA_PREFIX(uint8_t aHeader, spinel_prop_key_t aKey); #endif otError SendSetPropertyResponse(uint8_t aHeader, spinel_prop_key_t aKey, otError aError); - otError SetPropertyHandler_POWER_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_HOST_POWER_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_PHY_TX_POWER(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_MAC_SCAN_MASK(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_MAC_SCAN_STATE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_MAC_15_4_PANID(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_MAC_15_4_LADDR(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - + otError SetPropertyHandler_POWER_STATE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_HOST_POWER_STATE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_PHY_TX_POWER(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_PHY_CHAN(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_SCAN_MASK(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_SCAN_STATE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_15_4_PANID(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_15_4_LADDR(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_RAW_STREAM_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_ENABLE_RAW_LINK_API - otError SetPropertyHandler_MAC_15_4_SADDR(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_STREAM_RAW(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); -#endif // OPENTHREAD_ENABLE_RAW_LINK_API - - otError SetPropertyHandler_NET_IF_UP(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_NET_STACK_UP(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_NET_ROLE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_NET_NETWORK_NAME(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_NET_XPANID(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_NET_MASTER_KEY(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_NET_KEY_SEQUENCE_COUNTER(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_STREAM_NET_INSECURE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_IPV6_ML_PREFIX(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_IPV6_ICMP_PING_OFFLOAD(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_RLOC16_DEBUG_PASSTHRU(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - - otError SetPropertyHandler_THREAD_TMF_PROXY_STREAM(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError SetPropertyHandler_MAC_15_4_SADDR(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_STREAM_RAW(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); +#endif + otError SetPropertyHandler_NET_IF_UP(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_NET_STACK_UP(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_NET_ROLE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_NET_NETWORK_NAME(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_NET_XPANID(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_NET_MASTER_KEY(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_NET_KEY_SEQUENCE_COUNTER(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_NET_KEY_SWITCH_GUARDTIME(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_STREAM_NET_INSECURE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_STREAM_NET(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_IPV6_ML_PREFIX(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_IPV6_ICMP_PING_OFFLOAD(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_RLOC16_DEBUG_PASSTHRU(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_TMF_PROXY_STREAM(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_ENABLE_RAW_LINK_API - otError SetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); -#endif // OPENTHREAD_ENABLE_RAW_LINK_API - - otError SetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_MAC_SCAN_PERIOD(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError SetPropertyHandler_PHY_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); +#endif + otError SetPropertyHandler_MAC_PROMISCUOUS_MODE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_SCAN_PERIOD(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_ENABLE_MAC_WHITELIST - otError SetPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_MAC_BLACKLIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_MAC_BLACKLIST_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError SetPropertyHandler_MAC_WHITELIST(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_WHITELIST_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_BLACKLIST(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_BLACKLIST_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif #if OPENTHREAD_ENABLE_RAW_LINK_API - otError SetPropertyHandler_MAC_SRC_MATCH_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError SetPropertyHandler_MAC_SRC_MATCH_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif -#if OPENTHREAD_FTD - otError SetPropertyHandler_NET_PSKC(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); -#endif - otError SetPropertyHandler_THREAD_MODE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - + otError SetPropertyHandler_THREAD_MODE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_ENABLE_BORDER_ROUTER - otError SetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError SetPropertyHandler_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif - #if OPENTHREAD_FTD - otError SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_PREFERRED_ROUTER_ID(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError SetPropertyHandler_NET_PSKC(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_LOCAL_LEADER_WEIGHT(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_CHILD_COUNT_MAX(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_CHILD_TIMEOUT(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_ROUTER_UPGRADE_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_ROUTER_DOWNGRADE_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_ROUTER_SELECTION_JITTER(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_CONTEXT_REUSE_DELAY(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_NETWORK_ID_TIMEOUT(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_PREFERRED_ROUTER_ID(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_ROUTER_ROLE_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB - otError SetPropertyHandler_THREAD_THREAD_STEERING_DATA(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError SetPropertyHandler_THREAD_THREAD_STEERING_DATA(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif - #endif // #if OPENTHREAD_FTD - - otError SetPropertyHandler_THREAD_DISCOVERY_SCAN_JOINER_FLAG(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_DISCOVERY_SCAN_PANID(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_CNTR_RESET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError SetPropertyHandler_THREAD_DISCOVERY_SCAN_JOINER_FLAG(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_DISCOVERY_SCAN_PANID(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_NET_REQUIRE_JOIN_EXISTING(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_CNTR_RESET(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_DEBUG_NCP_LOG_LEVEL(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_ENABLE_COMMISSIONER - otError SetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError SetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif - - otError SetPropertyHandler_TMF_PROXY_ENABLED(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError SetPropertyHandler_TMF_PROXY_ENABLED(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_ENABLE_JAM_DETECTION - otError SetPropertyHandler_JAM_DETECT_ENABLE(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_JAM_DETECT_RSSI_THRESHOLD(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError SetPropertyHandler_JAM_DETECT_WINDOW(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError SetPropertyHandler_JAM_DETECT_BUSY(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError SetPropertyHandler_JAM_DETECT_ENABLE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_JAM_DETECT_RSSI_THRESHOLD(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_JAM_DETECT_WINDOW(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError SetPropertyHandler_JAM_DETECT_BUSY(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif - #if OPENTHREAD_ENABLE_DIAG - otError SetPropertyHandler_NEST_STREAM_MFG(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError SetPropertyHandler_NEST_STREAM_MFG(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif - #if OPENTHREAD_ENABLE_LEGACY - otError SetPropertyHandler_NEST_LEGACY_ULA_PREFIX(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError SetPropertyHandler_NEST_LEGACY_ULA_PREFIX(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif #if OPENTHREAD_ENABLE_RAW_LINK_API - otError InsertPropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError InsertPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError InsertPropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError InsertPropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif - otError InsertPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError InsertPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_ENABLE_BORDER_ROUTER - otError InsertPropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError InsertPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError InsertPropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError InsertPropertyHandler_THREAD_ON_MESH_NETS(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif - otError InsertPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError InsertPropertyHandler_THREAD_ASSISTING_PORTS(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_ENABLE_MAC_WHITELIST - otError InsertPropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError InsertPropertyHandler_MAC_BLACKLIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError InsertPropertyHandler_MAC_WHITELIST(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError InsertPropertyHandler_MAC_BLACKLIST(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif #if OPENTHREAD_ENABLE_COMMISSIONER - otError InsertPropertyHandler_THREAD_JOINERS(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError InsertPropertyHandler_THREAD_JOINERS(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif #if OPENTHREAD_ENABLE_RAW_LINK_API - otError RemovePropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError RemovePropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError RemovePropertyHandler_MAC_SRC_MATCH_SHORT_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError RemovePropertyHandler_MAC_SRC_MATCH_EXTENDED_ADDRESSES(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif - otError RemovePropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError RemovePropertyHandler_IPV6_ADDRESS_TABLE(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_ENABLE_BORDER_ROUTER - otError RemovePropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); - otError RemovePropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError RemovePropertyHandler_THREAD_OFF_MESH_ROUTES(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError RemovePropertyHandler_THREAD_ON_MESH_NETS(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif - otError RemovePropertyHandler_THREAD_ASSISTING_PORTS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError RemovePropertyHandler_THREAD_ASSISTING_PORTS(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #if OPENTHREAD_ENABLE_MAC_WHITELIST - otError RemovePropertyHandler_MAC_WHITELIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); - otError RemovePropertyHandler_MAC_BLACKLIST(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr, - uint16_t value_len); + otError RemovePropertyHandler_MAC_WHITELIST(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); + otError RemovePropertyHandler_MAC_BLACKLIST(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif #if OPENTHREAD_FTD - otError RemovePropertyHandler_THREAD_ACTIVE_ROUTER_IDS(uint8_t header, spinel_prop_key_t key, - const uint8_t *value_ptr, uint16_t value_len); + otError RemovePropertyHandler_THREAD_ACTIVE_ROUTER_IDS(uint8_t aHeader, spinel_prop_key_t aKey, const uint8_t *aValuePtr, uint16_t aValueLen); #endif public: