#pragma once #include #include #include #include #include using namespace std; class SendLogin { private: /* data */ // 客户端分配的帐号 string account; // 给客户端的密码 string pwd; // 给客户端分配的token,可为空 string token; // 该连接关联的相机IP string cameraIp; // 工控机sim码,唯一标识 std::string simCode; // 扩展数据 // 约定为对应相机设备的基本信息,用户名、密码、ip、端口、码流;设备种类、设备类型可不必填,设置默认值;设备编号、设备名称后台随机生成 // {"localIp":"xx","deviceUserName":"xx","devicePassWord":"xx","port":"xx","stream":"xx"} string attr1; string attr2; string attr3; public: SendLogin(){} ~SendLogin(){} void setAccount(string Account){ account = Account; } void setPwd(string Pwd){ pwd = Pwd; } void setToken(string Token){ token = Token; } void setCameraIp(string CameraIp){ cameraIp = CameraIp; } void setAttr1(string Attr1){ attr1 = Attr1; } void setAttr2(string Attr2){ attr2 = Attr2; } void setAttr3(string Attr3){ attr3 = Attr3; } void setSimCode(std::string SimCode){ simCode = SimCode; } string getAccount(){ return account; } string getPwd(){ return pwd; } string getToken(){ return token; } string getCameraIp(){ return cameraIp; } string getAttr1(){ return attr1; } string getAttr2(){ return attr2; } string getAttr3(){ return attr3; } string getSimCode(){ return simCode; } void objectToJson(string& str){ rapidjson::StringBuffer strBuf; rapidjson::Writer writer(strBuf); this->objectToJson(writer); str = strBuf.GetString(); } void objectToJson(rapidjson::Writer& writer){ writer.StartObject(); writer.Key("account"); writer.String(account.c_str()); writer.Key("pwd"); writer.String(pwd.c_str()); writer.Key("token"); writer.String(token.c_str()); writer.Key("cameraIp"); writer.String(cameraIp.c_str()); writer.Key("simCode"); writer.String(simCode.c_str()); writer.Key("attr1"); writer.String(attr1.c_str()); writer.Key("attr2"); writer.String(attr2.c_str()); writer.Key("attr3"); writer.String(attr3.c_str()); writer.EndObject(); } bool JsonToObject(){ return true; } };