#ifndef CLI_UDP_EXAMPLE_HPP_
#define CLI_UDP_EXAMPLE_HPP_
#include "openthread-core-config.h"
#include <openthread/udp.h>
namespace ot {
namespace Cli {
class Interpreter;
class UdpExample
{
public:
explicit UdpExample(Interpreter &aInterpreter);
otError Process(uint8_t aArgsLength, char *aArgs[]);
private:
struct Command
{
const char *mName;
otError (UdpExample::*mCommand)(uint8_t aArgsLength, char *aArgs[]);
};
enum PayloadType
{
kTypeText = 0,
kTypeAutoSize = 1,
kTypeHexString = 2,
};
otError ProcessHelp(uint8_t aArgsLength, char *aArgs[]);
otError ProcessBind(uint8_t aArgsLength, char *aArgs[]);
otError ProcessClose(uint8_t aArgsLength, char *aArgs[]);
otError ProcessConnect(uint8_t aArgsLength, char *aArgs[]);
otError ProcessOpen(uint8_t aArgsLength, char *aArgs[]);
otError ProcessSend(uint8_t aArgsLength, char *aArgs[]);
otError WriteCharToBuffer(otMessage *aMessage, uint16_t aSize);
static void HandleUdpReceive(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo);
void HandleUdpReceive(otMessage *aMessage, const otMessageInfo *aMessageInfo);
static const Command sCommands[];
Interpreter & mInterpreter;
otUdpSocket mSocket;
};
} }
#endif