DeviceInfo.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * @Description:
  3. * @Version: 1.0
  4. * @Autor: lishengyin
  5. * @Date: 2022-02-21 09:42:16
  6. * @LastEditors: lishengyin
  7. * @LastEditTime: 2022-02-28 17:42:08
  8. */
  9. #ifndef __DEVICEINFO_H_
  10. #define __DEVICEINFO_H_
  11. #include <iostream>
  12. using namespace std;
  13. class DeviceInfo
  14. {
  15. public:
  16. std::string localIp = "192.168.0.130";
  17. std::string deviceUserName = "admin";
  18. std::string devicePassWord = "sunwin2021";
  19. std::string port = "19000";
  20. std::string stream = "rtsp://"+ localIp + ":8554/live";
  21. public:
  22. DeviceInfo() {}
  23. ~DeviceInfo(){}
  24. void objectToJson(string& str){
  25. rapidjson::StringBuffer strBuf;
  26. rapidjson::Writer<rapidjson::StringBuffer> writer(strBuf);
  27. this->objectToJson(writer);
  28. str = strBuf.GetString();
  29. }
  30. void objectToJson(rapidjson::Writer<rapidjson::StringBuffer>& writer){
  31. writer.StartObject();
  32. writer.Key("localIp");
  33. writer.String(localIp.c_str());
  34. writer.Key("deviceUserName");
  35. writer.String(deviceUserName.c_str());
  36. writer.Key("devicePassWord");
  37. writer.String(devicePassWord.c_str());
  38. writer.Key("port");
  39. writer.String(port.c_str());
  40. writer.Key("stream");
  41. writer.String(stream.c_str());
  42. writer.EndObject();
  43. }
  44. };
  45. #endif