src.dualinventive.com/jjacobs/dinetrpcll-sniffer/libdipp/include/di/rpc/class/Notify.h

56 lines
1.2 KiB
C++

#ifndef INCLUDE_DI_RPC_CLASS_NOTIFY_H_
#define INCLUDE_DI_RPC_CLASS_NOTIFY_H_
#include <vector>
#include <string>
#include <di/Json.h>
#include <di/rpc/Msg.h>
namespace Di {
namespace Rpc {
class Notify : public Msg {
public:
enum Type {
NOTIFY_TYPE_UNKNOWN,
NOTIFY_TYPE_STRING,
NOTIFY_TYPE_NUMBER,
NOTIFY_TYPE_DOUBLE,
NOTIFY_TYPE_BOOL,
NOTIFY_TYPE_OBJECT
};
struct notifyInfo {
unsigned int id;
std::string label;
std::string type;
};
struct notifyData {
unsigned int id;
uint64_t time;
Type type;
std::shared_ptr<Json> value;
};
std::vector<notifyInfo> notifyInfoList;
std::vector<notifyData> notifyDataList;
explicit Notify(std::shared_ptr<Msg> msg);
static std::string getStringValue(const struct notifyData &message);
static int64_t getNumberValue(const struct notifyData &message);
static double getDoubleValue(const struct notifyData &message);
static bool getBoolValue(const struct notifyData &message);
static std::shared_ptr<Json> getObjectValue(const struct notifyData &message);
private:
void __decodePublish(std::shared_ptr<Json> message);
void __decodeMethodInfo(std::shared_ptr<Json> message);
};
} // namespace Rpc
} // namespace Di
#endif // INCLUDE_DI_RPC_CLASS_NOTIFY_H_