You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#pragma once
#include <map>
#include <string>
#include "sdk/os/zos.hpp"
namespace iflytop { using namespace std;
class CmdScheduler { public: class CmdProcessContext { public: bool breakflag = false; };
typedef function<void(int, char**, CmdProcessContext*)> call_cmd_t;
private: map<string, call_cmd_t> m_cmdMap;
ZUART* m_uart; char* rxbuf; int32_t m_rxsize = 0;
uint32_t m_rxbufsize;
bool m_dataisready = false;
char cmdcache[1024] = {0};
public: void initialize(UART_HandleTypeDef* huart, uint32_t rxbufsize); void registerCmd(std::string cmd, call_cmd_t call_cmd);
void schedule();
private: void callcmd(const char* cmd, CmdProcessContext& context); void prase_cmd(char* input, int inputlen, int& argc, char* argv[]); };
} // namespace iflytop
|