connect.m.dart 9.0 KB

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