notifications.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. import 'package:fis_jsonrpc/rpc.dart';
  2. import 'package:flyinsono/notifications/handlers/consulation/cancel_inviting_in_live_course_notification.dart';
  3. import 'package:flyinsono/notifications/handlers/consulation/device_parameters_notification.dart';
  4. import 'package:flyinsono/notifications/handlers/consulation/send_interactive_board_data_handler.dart';
  5. import 'package:flyinsono/notifications/handlers/consulation/upload_consultation_data_handler.dart';
  6. import 'package:flyinsono/notifications/handlers/lab/disk_space_notification_handler.dart';
  7. import 'package:flyinsono/notifications/handlers/remote/connect_status_to_client_notification.dart';
  8. import 'package:flyinsono/notifications/handlers/remote/device_disconnect_remote_control_notification_handler.dart';
  9. import 'package:flyinsono/notifications/handlers/remote/device_download_patch_progress_to_user_notification_handler.dart';
  10. import 'package:flyinsono/notifications/handlers/remote/device_printer_result_notification_handler.dart';
  11. import 'package:flyinsono/notifications/handlers/remote/device_reject_remote_control_notification_handler.dart';
  12. import 'package:flyinsono/notifications/handlers/remote/get_remote_log_to_client_handler.dart';
  13. import 'package:flyinsono/notifications/handlers/remote/probe_application_setting_response_notification_handler.dart';
  14. import 'package:flyinsono/notifications/handlers/remote/send_result_to_client_notification_handler.dart';
  15. import 'package:flyinsono/notifications/handlers/schedule/Invitee_reject_apply_handler.dart';
  16. import 'package:flyinsono/notifications/handlers/schedule/applay_handler.dart';
  17. import 'package:flyinsono/notifications/handlers/schedule/approval_apply_handler.dart';
  18. import 'package:flyinsono/notifications/handlers/schedule/invitee_approve_apply_handler.dart';
  19. import 'package:flyinsono/notifications/handlers/schedule/invitee_approve_handler.dart';
  20. import 'package:flyinsono/notifications/handlers/schedule/reject_apply_handler.dart';
  21. import 'package:flyinsono/notifications/handlers/upgrade/upgrade_notification.dart';
  22. import 'package:flyinsono/notifications/handlers/wechat/accept_meeting_handle.dart';
  23. import 'package:flyinsono/notifications/handlers/wechat/meeting_hangup_handle.dart';
  24. import 'package:flyinsono/notifications/handlers/wechat/reject_meeting_handle.dart';
  25. import 'package:get/get.dart';
  26. import 'handlers/college/change_share_live_course_handler.dart';
  27. import 'handlers/college/index.dart';
  28. import 'handlers/college/leave_course_handler.dart';
  29. import 'handlers/college/live_interactive_board_data_notification.dart';
  30. import 'handlers/consulation/accept_handler.dart';
  31. import 'handlers/consulation/answer_timeout_handler.dart';
  32. import 'handlers/consulation/cancel_handler.dart';
  33. import 'handlers/consulation/cancel_inviting_in_live_handler.dart';
  34. import 'handlers/consulation/change_consultation.dart';
  35. import 'handlers/consulation/close_consultation_handler.dart';
  36. import 'handlers/consulation/close_handler.dart';
  37. import 'handlers/consulation/emergency_call_failed_handler.dart';
  38. import 'handlers/consulation/emergency_call_handler.dart';
  39. import 'handlers/consulation/invite_handler.dart';
  40. import 'handlers/consulation/invite_in_live_handler.dart';
  41. import 'handlers/consulation/join_handlers.dart';
  42. import 'handlers/consulation/join_in_consultation.dart';
  43. import 'handlers/consulation/leave_handler.dart';
  44. import 'handlers/consulation/member_heart_rate_join_handler.dart';
  45. import 'handlers/consulation/member_leave_handler.dart';
  46. import 'handlers/consulation/mute_handler.dart';
  47. import 'handlers/consulation/neterror_handler.dart';
  48. import 'handlers/consulation/reject_handler.dart';
  49. import 'handlers/consulation/reject_invite_live_handler.dart';
  50. import 'handlers/consulation/switch_video_play.dart';
  51. import 'handlers/execute_result_handler.dart';
  52. import 'handlers/lab/task_completed_handler.dart';
  53. import 'handlers/other_platform_notification_handler.dart';
  54. import 'handlers/remote/save_and_exit_notification.dart';
  55. import 'handlers/schedule/remind_handler.dart';
  56. import 'handlers/token_replaced_handler.dart';
  57. final _instance = _buildInstance();
  58. /// 消息中心
  59. WsNotificationCenter get notificationCenter => _instance;
  60. // void runDistributeDemo() {
  61. // Future.delayed(
  62. // const Duration(milliseconds: 100),
  63. // () {
  64. // final handler = Get.find<TokenReplacedNotificationHandler>();
  65. // void onSub01(TokenReplacedNotification message) {
  66. // print("Sub01 - Receive msg at ${DateTime.now()}");
  67. // }
  68. // void onSub02(TokenReplacedNotification message) {
  69. // print("Sub02 - Receive msg at ${DateTime.now()}");
  70. // Future.delayed(const Duration(milliseconds: 100), () {
  71. // handler.unsubscribe(onSub02);
  72. // });
  73. // }
  74. // handler.subscribe(onSub01);
  75. // handler.subscribe(onSub02);
  76. // },
  77. // );
  78. // }
  79. WsNotificationCenter _buildInstance() {
  80. final instance = WsNotificationCenter();
  81. // 注册消息处理器
  82. instance.register(
  83. Get.put(SendInteractiveBoardDataHandler())); // 白板 | 1 | 互动白板数据通知
  84. instance.register(Get.put(TokenReplacedNotificationHandler()));
  85. instance.register(Get.put(
  86. CancelInvitingInLiveConsultationHandler())); // 7 | 取消会诊过程中邀请成员的通知
  87. instance
  88. .register(Get.put(InviteInLiveConsultationHandler())); // 8 |会诊过程中邀请成员的通知
  89. instance.register(
  90. Get.put(InviteLiveConsultationNotificationHandler())); //11 | 开始会诊的通知
  91. instance.register(
  92. Get.put(AcceptLiveConsultationNotificationHandler())); //12 | 接受会诊的通知
  93. instance.register(Get.put(RejectLiveConsultationHandler())); //13 | 拒绝会诊通知
  94. instance
  95. .register(Get.put(RejectInviteLiveConsultationHandler())); //21 | 拒绝会诊通知
  96. instance.register(
  97. Get.put(CancelLiveConsultationNotificationHandler())); // 15 | 取消会诊通知
  98. instance.register(
  99. Get.put(CloseLiveConsultationNotificationHandler())); // 16 | 关闭会诊通知
  100. instance.register(
  101. Get.put(JoinLiveConsultationNotificationHandler())); // 17 | 进入会诊通知
  102. instance.register(
  103. Get.put(NetworkErrConsultationNotificationHandler())); // 18 | 网络质量不佳的通知
  104. instance
  105. .register(Get.put(LeaveConsultationNotificationHandler())); // 19 离开会诊通知
  106. instance.register(
  107. Get.put(JoinInLiveConsultationNotificationHandler())); // 20 会诊中其他成员加入房间通知
  108. instance.register(Get.put(MuteLiveConsultationHandler())); // 27 成员静音通知
  109. instance.register(
  110. Get.put(SwitchVideoPlayConsultationHandler())); // 28 成员摄像头开启或关闭通知
  111. instance
  112. .register(Get.put(HeartRateJoinConsultationHandler())); // 29 成员心跳进入会诊间
  113. instance.register(
  114. Get.put(ConnectStatusToClientNotificationHandler())); // 72 远程连接客户端
  115. instance.register(
  116. Get.put(GetRemoteLogToClientNotificationHandler())); // 未知 远程获取超声机日志
  117. instance.register(Get.put(
  118. DeviceDownloadPatchProgressToUserNotificationHandler())); // 81 推送包进度
  119. instance.register(Get.put(
  120. DevicePrinterResultNotificationHandler())); // 未知 获取到设置打印机驱动时超声机的通知
  121. instance.register(Get.put(
  122. DeviceRejectRemoteControlNotificationHandler())); // 66 设备端没开启远程控制给到的通知
  123. instance.register(Get.put(
  124. DeviceDisconnectRemoteControlNotificationHandler())); // 67 获取到设备端断开的通知
  125. instance.register(
  126. Get.put(SendResultToClientNotificationHandler())); // 79 发送远程维护结果给客户端
  127. instance.register(Get.put(
  128. ProbeApplicationSettingResponseNotificationHandler())); // 88 收到设备端发送的探头通知
  129. instance.register(Get.put(EmergencyCallNotificationHandler())); //37 急诊呼叫专家通知
  130. instance.register(
  131. Get.put(EmergencyCallFailedNotificationHandler())); //38 急诊呼叫失败通知
  132. instance.register(Get.put(HeartRateLeaveConsultationHandler())); //30 成员离开通知
  133. instance
  134. .register(Get.put(ChangeConsultationNotificationHandler())); //52 切换会诊房间
  135. instance.register(
  136. Get.put(CloseConsultationDueToChangeNotificationHandler())); //55 关闭会诊房间
  137. instance
  138. .register(Get.put(ExecuteResultNotificationHandler())); // 77 导出测量数据结果通知
  139. instance.register(
  140. Get.put(RejectApplayNotificationHandler())); // 📅| 6 | 拒绝预约申请的通知
  141. instance.register(
  142. Get.put(ConsultationRemindNotificationHandler())); // 📅| 9 | 会诊开始前提醒的通知
  143. instance.register(Get.put(ApplyConsultationHandler())); // 📅| 22 | 会诊申请通知
  144. instance.register(
  145. Get.put(ApprovalApplyConsultationHandler())); // 📅| 23 | 批准申请会诊通知
  146. instance.register(
  147. Get.put(InviteeConsultationNotificationHandler())); // 📅| 24 | 会诊受邀请人通知
  148. instance.register(Get.put(
  149. InviteeApproveApplyConsultationNotificationHandler())); // 📅| 25 | 会诊受邀请参与人同意通知
  150. instance.register(
  151. Get.put(InviteeRejectNotificationHandler())); // 📅| 26 | 会诊受邀请参与人拒绝通知
  152. instance.register(
  153. Get.put(DeviceParametersNotificationHandler())); // 35 客户端收到 设备探头应用和参数信息
  154. //课程相关通知
  155. instance.register(Get.put(
  156. CancelInvitingInLiveCourseNotificationHandler())); // 68 取消呼叫 to 客户端
  157. instance.register(Get.put(InviteLiveCourseHandler())); // 39 课程开始通知
  158. instance.register(Get.put(JoinLiveCourseHandler())); // 40 加入课程通知
  159. instance.register(Get.put(HeartRateJoinCourseHandler())); // 42 加入直播课心跳通知
  160. instance.register(Get.put(NetworkErrCourseHandler())); // 43 直播课程网络异常通知
  161. instance.register(Get.put(CancelLiveCourseHandler())); // 44 取消直播课通知
  162. instance.register(Get.put(MuteLiveCourseHandler())); // 45 开启或者关闭声音通知
  163. instance.register(Get.put(CloseLiveCourseHandler())); // 47 结束直播通知
  164. instance.register(Get.put(HeartRateLeaveCourseHandler())); // 49 离线直播心跳通知
  165. instance.register(Get.put(LeaveLiveCourseHandler())); //50 课程成员离开
  166. instance.register(Get.put(SwitchLiveCourseVideoHandler())); // 51 开启或者关闭直播视频通知
  167. instance.register(Get.put(CourcePaySuccessHandler())); // 54 课程支付成功通知
  168. instance.register(Get.put(CourseStatusHandler())); // 57 审核课程状态通知
  169. instance.register(Get.put(UpgradeNotificationHandler())); // 58 更新通知
  170. instance.register(Get.put(SendLiveInteractiveBoardDataHandler())); // 58 更新通知
  171. instance.register(Get.put(ChangeShareInLiveCourseHandler())); // 58 更新通知
  172. instance.register(Get.put(ChangeShareInLiveCourseHandler())); // 97 共享信息改变通知
  173. instance
  174. .register(Get.put(OtherPlatformNotificationHandler())); // 98 来自其他平台通知信息
  175. instance.register(Get.put(UploadConsultationDataHandler())); // 103 会诊截图通知
  176. // 小程序相关通知
  177. instance
  178. .register(Get.put(MeetingHangupNotificationHandler())); // 90 | 小程序会诊挂断通知
  179. instance
  180. .register(Get.put(RejectMeetingNotificationHandler())); // 91 | 小程序会诊拒绝通知
  181. instance.register(
  182. Get.put(AcceptMeetingNotificationHandler())); // 93 | 发起者收到对方接受通知
  183. instance
  184. .register(Get.put(ConsultationAnswerTimeoutHandler())); // 100 | 超时未接听通知
  185. instance.register(Get.put(
  186. SaveAndExitToClientNotificationHandler())); // 101 | 系统设置保存并退出结果通知 to 客户端,等到这个通知,页面才能关闭
  187. // runDistributeDemo();
  188. instance.register(Get.put(TaskCompletedNotificationHandler())); //任务完成通知
  189. instance.register(Get.put(DiskSpaceFullNotificationHandler())); //磁盘空间不足通知
  190. return instance;
  191. }