platform.dart 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. import 'dart:async';
  2. import 'dart:convert';
  3. import 'dart:typed_data';
  4. import 'package:fis_common/json_convert.dart';
  5. import '../client_base.dart';
  6. import 'platform.m.dart';
  7. /// 平台服务
  8. class PlatformService extends JsonRpcClientBase {
  9. PlatformService(
  10. String host, {
  11. String serviceName = "IPlatformService",
  12. Map<String, String>? headers,
  13. int? timeout,
  14. }) : super(
  15. host,
  16. serviceName,
  17. headers: headers,
  18. timeout: timeout,
  19. ) {
  20. /// 注册响应实体反序列化处理器
  21. FJsonConvert.setDecoder((map) => LoadVidResult.fromJson(map));
  22. FJsonConvert.setDecoder((map) => GetVidFrameResult.fromJson(map));
  23. }
  24. /// 加载主题
  25. Future<bool> loadTheme(String name) async {
  26. var rpcRst = await call("LoadTheme", name);
  27. return rpcRst;
  28. }
  29. /// 保存配置
  30. ///
  31. /// [jsonText] 配置json文本
  32. Future<bool> saveConfig(String jsonText) async {
  33. var rpcRst = await call("SaveConfig", jsonText);
  34. return rpcRst;
  35. }
  36. /// 获取配置
  37. Future<String?> getConfig() async {
  38. var rpcRst = await call("GetConfig");
  39. return rpcRst;
  40. }
  41. Future<void> continueExcute(int targetMethod, String content) async {
  42. var rpcRst = await call("ContinueExcute", [targetMethod, content]);
  43. return rpcRst;
  44. }
  45. /// 保存文本文件
  46. ///
  47. /// [name] 文件名
  48. ///
  49. /// [text] 文本
  50. Future<bool> saveText(String name, String text) async {
  51. var rpcRst = await call("SaveText", [name, text]);
  52. return rpcRst;
  53. }
  54. /// 获取文件文本
  55. ///
  56. /// [name] 文件名
  57. Future<String?> getText(String name) async {
  58. var rpcRst = await call("GetText", name);
  59. return rpcRst;
  60. }
  61. /// 获取文件文本
  62. ///
  63. /// [name] 文件名
  64. Future<String?> searchvBox() async {
  65. var rpcRst = await call("SearchvBox");
  66. return rpcRst;
  67. }
  68. /// 加载Vid文件
  69. ///
  70. /// [url] Vid文件链接
  71. Future<LoadVidResult> loadVid(String url) async {
  72. var rpcRst = await call("LoadVid", url);
  73. var result = LoadVidResult.fromJson(rpcRst as Map<String, dynamic>);
  74. return result;
  75. }
  76. /// 获取Vid单针帧图
  77. Future<GetVidFrameResult> getVidFrame(GetVidFrameRequest request) async {
  78. var rpcRst = await call("GetVidFrame", request);
  79. var result = GetVidFrameResult.fromJson(rpcRst as Map<String, dynamic>);
  80. return result;
  81. }
  82. /// 释放Vid缓存资源
  83. void releaseVid() => notify("ReleaseVid");
  84. /// 获取单帧Vid文件图像
  85. Future<GetVidFrameResult> getSingleImage(String url) async {
  86. var rpcRst = await call("GetSingleImage", url);
  87. var result = GetVidFrameResult.fromJson(rpcRst as Map<String, dynamic>);
  88. return result;
  89. }
  90. /// 获取vid文件(base64)
  91. Future<String?> getVidFile(String url) async {
  92. var rpcRst = await call("GetVidFile", [url]);
  93. return rpcRst;
  94. }
  95. /// 导出文件
  96. Future<bool> setBytesToExport(String data, String fileName) async {
  97. var rpcRst = await call("SetBytesToExport", [data, fileName]);
  98. return rpcRst;
  99. }
  100. ///缓存文件
  101. Future<bool> setBinaryFileCache(String data, String fileName) async {
  102. var rpcRst = await call("SetBinaryFileCache", [data, fileName]);
  103. return rpcRst;
  104. }
  105. ///读取缓存文件
  106. Future<String?> getBinaryFileCache(String fileName) async {
  107. var rpcRst = await call("GetBinaryFileCache", [fileName]);
  108. return rpcRst;
  109. }
  110. ///导出病例zip文件
  111. Future<bool> exportPatientZipFile(String data, String fileName) async {
  112. var rpcRst = await call("ExportPatientZipFile", [data, fileName]);
  113. return rpcRst;
  114. }
  115. ///撤销病例导出
  116. Future<bool> abortExportOperation() async {
  117. var rpcRst = await call("AbortExportOperation", []);
  118. return rpcRst;
  119. }
  120. ///Token失效通知
  121. Future<void> tokenExpired() async {
  122. var rpcRst = await call("TokenExpired", []);
  123. return rpcRst;
  124. }
  125. ///选择文件
  126. Future<bool> selectFile(String path) async {
  127. var rpcResult = await call("SelectFile", [path]);
  128. return rpcResult;
  129. }
  130. ///开启RTMP服务器,并通知魔盒推流
  131. Future<bool> startRtmpServer() async {
  132. var rpcResult = await call("StartRtmpServer", []);
  133. return rpcResult;
  134. }
  135. /// 开启魔盒RTMP推流
  136. Future<bool> startRtmpPush() async {
  137. var rpcResult = await call("StartRtmpPush", []);
  138. return rpcResult;
  139. }
  140. /// 停用RTMP服务器,并停止魔盒的推流
  141. Future<bool> stopRtmpServer() async {
  142. var rpcResult = await call("StopRtmpServer", []);
  143. return rpcResult;
  144. }
  145. ///打开文件夹选择器并通知Flutter路径
  146. Future<void> openFolderPicker(String path) async {
  147. var rpcResult = await call("OpenFolderPicker", [path]);
  148. return rpcResult;
  149. }
  150. /// 仅停止魔盒的推流,不关闭Rtmp Server
  151. Future<bool> stopRtmpPush() async {
  152. var rpcResult = await call("StopRtmpPush", []);
  153. return rpcResult;
  154. }
  155. Future<String> getDesktopPath() async {
  156. var rpcResult = await call("GetDesktopPath", []);
  157. return rpcResult;
  158. }
  159. Future<void> openSpecifiedPath(String path) async {
  160. var rpcResult = await call("OpenSpecifiedPath", [path]);
  161. return rpcResult;
  162. }
  163. ///读取打印驱动块
  164. Future<Uint8List> readPrintDriverChunk(int index) async {
  165. String rpcResult = await call("ReadPrintDriverChunk", [index]);
  166. Uint8List byteData = base64.decode(rpcResult);
  167. return byteData;
  168. }
  169. ///打开图像测量页(独立窗口)
  170. Future<bool?> openImageMeasureAsync(
  171. String token, String patientCode, String remedicalCode, String recordCode,
  172. {String source = '0'}) async {
  173. var rpcRst = await call("OpenImageMeasure",
  174. [token, patientCode, remedicalCode, recordCode, source]);
  175. return rpcRst;
  176. }
  177. ///打开报告预览页(独立窗口)
  178. Future<bool?> openReportPreviewAsync(String token, String reportCode,
  179. String recordCode, String isFormEditor) async {
  180. var rpcRst = await call(
  181. "OpenReportPreview", [token, reportCode, recordCode, isFormEditor]);
  182. return rpcRst;
  183. }
  184. ///打开图像测量页(独立窗口)
  185. Future<bool?> openReportEditAsync(
  186. String token,
  187. String patientCode,
  188. String reportCode,
  189. String recordCode,
  190. String referralRecordCode,
  191. String consultationCode) async {
  192. var rpcRst = await call("OpenReportEdit", [
  193. token,
  194. patientCode,
  195. reportCode,
  196. recordCode,
  197. referralRecordCode,
  198. consultationCode
  199. ]);
  200. return rpcRst;
  201. }
  202. ///打开报告设计器页面(独立窗口)
  203. ///templateType(机构模版/个人模版)机构=1,个人=2
  204. Future<bool?> openReportDesignerAsync(
  205. String templateId,
  206. String name,
  207. String type,
  208. String token,
  209. String json,
  210. bool isOrg,
  211. String openMode,
  212. ) async {
  213. var rpcRst = await call("OpenReportDesigner", [
  214. templateId,
  215. name,
  216. type,
  217. token,
  218. json,
  219. isOrg,
  220. openMode,
  221. ]);
  222. return rpcRst;
  223. }
  224. ///第二窗口启动时调用
  225. Future<void> onSlaveWindowStart() async {
  226. await call('OnSlaveWindowStart');
  227. }
  228. Future<void> setTemplateJson(String templateId, String json) async {
  229. await call('SetTemplateJson', [templateId, json]);
  230. }
  231. ///打开在线会诊页面(独立窗口)
  232. Future<void> openLiveConsultationAsync(
  233. String consultationCode, bool isJoin, int pageIndex, String token) async {
  234. await call(
  235. "OpenLiveConsultation", [consultationCode, isJoin, pageIndex, token]);
  236. }
  237. /// 打开设备直播 独立窗口
  238. ///
  239. /// [deviceCode] 设备编码
  240. ///
  241. /// [token] 登录令牌
  242. ///
  243. /// [maxLiveCount] 最大直播数量
  244. Future<void> openDeviceLiveWindow(
  245. String deviceCode, String token, int maxLiveCount) {
  246. return call("OpenDeviceLiveWindow", [deviceCode, token, maxLiveCount]);
  247. }
  248. ///获取屏幕个数
  249. Future<int> getWindowsNum() async {
  250. var rpcRst = await call("GetWindowsNum");
  251. return rpcRst;
  252. }
  253. ///关闭副窗口
  254. Future<void> closeSlaveWindow() async {
  255. var rpcRst = await call("CloseSlaveWindow");
  256. return rpcRst;
  257. }
  258. ///关闭会诊窗口
  259. Future<void> closeLiveConsultation() async {
  260. var rpcRst = await call("CloseLiveConsultation");
  261. return rpcRst;
  262. }
  263. ///开启拖拽窗口
  264. Future<void> beginWindowDrag(String windowName) async {
  265. var rpcRst = await call("BeginWindowDrag", [windowName]);
  266. return rpcRst;
  267. }
  268. ///关闭拖拽窗口
  269. Future<void> endWindowDrag(String windowName) async {
  270. var rpcRst = await call("EndWindowDrag", [windowName]);
  271. return rpcRst;
  272. }
  273. ///最小化窗口
  274. Future<void> minimizeWindow(String windowName) async {
  275. var rpcRst = await call("MinimizeWindow", [windowName]);
  276. return rpcRst;
  277. }
  278. ///最大化窗口
  279. Future<void> maximizeWindow(String windowName) async {
  280. var rpcRst = await call("MaximizeWindow", [windowName]);
  281. return rpcRst;
  282. }
  283. ///重置
  284. Future<void> restoreWindow(String windowName) async {
  285. var rpcRst = await call("RestoreWindow", [windowName]);
  286. return rpcRst;
  287. }
  288. ///获取Window状态
  289. Future<int> getWindowState(String windowName) async {
  290. var rpcRst = await call("GetWindowStateAsync", [windowName]);
  291. return rpcRst;
  292. }
  293. ///关闭窗口
  294. Future<void> closeWindow(String windowName) async {
  295. var rpcRst = await call("CloseWindow", [windowName]);
  296. return rpcRst;
  297. }
  298. ///设置语言Code
  299. Future<void> setLanguageCodeAsync(String code) async {
  300. var rpcRst = await call("SetLanguageCode", [code]);
  301. return rpcRst;
  302. }
  303. //获取语言Code
  304. Future<String> getLanguageCodeAsync() async {
  305. var rpcRst = await call("GetLanguageCode");
  306. return rpcRst;
  307. }
  308. ///设置当前登录信息
  309. Future<void> setLoginUserInfoAsync(String userInfo) async {
  310. var rpcRst = await call("SetUserLoginInfo", [userInfo]);
  311. return rpcRst;
  312. }
  313. ///设置当前第二窗口状态
  314. Future<void> setSecondWindowStateInfoAsync(bool isSecondWindowMode) async {
  315. var rpcRst = await call("SetSecondWindowState", [isSecondWindowMode]);
  316. return rpcRst;
  317. }
  318. ///默认词条变更
  319. Future<void> thesaurusChange(String token) async {
  320. var rpcRst = await call("ThesaurusChange", [token]);
  321. return rpcRst;
  322. }
  323. ///提交报告通知
  324. Future<void> onSubmitReport(String patientId, String code) async {
  325. var rpcRst = await call("OnSubmitReport", [patientId, code]);
  326. return rpcRst;
  327. }
  328. ///刷新报告通知
  329. Future<void> refershReports() async {
  330. var rpcRst = await call("RefershReports", []);
  331. return rpcRst;
  332. }
  333. ///刷新报告通知
  334. Future<void> reloadConfig() async {
  335. var rpcRst = await call("ReloadConfig", []);
  336. return rpcRst;
  337. }
  338. ///重载配置
  339. Future<bool> getIsUseSecondWindow() async {
  340. var rpcRst = await call("GetIsUseSecondWindow", []);
  341. return rpcRst;
  342. }
  343. ///重载配置
  344. Future<bool> getIsWin7() async {
  345. var rpcRst = await call("GetIsWin7", []);
  346. return rpcRst;
  347. }
  348. ///打开控制台
  349. Future<void> openConsole() async {
  350. var rpcRst = await call("OpenConsole", []);
  351. return rpcRst;
  352. }
  353. ///主窗口关闭通知
  354. Future<void> onMainWindowLogout() async {
  355. var rpcRst = await call("OnMainWindowLogout", []);
  356. return rpcRst;
  357. }
  358. ///设置开启自启动
  359. Future<void> setAutoStartAsync(bool isAutoStart) async {
  360. var rpcRst = await call("SetAutoStart", [isAutoStart]);
  361. return rpcRst;
  362. }
  363. ///启用壳子录音
  364. Future<void> startShellRecord() async {
  365. var rpcRst = await call("StartShellRecord");
  366. return rpcRst;
  367. }
  368. ///停止壳子录音
  369. Future<String> stopShellRecord() async {
  370. var rpcRst = await call("StopShellRecord");
  371. return rpcRst;
  372. }
  373. ///导出日志
  374. Future<bool> exportAppLogZipFile(int exportType, String fileName) async {
  375. var rpcRst = await call("ExportAppLogZipFile", [exportType, fileName]);
  376. return rpcRst;
  377. }
  378. ///开始录制
  379. Future<void> startRecording(
  380. String filePrefixTitle, String micDeviceId) async {
  381. var rpcRst = await call("StartRecording", [filePrefixTitle, micDeviceId]);
  382. return rpcRst;
  383. }
  384. ///暂停录制
  385. Future<void> pauseRecording(bool isPause) async {
  386. var rpcRst = await call("PauseRecording", [isPause]);
  387. return rpcRst;
  388. }
  389. ///结束录制
  390. Future<void> stopRecording() async {
  391. var rpcRst = await call("StopRecording");
  392. return rpcRst;
  393. }
  394. ///导出会诊病例zip文件
  395. Future<bool> exportConsultationZipFile(String data, String fileName) async {
  396. var rpcRst = await call("ExportConsultationZipFile", [data, fileName]);
  397. return rpcRst;
  398. }
  399. ///升级客户端
  400. Future<bool> doUpgradClient(String upgradInfo) async {
  401. var rpcRst = await call("DoUpgradClient", [upgradInfo]);
  402. return rpcRst;
  403. }
  404. ///获得当前客户端版本
  405. Future<String> getCurrentAppVersion() async {
  406. var rpcRst = await call("GetCurrentAppVersion");
  407. return rpcRst;
  408. }
  409. ///下载测量数据
  410. Future<void> downloadMeasureData(String url) async {
  411. var rpcRst = await call("DownloadMeasureData", [url]);
  412. return rpcRst;
  413. }
  414. ///下载大文件接口
  415. Future<void> downloadBigFile(String url, String fileName) async {
  416. var rpcRst = await call("DownloadBigFile", [url, fileName]);
  417. return rpcRst;
  418. }
  419. ///获取所有已安装的打印驱动
  420. Future<List<String>> getAllInstalledPrinterInfos() async {
  421. var rpcRst = await call("GetAllInstalledPrinterInfos");
  422. List<String> result = [];
  423. for (var i in rpcRst) {
  424. result.add(i.toString());
  425. }
  426. return result;
  427. }
  428. ///打印测试(调用后会在指定的打印机打印一张测试页)
  429. Future<bool> printTestPage(String name) async {
  430. var rpcRst = await call("PrintTestPage", [name]);
  431. return rpcRst;
  432. }
  433. ///搜索未安装的打印驱动
  434. Future<List<String>> getUninstalledPrinters({String? ip}) async {
  435. var rpcRst = await call("GetUninstalledPrinters", [ip]);
  436. List<String> result = [];
  437. for (var i in rpcRst) {
  438. result.add(i.toString());
  439. }
  440. return result;
  441. }
  442. /// 安装打印驱动
  443. Future<void> installPrinterDriver(String printerDriveStr) async {
  444. var rpcRst = await call("InstallPrinterDriver", [printerDriveStr]);
  445. return rpcRst;
  446. }
  447. ///选择本地打印驱动
  448. Future<bool> chooseLocalDrive() async {
  449. var rpcRst = await call("ChooseLocalDrive");
  450. return rpcRst;
  451. }
  452. /// 关闭打印驱动工具
  453. Future<void> closePrinterDriverManager() async {
  454. var rpcRst = await call("ClosePrinterDriverManager");
  455. return rpcRst;
  456. }
  457. /// 获取当前魔盒设备的UniqueId
  458. Future<String> getUltrasoundUniqueId() async {
  459. var rpcRst = await call("GetUltrasoundUniqueIdAsync");
  460. return rpcRst;
  461. }
  462. ///获取网卡信息
  463. Future<String> getNetworkCardsInfo() async {
  464. var rpcRst = await call("GetNetworkCardsInfo");
  465. return rpcRst;
  466. }
  467. ///保存网卡信息
  468. Future<bool> saveNetworkCardsInfo(String networkWireListModel) async {
  469. var rpcRst = await call("SaveNetworkCardsInfo", [networkWireListModel]);
  470. return rpcRst;
  471. }
  472. ///获取无线网卡信息
  473. Future<String> getWirelessCardInfo() async {
  474. var rpcRst = await call('GetWirelessCardInfo');
  475. return rpcRst;
  476. }
  477. ///保存无线网卡信息
  478. Future<bool> saveWifiNetworkCard(String networkInterface) async {
  479. var rpcRst = await call("SaveWifiNetworkCard", [networkInterface]);
  480. return rpcRst;
  481. }
  482. ///连接Wifi网络
  483. Future<bool> connectWifi(String wifiInfo) async {
  484. var rpcRst = await call("ConnectWifi", [wifiInfo]);
  485. return rpcRst;
  486. }
  487. ///断开Wifi网络
  488. Future<bool> disconnectWifi(String wifiInfo) async {
  489. var rpcRst = await call("DisconnectWifi", [wifiInfo]);
  490. return rpcRst;
  491. }
  492. ///忘记Wifi密码
  493. Future<bool> forgetWifiPassword(String wifiInfo) async {
  494. var rpcRst = await call("ForgetWifiPassword", [wifiInfo]);
  495. return rpcRst;
  496. }
  497. ///刷新DNS
  498. Future<bool> flushDNS() async {
  499. var rpcRst = await call("FlushDNS");
  500. return rpcRst;
  501. }
  502. ///Ping 测试Ip是否可以连通
  503. Future<bool> ping(String ipInfo) async {
  504. var rpcRst = await call("Ping", [ipInfo]);
  505. return rpcRst;
  506. }
  507. ///开始培训推流
  508. Future<bool> startTrainningPush(String pushURL, String micDeviceId,
  509. TranningPushEnum tranningPushEnum) async {
  510. var rpcRst = await call("StartTrainningPush", [
  511. pushURL,
  512. micDeviceId,
  513. tranningPushEnum.index,
  514. ]);
  515. return rpcRst;
  516. }
  517. ///切换培训推流模式
  518. Future<bool> switchPushMode(TranningPushEnum tranningPushEnum) async {
  519. var rpcRst = await call("SwitchPushMode", [
  520. tranningPushEnum.index,
  521. ]);
  522. return rpcRst;
  523. }
  524. ///调整培训音频音量
  525. Future<bool> adjustAudioVoice(
  526. AudioTypeEnum audioTypeEnum, double audioVolume) async {
  527. var rpcRst = await call("AdjustAudioVoice", [
  528. audioTypeEnum.index,
  529. audioVolume,
  530. ]);
  531. return rpcRst;
  532. }
  533. ///停止培训直播推流
  534. Future<bool> stopTrainningPush() async {
  535. var rpcRst = await call("StopTrainningPush");
  536. return rpcRst;
  537. }
  538. ///开始培训直播录制
  539. Future<bool> startTrainningRecord(
  540. String filePrefixTitle, String pullURL) async {
  541. var rpcRst = await call("StartTrainningRecord", [
  542. filePrefixTitle,
  543. pullURL,
  544. ]);
  545. return rpcRst;
  546. }
  547. ///停止培训直播录制
  548. Future<bool> stopTrainningRecord(String? path) async {
  549. var rpcRst = await call("StopTrainningRecord", [path]);
  550. return rpcRst;
  551. }
  552. ///打开直播课页面
  553. Future<void> openLiveCoursePage(String courseCode, String token) async {
  554. var rpcRst = await call("OpenLiveCoursePage", [courseCode, token]);
  555. return rpcRst;
  556. }
  557. ///取消文件下载
  558. Future<void> cancelDownloadBigFile() async {
  559. var rpcRst = await call('CancelDownloadBigFile');
  560. return rpcRst;
  561. }
  562. ///复制到粘贴板
  563. Future<void> copyToClipboard(String txtToCopy) async {
  564. var rpcRst = await call('CopyToClipboard', [txtToCopy]);
  565. return rpcRst;
  566. }
  567. ///重载配置
  568. Future<void> reloadSettings(String jsonStr) async {
  569. var rpcRst = await call('ReloadSettings', [jsonStr]);
  570. return rpcRst;
  571. }
  572. ///第二窗口加载完毕
  573. Future<void> secondWindowInited() async {
  574. var rpcRst = await call('SecondWindowInited');
  575. return rpcRst;
  576. }
  577. ///根据枚举获取对应枚举的音频设备的名称
  578. Future<List<dynamic>> getAudioDevice(AudioTypeEnum audioTypeEnum) async {
  579. var rpcRst = await call('GetAudioDevice', [audioTypeEnum.index]);
  580. return rpcRst;
  581. }
  582. ///根据枚举获取当前活跃的音频输出或输入设备,并设置它的音量
  583. Future<bool> setActiveDeviceVolume(
  584. AudioTypeEnum audioTypeEnum, double volume) async {
  585. var rpcRst = await call('SetActiveDeviceVolume', [
  586. audioTypeEnum.index,
  587. volume,
  588. ]);
  589. return rpcRst;
  590. }
  591. ///根据枚举获取对应枚举默认音频设备的音量
  592. Future<double> getAudioDeviceVolume(AudioTypeEnum audioTypeEnum) async {
  593. var rpcRst = await call('GetAudioDeviceVolume', [audioTypeEnum.index]);
  594. return rpcRst;
  595. }
  596. ///根据音频设备名字设置对应设备为当前系统默认的扬声器
  597. Future<bool> setSystemAudioDevice(String deviceName) async {
  598. var rpcRst = await call('SetSystemAudioDevice', [deviceName]);
  599. return rpcRst;
  600. }
  601. ///停止魔盒的设备预览
  602. Future<bool> stopPreview() async {
  603. var rpcRst = await call('StopPreview');
  604. return rpcRst;
  605. }
  606. }
  607. /// 一些platform 的数据结构定义
  608. enum TranningPushEnum {
  609. /// <summary>
  610. /// 窗口
  611. /// </summary>
  612. Window,
  613. /// <summary>
  614. /// 屏幕
  615. /// </summary>
  616. Screen,
  617. }
  618. enum AudioTypeEnum {
  619. /// <summary>
  620. /// 麦克风
  621. /// </summary>
  622. Mic,
  623. /// <summary>
  624. /// 扬声器
  625. /// </summary>
  626. Speaker,
  627. }