|
|
@ -7,7 +7,7 @@ |
|
|
|
#include "sdk\components\zprotocols\errorcode\errorcode.hpp"
|
|
|
|
using namespace iflytop; |
|
|
|
|
|
|
|
#define TAG "CmdScheduler"
|
|
|
|
#define TAG "CMD"
|
|
|
|
|
|
|
|
void CmdScheduler::registerCmd(std::string cmd, const char* helpinfo, int npara, call_cmd_t call_cmd) { |
|
|
|
CMD cmdinfo; |
|
|
@ -19,13 +19,17 @@ void CmdScheduler::registerCmd(std::string cmd, const char* helpinfo, int npara, |
|
|
|
|
|
|
|
void CmdScheduler::regbasiccmd() { |
|
|
|
this->registerCmd("help", "", 0, [this](Context* context) { |
|
|
|
ZLOGI(TAG, "help"); |
|
|
|
ZLOGI(TAG, "cmdlist:"); |
|
|
|
for (auto it = m_cmdMap.begin(); it != m_cmdMap.end(); it++) { |
|
|
|
ZLOGI(TAG, " %s %s", it->first.c_str(), it->second.help_info.c_str()); |
|
|
|
} |
|
|
|
return (int32_t)0; |
|
|
|
}); |
|
|
|
this->registerCmd("sleep_ms", "", 1, [this](Context* context) { |
|
|
|
int ms = atoi(context->argv[1]); |
|
|
|
osDelay(ms); |
|
|
|
return 0; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
void CmdScheduler::initialize(UART_HandleTypeDef* huart, uint32_t rxbufsize) { |
|
|
|