#ifndef __PLAYERCONTROL_H_ #define __PLAYERCONTROL_H_ #include #include #include #include #include #include class PlayerCommand { public: std::string device; std::string ctype; std::string param; public: PlayerCommand() {} ~PlayerCommand() {} void objectToJson(rapidjson::Writer& writer){ writer.StartObject(); writer.Key("device"); writer.String(device.c_str()); writer.Key("ctype"); writer.String(ctype.c_str()); writer.Key("param"); writer.String(param.c_str()); writer.EndObject(); } }; class PlayerControl { public: std::string URL = "/qxsbr360xs.do"; public: std::string cid; std::string cname; std::string dtype; std::string did; vector command; public: PlayerControl() {} ~PlayerControl() {} void setURL(std::string url){ this->URL = url; } std::string getUrl(){ return this->URL; } void objectToJson(std::string& str){ rapidjson::StringBuffer strBuf; rapidjson::Writer writer(strBuf); this->objectToJson(writer); str = strBuf.GetString(); } void objectToJson(rapidjson::Writer& writer){ writer.StartObject(); writer.Key("cid"); writer.String(cid.c_str()); writer.Key("cname"); writer.String(cname.c_str()); writer.Key("dtype"); writer.String(dtype.c_str()); writer.Key("did"); writer.String(did.c_str()); writer.Key("command"); writer.StartArray(); for(auto iter = command.begin(); iter != command.end(); iter++){ iter->objectToJson(writer); } writer.EndArray(); writer.EndObject(); } }; #endif