connect.m.dart 8.7 KB

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