mirror of
https://github.com/espressif/openthread.git
synced 2026-07-09 22:00:19 +00:00
Clean up CoAP CLI. (#1864)
- Change static methods into class methods. - Remove client/server distinction. - Fix callback method types and remove unnecessary type casts. - Update README.md to reflect changes.
This commit is contained in:
+6
-3
@@ -223,6 +223,9 @@ typedef otPtr<const uint8_t> otBufferPtr;
|
||||
typedef otPtr<const char> otStringPtr;
|
||||
|
||||
Interpreter::Interpreter(otInstance *aInstance):
|
||||
#if OPENTHREAD_ENABLE_APPLICATION_COAP
|
||||
mCoap(*this),
|
||||
#endif
|
||||
mServer(NULL),
|
||||
#ifdef OTDLL
|
||||
mApiInstance(otApiInit()),
|
||||
@@ -313,7 +316,7 @@ int Interpreter::Hex2Bin(const char *aHex, uint8_t *aBin, uint16_t aBinLength)
|
||||
return static_cast<int>(cur - aBin);
|
||||
}
|
||||
|
||||
void Interpreter::AppendResult(otError aError)
|
||||
void Interpreter::AppendResult(otError aError) const
|
||||
{
|
||||
if (aError == OT_ERROR_NONE)
|
||||
{
|
||||
@@ -325,7 +328,7 @@ void Interpreter::AppendResult(otError aError)
|
||||
}
|
||||
}
|
||||
|
||||
void Interpreter::OutputBytes(const uint8_t *aBytes, uint8_t aLength)
|
||||
void Interpreter::OutputBytes(const uint8_t *aBytes, uint8_t aLength) const
|
||||
{
|
||||
for (int i = 0; i < aLength; i++)
|
||||
{
|
||||
@@ -657,7 +660,7 @@ exit:
|
||||
void Interpreter::ProcessCoap(int argc, char *argv[])
|
||||
{
|
||||
otError error;
|
||||
error = Coap::Process(mInstance, argc, argv, *mServer);
|
||||
error = mCoap.Process(argc, argv);
|
||||
AppendResult(error);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user