connect.m.dart 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. import 'authentication.m.dart';
  2. import 'notification.m.dart';
  3. import 'liveConsultation.m.dart';
  4. class ConnectResult {
  5. String? token;
  6. String? uniqueCode;
  7. ConnectResult({
  8. this.token,
  9. this.uniqueCode,
  10. });
  11. factory ConnectResult.fromJson(Map<String, dynamic> map) {
  12. return ConnectResult(
  13. token: map['Token'],
  14. uniqueCode: map['UniqueCode'],
  15. );
  16. }
  17. Map<String, dynamic> toJson() {
  18. final map = Map<String, dynamic>();
  19. if(token != null)
  20. map['Token'] = token;
  21. if(uniqueCode != null)
  22. map['UniqueCode'] = uniqueCode;
  23. return map;
  24. }
  25. }
  26. class ConnectRequest {
  27. String? deviceUniqueCode;
  28. String? password;
  29. String? deviceModel;
  30. String? deviceType;
  31. String? softwareVersion;
  32. String? systemVersion;
  33. String? cPUModel;
  34. String? systemLanguage;
  35. String? description;
  36. String? name;
  37. String? organizationCode;
  38. String? departmentCode;
  39. Platform platform;
  40. LoginSource loginSource;
  41. String? installVersion;
  42. bool isOldPlatform;
  43. String? deviceCode;
  44. ConnectRequest({
  45. this.deviceUniqueCode,
  46. this.password,
  47. this.deviceModel,
  48. this.deviceType,
  49. this.softwareVersion,
  50. this.systemVersion,
  51. this.cPUModel,
  52. this.systemLanguage,
  53. this.description,
  54. this.name,
  55. this.organizationCode,
  56. this.departmentCode,
  57. this.platform = Platform.Windows,
  58. this.loginSource = LoginSource.PC,
  59. this.installVersion,
  60. this.isOldPlatform = false,
  61. this.deviceCode,
  62. });
  63. factory ConnectRequest.fromJson(Map<String, dynamic> map) {
  64. return ConnectRequest(
  65. deviceUniqueCode: map['DeviceUniqueCode'],
  66. password: map['Password'],
  67. deviceModel: map['DeviceModel'],
  68. deviceType: map['DeviceType'],
  69. softwareVersion: map['SoftwareVersion'],
  70. systemVersion: map['SystemVersion'],
  71. cPUModel: map['CPUModel'],
  72. systemLanguage: map['SystemLanguage'],
  73. description: map['Description'],
  74. name: map['Name'],
  75. organizationCode: map['OrganizationCode'],
  76. departmentCode: map['DepartmentCode'],
  77. platform: Platform.values.firstWhere((e) => e.index == map['Platform']),
  78. loginSource: LoginSource.values.firstWhere((e) => e.index == map['LoginSource']),
  79. installVersion: map['InstallVersion'],
  80. isOldPlatform: map['IsOldPlatform'],
  81. deviceCode: map['DeviceCode'],
  82. );
  83. }
  84. Map<String, dynamic> toJson() {
  85. final map = Map<String, dynamic>();
  86. if(deviceUniqueCode != null)
  87. map['DeviceUniqueCode'] = deviceUniqueCode;
  88. if(password != null)
  89. map['Password'] = password;
  90. if(deviceModel != null)
  91. map['DeviceModel'] = deviceModel;
  92. if(deviceType != null)
  93. map['DeviceType'] = deviceType;
  94. if(softwareVersion != null)
  95. map['SoftwareVersion'] = softwareVersion;
  96. if(systemVersion != null)
  97. map['SystemVersion'] = systemVersion;
  98. if(cPUModel != null)
  99. map['CPUModel'] = cPUModel;
  100. if(systemLanguage != null)
  101. map['SystemLanguage'] = systemLanguage;
  102. if(description != null)
  103. map['Description'] = description;
  104. if(name != null)
  105. map['Name'] = name;
  106. if(organizationCode != null)
  107. map['OrganizationCode'] = organizationCode;
  108. if(departmentCode != null)
  109. map['DepartmentCode'] = departmentCode;
  110. map['Platform'] = platform.index;
  111. map['LoginSource'] = loginSource.index;
  112. if(installVersion != null)
  113. map['InstallVersion'] = installVersion;
  114. map['IsOldPlatform'] = isOldPlatform;
  115. if(deviceCode != null)
  116. map['DeviceCode'] = deviceCode;
  117. return map;
  118. }
  119. }
  120. class CacheDeviceDTO extends DeviceInfoDTO{
  121. bool isOnline;
  122. String? sourceUrl;
  123. CacheDeviceDTO({
  124. this.isOnline = false,
  125. this.sourceUrl,
  126. String? deviceCode,
  127. String? serialNumber,
  128. String? password,
  129. String? name,
  130. String? description,
  131. String? deviceModel,
  132. String? deviceType,
  133. String? headPicUrl,
  134. String? deviceSoftwareVersion,
  135. String? sDKSoftwareVersion,
  136. String? organizationCode,
  137. String? departmentCode,
  138. String? shortCode,
  139. bool isAutoShared = false,
  140. bool isEncryptedShow = false,
  141. DateTime? lastLoginTime,
  142. String? systemVersion,
  143. String? cPUModel,
  144. String? systemLanguage,
  145. List<String >? diagnosisModules,
  146. List<String >? reportPosterCodes,
  147. bool mergedChannel = false,
  148. int mergedVideoOutputWidth = 0,
  149. int mergedVideoOutputHeight = 0,
  150. List<VideoDeviceDTO >? videoDeviceInfos,
  151. DownloadModeSettingEnum downloadModeSetting = DownloadModeSettingEnum.Auto,
  152. bool liveOpened = false,
  153. bool supportRtc = false,
  154. String? displayName,
  155. DateTime? createTime,
  156. DateTime? updateTime,
  157. }) : super(
  158. deviceCode: deviceCode,
  159. serialNumber: serialNumber,
  160. password: password,
  161. name: name,
  162. description: description,
  163. deviceModel: deviceModel,
  164. deviceType: deviceType,
  165. headPicUrl: headPicUrl,
  166. deviceSoftwareVersion: deviceSoftwareVersion,
  167. sDKSoftwareVersion: sDKSoftwareVersion,
  168. organizationCode: organizationCode,
  169. departmentCode: departmentCode,
  170. shortCode: shortCode,
  171. isAutoShared: isAutoShared,
  172. isEncryptedShow: isEncryptedShow,
  173. lastLoginTime: lastLoginTime,
  174. systemVersion: systemVersion,
  175. cPUModel: cPUModel,
  176. systemLanguage: systemLanguage,
  177. diagnosisModules: diagnosisModules,
  178. reportPosterCodes: reportPosterCodes,
  179. mergedChannel: mergedChannel,
  180. mergedVideoOutputWidth: mergedVideoOutputWidth,
  181. mergedVideoOutputHeight: mergedVideoOutputHeight,
  182. videoDeviceInfos: videoDeviceInfos,
  183. downloadModeSetting: downloadModeSetting,
  184. liveOpened: liveOpened,
  185. supportRtc: supportRtc,
  186. displayName: displayName,
  187. createTime: createTime,
  188. updateTime: updateTime,
  189. );
  190. factory CacheDeviceDTO.fromJson(Map<String, dynamic> map) {
  191. return CacheDeviceDTO(
  192. isOnline: map['IsOnline'],
  193. sourceUrl: map['SourceUrl'],
  194. deviceCode: map['DeviceCode'],
  195. serialNumber: map['SerialNumber'],
  196. password: map['Password'],
  197. name: map['Name'],
  198. description: map['Description'],
  199. deviceModel: map['DeviceModel'],
  200. deviceType: map['DeviceType'],
  201. headPicUrl: map['HeadPicUrl'],
  202. deviceSoftwareVersion: map['DeviceSoftwareVersion'],
  203. sDKSoftwareVersion: map['SDKSoftwareVersion'],
  204. organizationCode: map['OrganizationCode'],
  205. departmentCode: map['DepartmentCode'],
  206. shortCode: map['ShortCode'],
  207. isAutoShared: map['IsAutoShared'],
  208. isEncryptedShow: map['IsEncryptedShow'],
  209. lastLoginTime: map['LastLoginTime'] != null ? DateTime.parse(map['LastLoginTime']) : null,
  210. systemVersion: map['SystemVersion'],
  211. cPUModel: map['CPUModel'],
  212. systemLanguage: map['SystemLanguage'],
  213. diagnosisModules: map['DiagnosisModules'] != null ? map['DiagnosisModules'].cast<String>().toList() : null,
  214. reportPosterCodes: map['ReportPosterCodes'] != null ? map['ReportPosterCodes'].cast<String>().toList() : null,
  215. mergedChannel: map['MergedChannel'],
  216. mergedVideoOutputWidth: map['MergedVideoOutputWidth'],
  217. mergedVideoOutputHeight: map['MergedVideoOutputHeight'],
  218. videoDeviceInfos: map['VideoDeviceInfos'] != null ? (map['VideoDeviceInfos'] as List).map((e)=>VideoDeviceDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  219. downloadModeSetting: DownloadModeSettingEnum.values.firstWhere((e) => e.index == map['DownloadModeSetting']),
  220. liveOpened: map['LiveOpened'],
  221. supportRtc: map['SupportRtc'],
  222. displayName: map['DisplayName'],
  223. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  224. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  225. );
  226. }
  227. Map<String, dynamic> toJson() {
  228. final map = super.toJson();
  229. map['IsOnline'] = isOnline;
  230. if(sourceUrl != null)
  231. map['SourceUrl'] = sourceUrl;
  232. return map;
  233. }
  234. }
  235. class SetDeviceIsEncryptedShowRequest extends TokenRequest{
  236. bool isEncryptedShow;
  237. SetDeviceIsEncryptedShowRequest({
  238. this.isEncryptedShow = false,
  239. String? token,
  240. }) : super(
  241. token: token,
  242. );
  243. factory SetDeviceIsEncryptedShowRequest.fromJson(Map<String, dynamic> map) {
  244. return SetDeviceIsEncryptedShowRequest(
  245. isEncryptedShow: map['IsEncryptedShow'],
  246. token: map['Token'],
  247. );
  248. }
  249. Map<String, dynamic> toJson() {
  250. final map = super.toJson();
  251. map['IsEncryptedShow'] = isEncryptedShow;
  252. return map;
  253. }
  254. }