connect.m.dart 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. import 'authentication.m.dart';
  2. import 'aIDiagnosis.m.dart';
  3. import 'package:fis_jsonrpc/utils.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. ConnectRequest({
  42. this.deviceUniqueCode,
  43. this.password,
  44. this.deviceModel,
  45. this.deviceType,
  46. this.softwareVersion,
  47. this.systemVersion,
  48. this.cPUModel,
  49. this.systemLanguage,
  50. this.description,
  51. this.name,
  52. this.organizationCode,
  53. this.departmentCode,
  54. this.platform = Platform.Windows,
  55. this.loginSource = LoginSource.PC,
  56. });
  57. factory ConnectRequest.fromJson(Map<String, dynamic> map) {
  58. return ConnectRequest(
  59. deviceUniqueCode: map['DeviceUniqueCode'],
  60. password: map['Password'],
  61. deviceModel: map['DeviceModel'],
  62. deviceType: map['DeviceType'],
  63. softwareVersion: map['SoftwareVersion'],
  64. systemVersion: map['SystemVersion'],
  65. cPUModel: map['CPUModel'],
  66. systemLanguage: map['SystemLanguage'],
  67. description: map['Description'],
  68. name: map['Name'],
  69. organizationCode: map['OrganizationCode'],
  70. departmentCode: map['DepartmentCode'],
  71. platform: Platform.values.firstWhere((e) => e.index == map['Platform']),
  72. loginSource: LoginSource.values.firstWhere((e) => e.index == map['LoginSource']),
  73. );
  74. }
  75. Map<String, dynamic> toJson() {
  76. final map = Map<String, dynamic>();
  77. if(deviceUniqueCode != null)
  78. map['DeviceUniqueCode'] = deviceUniqueCode;
  79. if(password != null)
  80. map['Password'] = password;
  81. if(deviceModel != null)
  82. map['DeviceModel'] = deviceModel;
  83. if(deviceType != null)
  84. map['DeviceType'] = deviceType;
  85. if(softwareVersion != null)
  86. map['SoftwareVersion'] = softwareVersion;
  87. if(systemVersion != null)
  88. map['SystemVersion'] = systemVersion;
  89. if(cPUModel != null)
  90. map['CPUModel'] = cPUModel;
  91. if(systemLanguage != null)
  92. map['SystemLanguage'] = systemLanguage;
  93. if(description != null)
  94. map['Description'] = description;
  95. if(name != null)
  96. map['Name'] = name;
  97. if(organizationCode != null)
  98. map['OrganizationCode'] = organizationCode;
  99. if(departmentCode != null)
  100. map['DepartmentCode'] = departmentCode;
  101. map['Platform'] = platform.index;
  102. map['LoginSource'] = loginSource.index;
  103. return map;
  104. }
  105. }
  106. class BaseDTO {
  107. DateTime? createTime;
  108. DateTime? updateTime;
  109. BaseDTO({
  110. this.createTime,
  111. this.updateTime,
  112. });
  113. factory BaseDTO.fromJson(Map<String, dynamic> map) {
  114. return BaseDTO(
  115. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  116. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  117. );
  118. }
  119. Map<String, dynamic> toJson() {
  120. final map = Map<String, dynamic>();
  121. if(createTime != null)
  122. map['CreateTime'] = JsonRpcUtils.dateFormat(createTime!);
  123. if(updateTime != null)
  124. map['UpdateTime'] = JsonRpcUtils.dateFormat(updateTime!);
  125. return map;
  126. }
  127. }
  128. enum VideoDeviceSourceTypeEnum {
  129. Desktop,
  130. Camera,
  131. }
  132. class VideoDeviceDTO {
  133. String? videoDeviceId;
  134. VideoDeviceSourceTypeEnum videoDeviceSourceType;
  135. int width;
  136. int height;
  137. int outputWidth;
  138. int outputHeight;
  139. VideoDeviceDTO({
  140. this.videoDeviceId,
  141. this.videoDeviceSourceType = VideoDeviceSourceTypeEnum.Desktop,
  142. this.width = 0,
  143. this.height = 0,
  144. this.outputWidth = 0,
  145. this.outputHeight = 0,
  146. });
  147. factory VideoDeviceDTO.fromJson(Map<String, dynamic> map) {
  148. return VideoDeviceDTO(
  149. videoDeviceId: map['VideoDeviceId'],
  150. videoDeviceSourceType: VideoDeviceSourceTypeEnum.values.firstWhere((e) => e.index == map['VideoDeviceSourceType']),
  151. width: map['Width'],
  152. height: map['Height'],
  153. outputWidth: map['OutputWidth'],
  154. outputHeight: map['OutputHeight'],
  155. );
  156. }
  157. Map<String, dynamic> toJson() {
  158. final map = Map<String, dynamic>();
  159. if(videoDeviceId != null)
  160. map['VideoDeviceId'] = videoDeviceId;
  161. map['VideoDeviceSourceType'] = videoDeviceSourceType.index;
  162. map['Width'] = width;
  163. map['Height'] = height;
  164. map['OutputWidth'] = outputWidth;
  165. map['OutputHeight'] = outputHeight;
  166. return map;
  167. }
  168. }
  169. enum DownloadModeSettingEnum {
  170. Auto,
  171. Origin,
  172. CDN,
  173. }
  174. class DeviceInfoDTO extends BaseDTO{
  175. String? deviceCode;
  176. String? serialNumber;
  177. String? password;
  178. String? name;
  179. String? description;
  180. String? deviceModel;
  181. String? deviceType;
  182. String? headPicUrl;
  183. String? deviceSoftwareVersion;
  184. String? sDKSoftwareVersion;
  185. String? organizationCode;
  186. String? departmentCode;
  187. String? shortCode;
  188. bool isAutoShared;
  189. bool isEncryptedShow;
  190. DateTime? lastLoginTime;
  191. String? systemVersion;
  192. String? cPUModel;
  193. String? systemLanguage;
  194. List<String >? diagnosisModules;
  195. List<String >? reportPosterCodes;
  196. bool mergedChannel;
  197. int mergedVideoOutputWidth;
  198. int mergedVideoOutputHeight;
  199. List<VideoDeviceDTO >? videoDeviceInfos;
  200. DownloadModeSettingEnum downloadModeSetting;
  201. DeviceInfoDTO({
  202. this.deviceCode,
  203. this.serialNumber,
  204. this.password,
  205. this.name,
  206. this.description,
  207. this.deviceModel,
  208. this.deviceType,
  209. this.headPicUrl,
  210. this.deviceSoftwareVersion,
  211. this.sDKSoftwareVersion,
  212. this.organizationCode,
  213. this.departmentCode,
  214. this.shortCode,
  215. this.isAutoShared = false,
  216. this.isEncryptedShow = false,
  217. this.lastLoginTime,
  218. this.systemVersion,
  219. this.cPUModel,
  220. this.systemLanguage,
  221. this.diagnosisModules,
  222. this.reportPosterCodes,
  223. this.mergedChannel = false,
  224. this.mergedVideoOutputWidth = 0,
  225. this.mergedVideoOutputHeight = 0,
  226. this.videoDeviceInfos,
  227. this.downloadModeSetting = DownloadModeSettingEnum.Auto,
  228. DateTime? createTime,
  229. DateTime? updateTime,
  230. }) : super(
  231. createTime: createTime,
  232. updateTime: updateTime,
  233. );
  234. factory DeviceInfoDTO.fromJson(Map<String, dynamic> map) {
  235. return DeviceInfoDTO(
  236. deviceCode: map['DeviceCode'],
  237. serialNumber: map['SerialNumber'],
  238. password: map['Password'],
  239. name: map['Name'],
  240. description: map['Description'],
  241. deviceModel: map['DeviceModel'],
  242. deviceType: map['DeviceType'],
  243. headPicUrl: map['HeadPicUrl'],
  244. deviceSoftwareVersion: map['DeviceSoftwareVersion'],
  245. sDKSoftwareVersion: map['SDKSoftwareVersion'],
  246. organizationCode: map['OrganizationCode'],
  247. departmentCode: map['DepartmentCode'],
  248. shortCode: map['ShortCode'],
  249. isAutoShared: map['IsAutoShared'],
  250. isEncryptedShow: map['IsEncryptedShow'],
  251. lastLoginTime: map['LastLoginTime'] != null ? DateTime.parse(map['LastLoginTime']) : null,
  252. systemVersion: map['SystemVersion'],
  253. cPUModel: map['CPUModel'],
  254. systemLanguage: map['SystemLanguage'],
  255. diagnosisModules: map['DiagnosisModules'] != null ? map['DiagnosisModules'].cast<String>().toList() : null,
  256. reportPosterCodes: map['ReportPosterCodes'] != null ? map['ReportPosterCodes'].cast<String>().toList() : null,
  257. mergedChannel: map['MergedChannel'],
  258. mergedVideoOutputWidth: map['MergedVideoOutputWidth'],
  259. mergedVideoOutputHeight: map['MergedVideoOutputHeight'],
  260. videoDeviceInfos: map['VideoDeviceInfos'] != null ? (map['VideoDeviceInfos'] as List).map((e)=>VideoDeviceDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  261. downloadModeSetting: DownloadModeSettingEnum.values.firstWhere((e) => e.index == map['DownloadModeSetting']),
  262. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  263. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  264. );
  265. }
  266. Map<String, dynamic> toJson() {
  267. final map = super.toJson();
  268. if(deviceCode != null)
  269. map['DeviceCode'] = deviceCode;
  270. if(serialNumber != null)
  271. map['SerialNumber'] = serialNumber;
  272. if(password != null)
  273. map['Password'] = password;
  274. if(name != null)
  275. map['Name'] = name;
  276. if(description != null)
  277. map['Description'] = description;
  278. if(deviceModel != null)
  279. map['DeviceModel'] = deviceModel;
  280. if(deviceType != null)
  281. map['DeviceType'] = deviceType;
  282. if(headPicUrl != null)
  283. map['HeadPicUrl'] = headPicUrl;
  284. if(deviceSoftwareVersion != null)
  285. map['DeviceSoftwareVersion'] = deviceSoftwareVersion;
  286. if(sDKSoftwareVersion != null)
  287. map['SDKSoftwareVersion'] = sDKSoftwareVersion;
  288. if(organizationCode != null)
  289. map['OrganizationCode'] = organizationCode;
  290. if(departmentCode != null)
  291. map['DepartmentCode'] = departmentCode;
  292. if(shortCode != null)
  293. map['ShortCode'] = shortCode;
  294. map['IsAutoShared'] = isAutoShared;
  295. map['IsEncryptedShow'] = isEncryptedShow;
  296. if(lastLoginTime != null)
  297. map['LastLoginTime'] = JsonRpcUtils.dateFormat(lastLoginTime!);
  298. if(systemVersion != null)
  299. map['SystemVersion'] = systemVersion;
  300. if(cPUModel != null)
  301. map['CPUModel'] = cPUModel;
  302. if(systemLanguage != null)
  303. map['SystemLanguage'] = systemLanguage;
  304. if(diagnosisModules != null)
  305. map['DiagnosisModules'] = diagnosisModules;
  306. if(reportPosterCodes != null)
  307. map['ReportPosterCodes'] = reportPosterCodes;
  308. map['MergedChannel'] = mergedChannel;
  309. map['MergedVideoOutputWidth'] = mergedVideoOutputWidth;
  310. map['MergedVideoOutputHeight'] = mergedVideoOutputHeight;
  311. if(videoDeviceInfos != null)
  312. map['VideoDeviceInfos'] = videoDeviceInfos;
  313. map['DownloadModeSetting'] = downloadModeSetting.index;
  314. return map;
  315. }
  316. }
  317. class CacheDeviceDTO extends DeviceInfoDTO{
  318. bool isOnline;
  319. String? sourceUrl;
  320. CacheDeviceDTO({
  321. this.isOnline = false,
  322. this.sourceUrl,
  323. String? deviceCode,
  324. String? serialNumber,
  325. String? password,
  326. String? name,
  327. String? description,
  328. String? deviceModel,
  329. String? deviceType,
  330. String? headPicUrl,
  331. String? deviceSoftwareVersion,
  332. String? sDKSoftwareVersion,
  333. String? organizationCode,
  334. String? departmentCode,
  335. String? shortCode,
  336. bool isAutoShared = false,
  337. bool isEncryptedShow = false,
  338. DateTime? lastLoginTime,
  339. String? systemVersion,
  340. String? cPUModel,
  341. String? systemLanguage,
  342. List<String >? diagnosisModules,
  343. List<String >? reportPosterCodes,
  344. bool mergedChannel = false,
  345. int mergedVideoOutputWidth = 0,
  346. int mergedVideoOutputHeight = 0,
  347. List<VideoDeviceDTO >? videoDeviceInfos,
  348. DownloadModeSettingEnum downloadModeSetting = DownloadModeSettingEnum.Auto,
  349. DateTime? createTime,
  350. DateTime? updateTime,
  351. }) : super(
  352. deviceCode: deviceCode,
  353. serialNumber: serialNumber,
  354. password: password,
  355. name: name,
  356. description: description,
  357. deviceModel: deviceModel,
  358. deviceType: deviceType,
  359. headPicUrl: headPicUrl,
  360. deviceSoftwareVersion: deviceSoftwareVersion,
  361. sDKSoftwareVersion: sDKSoftwareVersion,
  362. organizationCode: organizationCode,
  363. departmentCode: departmentCode,
  364. shortCode: shortCode,
  365. isAutoShared: isAutoShared,
  366. isEncryptedShow: isEncryptedShow,
  367. lastLoginTime: lastLoginTime,
  368. systemVersion: systemVersion,
  369. cPUModel: cPUModel,
  370. systemLanguage: systemLanguage,
  371. diagnosisModules: diagnosisModules,
  372. reportPosterCodes: reportPosterCodes,
  373. mergedChannel: mergedChannel,
  374. mergedVideoOutputWidth: mergedVideoOutputWidth,
  375. mergedVideoOutputHeight: mergedVideoOutputHeight,
  376. videoDeviceInfos: videoDeviceInfos,
  377. downloadModeSetting: downloadModeSetting,
  378. createTime: createTime,
  379. updateTime: updateTime,
  380. );
  381. factory CacheDeviceDTO.fromJson(Map<String, dynamic> map) {
  382. return CacheDeviceDTO(
  383. isOnline: map['IsOnline'],
  384. sourceUrl: map['SourceUrl'],
  385. deviceCode: map['DeviceCode'],
  386. serialNumber: map['SerialNumber'],
  387. password: map['Password'],
  388. name: map['Name'],
  389. description: map['Description'],
  390. deviceModel: map['DeviceModel'],
  391. deviceType: map['DeviceType'],
  392. headPicUrl: map['HeadPicUrl'],
  393. deviceSoftwareVersion: map['DeviceSoftwareVersion'],
  394. sDKSoftwareVersion: map['SDKSoftwareVersion'],
  395. organizationCode: map['OrganizationCode'],
  396. departmentCode: map['DepartmentCode'],
  397. shortCode: map['ShortCode'],
  398. isAutoShared: map['IsAutoShared'],
  399. isEncryptedShow: map['IsEncryptedShow'],
  400. lastLoginTime: map['LastLoginTime'] != null ? DateTime.parse(map['LastLoginTime']) : null,
  401. systemVersion: map['SystemVersion'],
  402. cPUModel: map['CPUModel'],
  403. systemLanguage: map['SystemLanguage'],
  404. diagnosisModules: map['DiagnosisModules'] != null ? map['DiagnosisModules'].cast<String>().toList() : null,
  405. reportPosterCodes: map['ReportPosterCodes'] != null ? map['ReportPosterCodes'].cast<String>().toList() : null,
  406. mergedChannel: map['MergedChannel'],
  407. mergedVideoOutputWidth: map['MergedVideoOutputWidth'],
  408. mergedVideoOutputHeight: map['MergedVideoOutputHeight'],
  409. videoDeviceInfos: map['VideoDeviceInfos'] != null ? (map['VideoDeviceInfos'] as List).map((e)=>VideoDeviceDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  410. downloadModeSetting: DownloadModeSettingEnum.values.firstWhere((e) => e.index == map['DownloadModeSetting']),
  411. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  412. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  413. );
  414. }
  415. Map<String, dynamic> toJson() {
  416. final map = super.toJson();
  417. map['IsOnline'] = isOnline;
  418. if(sourceUrl != null)
  419. map['SourceUrl'] = sourceUrl;
  420. return map;
  421. }
  422. }
  423. class SetDeviceIsEncryptedShowRequest extends TokenRequest{
  424. bool isEncryptedShow;
  425. SetDeviceIsEncryptedShowRequest({
  426. this.isEncryptedShow = false,
  427. String? token,
  428. }) : super(
  429. token: token,
  430. );
  431. factory SetDeviceIsEncryptedShowRequest.fromJson(Map<String, dynamic> map) {
  432. return SetDeviceIsEncryptedShowRequest(
  433. isEncryptedShow: map['IsEncryptedShow'],
  434. token: map['Token'],
  435. );
  436. }
  437. Map<String, dynamic> toJson() {
  438. final map = super.toJson();
  439. map['IsEncryptedShow'] = isEncryptedShow;
  440. return map;
  441. }
  442. }