mirror of
https://github.com/espressif/openthread.git
synced 2026-09-14 05:00:11 +00:00
[ncp] fix get property handler of SRP SERVER (#10967)
This commit fixes the wrong implementation of the GetProperty handler of `SPINEL_PROP_SRP_SERVER_ENABLED` and `SPINEL_PROP_SRP_SERVER_AUTO_ENABLE_MODE`. In GetProperty handlers only the body should be written. It doesn't need to and shouldn't call `BeginFrame` and `EndFrame`. If using `BeginFrame` here, it will get an error of INVALID_STATE.
This commit is contained in:
@@ -1523,16 +1523,9 @@ exit:
|
|||||||
|
|
||||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_SERVER_ENABLED>(void)
|
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_SERVER_ENABLED>(void)
|
||||||
{
|
{
|
||||||
otError error = OT_ERROR_NONE;
|
|
||||||
uint8_t header = SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0;
|
|
||||||
otSrpServerState srpServerState = otSrpServerGetState(mInstance);
|
otSrpServerState srpServerState = otSrpServerGetState(mInstance);
|
||||||
|
|
||||||
SuccessOrExit(error = mEncoder.BeginFrame(header, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_SRP_SERVER_ENABLED));
|
return mEncoder.WriteBool(srpServerState != OT_SRP_SERVER_STATE_DISABLED);
|
||||||
SuccessOrExit(error = mEncoder.WriteBool(srpServerState != OT_SRP_SERVER_STATE_DISABLED));
|
|
||||||
SuccessOrExit(error = mEncoder.EndFrame());
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
#if OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||||
@@ -1550,16 +1543,7 @@ exit:
|
|||||||
|
|
||||||
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_SERVER_AUTO_ENABLE_MODE>(void)
|
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_SERVER_AUTO_ENABLE_MODE>(void)
|
||||||
{
|
{
|
||||||
otError error = OT_ERROR_NONE;
|
return mEncoder.WriteBool(otSrpServerIsAutoEnableMode(mInstance));
|
||||||
uint8_t header = SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0;
|
|
||||||
|
|
||||||
SuccessOrExit(error =
|
|
||||||
mEncoder.BeginFrame(header, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_SRP_SERVER_AUTO_ENABLE_MODE));
|
|
||||||
SuccessOrExit(error = mEncoder.WriteBool(otSrpServerIsAutoEnableMode(mInstance)));
|
|
||||||
SuccessOrExit(error = mEncoder.EndFrame());
|
|
||||||
|
|
||||||
exit:
|
|
||||||
return error;
|
|
||||||
}
|
}
|
||||||
#endif // OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
#endif // OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE
|
||||||
#endif // OPENTHREAD_CONFIG_SRP_SERVER_ENABLE
|
#endif // OPENTHREAD_CONFIG_SRP_SERVER_ENABLE
|
||||||
|
|||||||
Reference in New Issue
Block a user