connect.m.dart 7.6 KB

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