connect.m.dart 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. bool isOnline;
  190. String? sourceUrl;
  191. CacheDeviceDTO({
  192. this.isOnline = false,
  193. this.sourceUrl,
  194. String? deviceCode,
  195. String? serialNumber,
  196. String? password,
  197. String? name,
  198. String? description,
  199. String? deviceModel,
  200. String? deviceType,
  201. String? headPicUrl,
  202. String? deviceSoftwareVersion,
  203. String? sDKSoftwareVersion,
  204. String? organizationCode,
  205. String? departmentCode,
  206. String? shortCode,
  207. bool isAutoShared = false,
  208. bool isEncryptedShow = false,
  209. DateTime? lastLoginTime,
  210. String? systemVersion,
  211. String? cPUModel,
  212. String? systemLanguage,
  213. List<String>? diagnosisModules,
  214. List<String>? reportPosterCodes,
  215. bool mergedChannel = false,
  216. int mergedVideoOutputWidth = 0,
  217. int mergedVideoOutputHeight = 0,
  218. List<VideoDeviceDTO>? videoDeviceInfos,
  219. DownloadModeSettingEnum downloadModeSetting = DownloadModeSettingEnum.Auto,
  220. bool liveOpened = false,
  221. bool supportRtc = false,
  222. String? displayName,
  223. SonopostVersionEnum sonopostVersion = SonopostVersionEnum.Sonopost,
  224. DateTime? createTime,
  225. DateTime? updateTime,
  226. }) : super(
  227. deviceCode: deviceCode,
  228. serialNumber: serialNumber,
  229. password: password,
  230. name: name,
  231. description: description,
  232. deviceModel: deviceModel,
  233. deviceType: deviceType,
  234. headPicUrl: headPicUrl,
  235. deviceSoftwareVersion: deviceSoftwareVersion,
  236. sDKSoftwareVersion: sDKSoftwareVersion,
  237. organizationCode: organizationCode,
  238. departmentCode: departmentCode,
  239. shortCode: shortCode,
  240. isAutoShared: isAutoShared,
  241. isEncryptedShow: isEncryptedShow,
  242. lastLoginTime: lastLoginTime,
  243. systemVersion: systemVersion,
  244. cPUModel: cPUModel,
  245. systemLanguage: systemLanguage,
  246. diagnosisModules: diagnosisModules,
  247. reportPosterCodes: reportPosterCodes,
  248. mergedChannel: mergedChannel,
  249. mergedVideoOutputWidth: mergedVideoOutputWidth,
  250. mergedVideoOutputHeight: mergedVideoOutputHeight,
  251. videoDeviceInfos: videoDeviceInfos,
  252. downloadModeSetting: downloadModeSetting,
  253. liveOpened: liveOpened,
  254. supportRtc: supportRtc,
  255. displayName: displayName,
  256. sonopostVersion: sonopostVersion,
  257. createTime: createTime,
  258. updateTime: updateTime,
  259. );
  260. factory CacheDeviceDTO.fromJson(Map<String, dynamic> map) {
  261. return CacheDeviceDTO(
  262. isOnline: map['IsOnline'],
  263. sourceUrl: map['SourceUrl'],
  264. deviceCode: map['DeviceCode'],
  265. serialNumber: map['SerialNumber'],
  266. password: map['Password'],
  267. name: map['Name'],
  268. description: map['Description'],
  269. deviceModel: map['DeviceModel'],
  270. deviceType: map['DeviceType'],
  271. headPicUrl: map['HeadPicUrl'],
  272. deviceSoftwareVersion: map['DeviceSoftwareVersion'],
  273. sDKSoftwareVersion: map['SDKSoftwareVersion'],
  274. organizationCode: map['OrganizationCode'],
  275. departmentCode: map['DepartmentCode'],
  276. shortCode: map['ShortCode'],
  277. isAutoShared: map['IsAutoShared'],
  278. isEncryptedShow: map['IsEncryptedShow'],
  279. lastLoginTime: map['LastLoginTime'] != null ? DateTime.parse(map['LastLoginTime']) : null,
  280. systemVersion: map['SystemVersion'],
  281. cPUModel: map['CPUModel'],
  282. systemLanguage: map['SystemLanguage'],
  283. diagnosisModules: map['DiagnosisModules']?.cast<String>().toList(),
  284. reportPosterCodes: map['ReportPosterCodes']?.cast<String>().toList(),
  285. mergedChannel: map['MergedChannel'],
  286. mergedVideoOutputWidth: map['MergedVideoOutputWidth'],
  287. mergedVideoOutputHeight: map['MergedVideoOutputHeight'],
  288. videoDeviceInfos: map['VideoDeviceInfos'] != null ? (map['VideoDeviceInfos'] as List).map((e)=>VideoDeviceDTO.fromJson(e as Map<String,dynamic>)).toList() : null,
  289. downloadModeSetting: DownloadModeSettingEnum.values.firstWhere((e) => e.index == map['DownloadModeSetting']),
  290. liveOpened: map['LiveOpened'],
  291. supportRtc: map['SupportRtc'],
  292. displayName: map['DisplayName'],
  293. sonopostVersion: SonopostVersionEnum.values.firstWhere((e) => e.index == map['SonopostVersion']),
  294. createTime: map['CreateTime'] != null ? DateTime.parse(map['CreateTime']) : null,
  295. updateTime: map['UpdateTime'] != null ? DateTime.parse(map['UpdateTime']) : null,
  296. );
  297. }
  298. Map<String, dynamic> toJson() {
  299. final map = super.toJson();
  300. map['IsOnline'] = isOnline;
  301. if (sourceUrl != null)
  302. map['SourceUrl'] = sourceUrl;
  303. return map;
  304. }
  305. }
  306. class SetDeviceIsEncryptedShowRequest extends TokenRequest{
  307. bool isEncryptedShow;
  308. SetDeviceIsEncryptedShowRequest({
  309. this.isEncryptedShow = false,
  310. String? token,
  311. }) : super(
  312. token: token,
  313. );
  314. factory SetDeviceIsEncryptedShowRequest.fromJson(Map<String, dynamic> map) {
  315. return SetDeviceIsEncryptedShowRequest(
  316. isEncryptedShow: map['IsEncryptedShow'],
  317. token: map['Token'],
  318. );
  319. }
  320. Map<String, dynamic> toJson() {
  321. final map = super.toJson();
  322. map['IsEncryptedShow'] = isEncryptedShow;
  323. return map;
  324. }
  325. }