TransmitterSwitchInfo.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. #include "TransmitterSwitchInfo.h"
  2. ExecPlanItemInfo::ExecPlanItemInfo()
  3. {
  4. ExecType = -1;
  5. WeekDay = 0;
  6. // num = -1;
  7. date = QDate::fromString("1970-01-01","yyyy-MM-dd");
  8. execTime = QTime::fromString("00:00:00","hh:mm:ss");
  9. devName = "未定义";
  10. actionID = 0;
  11. actionName = "未定义";
  12. // dateType = DateType::NormalDate;
  13. // cfgDev = nullptr;
  14. }
  15. ExecPlanItemInfo::ExecPlanItemInfo(const ExecPlanItemInfo& item)
  16. {
  17. ExecType = item.ExecType;
  18. WeekDay = item.WeekDay;
  19. // num = item.num;
  20. date = item.date;
  21. execTime = item.execTime;
  22. actionID = item.actionID;
  23. devName = item.devName;
  24. actionName = item.actionName;
  25. // dateType = item.dateType;
  26. // cfgDev = item.cfgDev;
  27. }
  28. ExecPlanItemInfo& ExecPlanItemInfo::operator=(const ExecPlanItemInfo& item)
  29. {
  30. if(this == &item)
  31. return *this;
  32. ExecType = item.ExecType;
  33. WeekDay = item.WeekDay;
  34. // num = item.num;
  35. date = item.date;
  36. execTime = item.execTime;
  37. devName = item.devName;
  38. actionID = item.actionID;
  39. actionName = item.actionName;
  40. // dateType = item.dateType;
  41. // cfgDev = item.cfgDev;
  42. return *this;
  43. }
  44. DevTypeInfo::DevTypeInfo()
  45. {
  46. devTypeName = "";
  47. devAction.clear();
  48. devType_MB.clear();
  49. PTTypeCode = -1;
  50. }
  51. DevTypeInfo& DevTypeInfo::operator=(const DevTypeInfo& devInfo)
  52. {
  53. devTypeName = devInfo.devTypeName;
  54. devAction = devInfo.devAction;
  55. devType_MB = devInfo.devType_MB;
  56. PTTypeCode = devInfo.PTTypeCode;
  57. return *this;
  58. }
  59. MapDevType::MapDevType()
  60. {
  61. initDevType();
  62. }
  63. /* 添加支持的设备类型 */
  64. void MapDevType::initDevType()
  65. {
  66. /* 955发射机 */
  67. DevTypeInfo devInfo;
  68. devInfo.devTypeName = "衢州台发射机";
  69. devInfo.PTTypeCode = 955;
  70. devInfo.devAction[1] = "开机";
  71. devInfo.devAction[2] = "关机";
  72. devInfo.devType_MB.insert(enum_DeviceMB::Dev_Main,"主");
  73. devInfo.devType_MB.insert(enum_DeviceMB::Dev_Backup,"备");
  74. devInfo.devType_MB.insert(enum_DeviceMB::Dev_Contingency,"应急");
  75. m_mapDevType.insert(955, devInfo);
  76. /* 其他发射机 */
  77. }
  78. /* 获取某一个发射机类型 */
  79. DevTypeInfo MapDevType::getDevType(int PTTypeCode)
  80. {
  81. if(m_mapDevType.contains(PTTypeCode))
  82. {
  83. return m_mapDevType[PTTypeCode];
  84. }
  85. return DevTypeInfo();
  86. }
  87. DeviceInfo::DeviceInfo()
  88. {
  89. devName = "未定义";
  90. PTTypeCode = 0;
  91. DevType = DevTypeInfo();
  92. DTID = 0;
  93. DID = 0;
  94. ChannelID = 0;
  95. }
  96. DeviceInfo::DeviceInfo(const DeviceInfo& devInfo)
  97. {
  98. devName = devInfo.devName;
  99. PTTypeCode = devInfo.PTTypeCode;
  100. DevType = devInfo.DevType;
  101. DTID = devInfo.DTID;
  102. DID = devInfo.DID;
  103. ChannelID = devInfo.ChannelID;
  104. }
  105. DeviceInfo& DeviceInfo::operator=(const DeviceInfo& devInfo)
  106. {
  107. devName = devInfo.devName;
  108. PTTypeCode = devInfo.PTTypeCode;
  109. DevType = devInfo.DevType;
  110. DTID = devInfo.DTID;
  111. DID = devInfo.DID;
  112. ChannelID = devInfo.ChannelID;
  113. return *this;
  114. }
  115. MapDevice::MapDevice()
  116. {
  117. }
  118. /* 添加一个设备 */
  119. void MapDevice::addDevice(const DeviceInfo& devInfo)
  120. {
  121. /* 先查重 */
  122. if(m_mapDevice.contains(devInfo.devName))
  123. {
  124. return;
  125. }
  126. m_mapDevice.insert(devInfo.devName, devInfo);
  127. }
  128. /* 获取一个设备 */
  129. DeviceInfo MapDevice::getDevice(const QString& devName)
  130. {
  131. if(m_mapDevice.contains(devName))
  132. {
  133. return m_mapDevice[devName];
  134. }
  135. return DeviceInfo();
  136. }
  137. /* 删除一个设备 */
  138. void MapDevice::deleteDevice(const QString& devName)
  139. {
  140. if(m_mapDevice.contains(devName))
  141. {
  142. m_mapDevice.remove(devName);
  143. }
  144. }