connect.m.dart 10 KB

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