123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736 |
- import 'dart:async';
- import 'dart:convert';
- import 'dart:typed_data';
- import 'package:fis_common/json_convert.dart';
- import '../client_base.dart';
- import 'platform.m.dart';
- class PlatformService extends JsonRpcClientBase {
- PlatformService(
- String host, {
- String serviceName = "IPlatformService",
- Map<String, String>? headers,
- int? timeout,
- }) : super(
- host,
- serviceName,
- headers: headers,
- timeout: timeout,
- ) {
-
- FJsonConvert.setDecoder((map) => LoadVidResult.fromJson(map));
- FJsonConvert.setDecoder((map) => GetVidFrameResult.fromJson(map));
- }
-
- Future<bool> loadTheme(String name) async {
- var rpcRst = await call("LoadTheme", name);
- return rpcRst;
- }
-
-
- Future<bool> saveConfig(String jsonText) async {
- var rpcRst = await call("SaveConfig", jsonText);
- return rpcRst;
- }
-
- Future<String?> getConfig() async {
- var rpcRst = await call("GetConfig");
- return rpcRst;
- }
- Future<void> continueExcute(int targetMethod, String content) async {
- var rpcRst = await call("ContinueExcute", [targetMethod, content]);
- return rpcRst;
- }
-
-
-
- Future<bool> saveText(String name, String text) async {
- var rpcRst = await call("SaveText", [name, text]);
- return rpcRst;
- }
-
-
- Future<String?> getText(String name) async {
- var rpcRst = await call("GetText", name);
- return rpcRst;
- }
-
-
- Future<String?> searchvBox() async {
- var rpcRst = await call("SearchvBox");
- return rpcRst;
- }
-
-
- Future<LoadVidResult> loadVid(String url) async {
- var rpcRst = await call("LoadVid", url);
- var result = LoadVidResult.fromJson(rpcRst as Map<String, dynamic>);
- return result;
- }
-
- Future<GetVidFrameResult> getVidFrame(GetVidFrameRequest request) async {
- var rpcRst = await call("GetVidFrame", request);
- var result = GetVidFrameResult.fromJson(rpcRst as Map<String, dynamic>);
- return result;
- }
-
- void releaseVid() => notify("ReleaseVid");
-
- Future<GetVidFrameResult> getSingleImage(String url) async {
- var rpcRst = await call("GetSingleImage", url);
- var result = GetVidFrameResult.fromJson(rpcRst as Map<String, dynamic>);
- return result;
- }
-
- Future<String?> getVidFile(String url) async {
- var rpcRst = await call("GetVidFile", [url]);
- return rpcRst;
- }
-
- Future<bool> setBytesToExport(String data, String fileName) async {
- var rpcRst = await call("SetBytesToExport", [data, fileName]);
- return rpcRst;
- }
-
- Future<bool> setBinaryFileCache(String data, String fileName) async {
- var rpcRst = await call("SetBinaryFileCache", [data, fileName]);
- return rpcRst;
- }
-
- Future<String?> getBinaryFileCache(String fileName) async {
- var rpcRst = await call("GetBinaryFileCache", [fileName]);
- return rpcRst;
- }
-
- Future<bool> exportPatientZipFile(String data, String fileName) async {
- var rpcRst = await call("ExportPatientZipFile", [data, fileName]);
- return rpcRst;
- }
-
- Future<bool> abortExportOperation() async {
- var rpcRst = await call("AbortExportOperation", []);
- return rpcRst;
- }
-
- Future<void> tokenExpired() async {
- var rpcRst = await call("TokenExpired", []);
- return rpcRst;
- }
-
- Future<bool> selectFile(String path) async {
- var rpcResult = await call("SelectFile", [path]);
- return rpcResult;
- }
-
- Future<bool> startRtmpServer() async {
- var rpcResult = await call("StartRtmpServer", []);
- return rpcResult;
- }
-
- Future<bool> startRtmpPush() async {
- var rpcResult = await call("StartRtmpPush", []);
- return rpcResult;
- }
-
- Future<bool> stopRtmpServer() async {
- var rpcResult = await call("StopRtmpServer", []);
- return rpcResult;
- }
-
- Future<void> openFolderPicker(String path) async {
- var rpcResult = await call("OpenFolderPicker", [path]);
- return rpcResult;
- }
-
- Future<bool> stopRtmpPush() async {
- var rpcResult = await call("StopRtmpPush", []);
- return rpcResult;
- }
- Future<String> getDesktopPath() async {
- var rpcResult = await call("GetDesktopPath", []);
- return rpcResult;
- }
- Future<void> openSpecifiedPath(String path) async {
- var rpcResult = await call("OpenSpecifiedPath", [path]);
- return rpcResult;
- }
-
- Future<Uint8List> readPrintDriverChunk(int index) async {
- String rpcResult = await call("ReadPrintDriverChunk", [index]);
- Uint8List byteData = base64.decode(rpcResult);
- return byteData;
- }
-
- Future<bool?> openImageMeasureAsync(
- String token, String patientCode, String remedicalCode, String recordCode,
- {String source = '0'}) async {
- var rpcRst = await call("OpenImageMeasure",
- [token, patientCode, remedicalCode, recordCode, source]);
- return rpcRst;
- }
-
- Future<bool?> openReportPreviewAsync(String token, String reportCode,
- String recordCode, String isFormEditor) async {
- var rpcRst = await call(
- "OpenReportPreview", [token, reportCode, recordCode, isFormEditor]);
- return rpcRst;
- }
-
- Future<bool?> openReportEditAsync(
- String token,
- String patientCode,
- String reportCode,
- String recordCode,
- String referralRecordCode,
- String consultationCode) async {
- var rpcRst = await call("OpenReportEdit", [
- token,
- patientCode,
- reportCode,
- recordCode,
- referralRecordCode,
- consultationCode
- ]);
- return rpcRst;
- }
-
-
- Future<bool?> openReportDesignerAsync(
- String templateId,
- String name,
- String type,
- String token,
- String json,
- bool isOrg,
- String openMode,
- ) async {
- var rpcRst = await call("OpenReportDesigner", [
- templateId,
- name,
- type,
- token,
- json,
- isOrg,
- openMode,
- ]);
- return rpcRst;
- }
-
- Future<void> onSlaveWindowStart() async {
- await call('OnSlaveWindowStart');
- }
- Future<void> setTemplateJson(String templateId, String json) async {
- await call('SetTemplateJson', [templateId, json]);
- }
-
- Future<void> openLiveConsultationAsync(
- String consultationCode, bool isJoin, int pageIndex, String token) async {
- await call(
- "OpenLiveConsultation", [consultationCode, isJoin, pageIndex, token]);
- }
-
-
-
-
- Future<void> openDeviceLiveWindow(
- String deviceCode, String token, int maxLiveCount) {
- return call("OpenDeviceLiveWindow", [deviceCode, token, maxLiveCount]);
- }
-
- Future<int> getWindowsNum() async {
- var rpcRst = await call("GetWindowsNum");
- return rpcRst;
- }
-
- Future<void> closeSlaveWindow() async {
- var rpcRst = await call("CloseSlaveWindow");
- return rpcRst;
- }
-
- Future<void> closeLiveConsultation() async {
- var rpcRst = await call("CloseLiveConsultation");
- return rpcRst;
- }
-
- Future<void> beginWindowDrag(String windowName) async {
- var rpcRst = await call("BeginWindowDrag", [windowName]);
- return rpcRst;
- }
-
- Future<void> endWindowDrag(String windowName) async {
- var rpcRst = await call("EndWindowDrag", [windowName]);
- return rpcRst;
- }
-
- Future<void> minimizeWindow(String windowName) async {
- var rpcRst = await call("MinimizeWindow", [windowName]);
- return rpcRst;
- }
-
- Future<void> maximizeWindow(String windowName) async {
- var rpcRst = await call("MaximizeWindow", [windowName]);
- return rpcRst;
- }
-
- Future<void> restoreWindow(String windowName) async {
- var rpcRst = await call("RestoreWindow", [windowName]);
- return rpcRst;
- }
-
- Future<int> getWindowState(String windowName) async {
- var rpcRst = await call("GetWindowStateAsync", [windowName]);
- return rpcRst;
- }
-
- Future<void> closeWindow(String windowName) async {
- var rpcRst = await call("CloseWindow", [windowName]);
- return rpcRst;
- }
-
- Future<void> setLanguageCodeAsync(String code) async {
- var rpcRst = await call("SetLanguageCode", [code]);
- return rpcRst;
- }
-
- Future<String> getLanguageCodeAsync() async {
- var rpcRst = await call("GetLanguageCode");
- return rpcRst;
- }
-
- Future<void> setLoginUserInfoAsync(String userInfo) async {
- var rpcRst = await call("SetUserLoginInfo", [userInfo]);
- return rpcRst;
- }
-
- Future<void> setSecondWindowStateInfoAsync(bool isSecondWindowMode) async {
- var rpcRst = await call("SetSecondWindowState", [isSecondWindowMode]);
- return rpcRst;
- }
-
- Future<void> thesaurusChange(String token) async {
- var rpcRst = await call("ThesaurusChange", [token]);
- return rpcRst;
- }
-
- Future<void> onSubmitReport(String patientId, String code) async {
- var rpcRst = await call("OnSubmitReport", [patientId, code]);
- return rpcRst;
- }
-
- Future<void> refershReports() async {
- var rpcRst = await call("RefershReports", []);
- return rpcRst;
- }
-
- Future<void> reloadConfig() async {
- var rpcRst = await call("ReloadConfig", []);
- return rpcRst;
- }
-
- Future<bool> getIsUseSecondWindow() async {
- var rpcRst = await call("GetIsUseSecondWindow", []);
- return rpcRst;
- }
-
- Future<bool> getIsWin7() async {
- var rpcRst = await call("GetIsWin7", []);
- return rpcRst;
- }
-
- Future<void> openConsole() async {
- var rpcRst = await call("OpenConsole", []);
- return rpcRst;
- }
-
- Future<void> onMainWindowLogout() async {
- var rpcRst = await call("OnMainWindowLogout", []);
- return rpcRst;
- }
-
- Future<void> setAutoStartAsync(bool isAutoStart) async {
- var rpcRst = await call("SetAutoStart", [isAutoStart]);
- return rpcRst;
- }
-
- Future<void> startShellRecord() async {
- var rpcRst = await call("StartShellRecord");
- return rpcRst;
- }
-
- Future<String> stopShellRecord() async {
- var rpcRst = await call("StopShellRecord");
- return rpcRst;
- }
-
- Future<bool> exportAppLogZipFile(int exportType, String fileName) async {
- var rpcRst = await call("ExportAppLogZipFile", [exportType, fileName]);
- return rpcRst;
- }
-
- Future<void> startRecording(
- String filePrefixTitle, String micDeviceId) async {
- var rpcRst = await call("StartRecording", [filePrefixTitle, micDeviceId]);
- return rpcRst;
- }
-
- Future<void> pauseRecording(bool isPause) async {
- var rpcRst = await call("PauseRecording", [isPause]);
- return rpcRst;
- }
-
- Future<void> stopRecording() async {
- var rpcRst = await call("StopRecording");
- return rpcRst;
- }
-
- Future<bool> exportConsultationZipFile(String data, String fileName) async {
- var rpcRst = await call("ExportConsultationZipFile", [data, fileName]);
- return rpcRst;
- }
-
- Future<bool> doUpgradClient(String upgradInfo) async {
- var rpcRst = await call("DoUpgradClient", [upgradInfo]);
- return rpcRst;
- }
-
- Future<String> getCurrentAppVersion() async {
- var rpcRst = await call("GetCurrentAppVersion");
- return rpcRst;
- }
-
- Future<void> downloadMeasureData(String url) async {
- var rpcRst = await call("DownloadMeasureData", [url]);
- return rpcRst;
- }
-
- Future<void> downloadBigFile(String url, String fileName) async {
- var rpcRst = await call("DownloadBigFile", [url, fileName]);
- return rpcRst;
- }
-
- Future<List<String>> getAllInstalledPrinterInfos() async {
- var rpcRst = await call("GetAllInstalledPrinterInfos");
- List<String> result = [];
- for (var i in rpcRst) {
- result.add(i.toString());
- }
- return result;
- }
-
- Future<bool> printTestPage(String name) async {
- var rpcRst = await call("PrintTestPage", [name]);
- return rpcRst;
- }
-
- Future<List<String>> getUninstalledPrinters({String? ip}) async {
- var rpcRst = await call("GetUninstalledPrinters", [ip]);
- List<String> result = [];
- for (var i in rpcRst) {
- result.add(i.toString());
- }
- return result;
- }
-
- Future<void> installPrinterDriver(String printerDriveStr) async {
- var rpcRst = await call("InstallPrinterDriver", [printerDriveStr]);
- return rpcRst;
- }
-
- Future<bool> chooseLocalDrive() async {
- var rpcRst = await call("ChooseLocalDrive");
- return rpcRst;
- }
-
- Future<void> closePrinterDriverManager() async {
- var rpcRst = await call("ClosePrinterDriverManager");
- return rpcRst;
- }
-
- Future<String> getUltrasoundUniqueId() async {
- var rpcRst = await call("GetUltrasoundUniqueIdAsync");
- return rpcRst;
- }
-
- Future<String> getNetworkCardsInfo() async {
- var rpcRst = await call("GetNetworkCardsInfo");
- return rpcRst;
- }
-
- Future<bool> saveNetworkCardsInfo(String networkWireListModel) async {
- var rpcRst = await call("SaveNetworkCardsInfo", [networkWireListModel]);
- return rpcRst;
- }
-
- Future<String> getWirelessCardInfo() async {
- var rpcRst = await call('GetWirelessCardInfo');
- return rpcRst;
- }
-
- Future<bool> saveWifiNetworkCard(String networkInterface) async {
- var rpcRst = await call("SaveWifiNetworkCard", [networkInterface]);
- return rpcRst;
- }
-
- Future<bool> connectWifi(String wifiInfo) async {
- var rpcRst = await call("ConnectWifi", [wifiInfo]);
- return rpcRst;
- }
-
- Future<bool> disconnectWifi(String wifiInfo) async {
- var rpcRst = await call("DisconnectWifi", [wifiInfo]);
- return rpcRst;
- }
-
- Future<bool> forgetWifiPassword(String wifiInfo) async {
- var rpcRst = await call("ForgetWifiPassword", [wifiInfo]);
- return rpcRst;
- }
-
- Future<bool> flushDNS() async {
- var rpcRst = await call("FlushDNS");
- return rpcRst;
- }
-
- Future<bool> ping(String ipInfo) async {
- var rpcRst = await call("Ping", [ipInfo]);
- return rpcRst;
- }
-
- Future<bool> startTrainningPush(String pushURL, String micDeviceId,
- TranningPushEnum tranningPushEnum) async {
- var rpcRst = await call("StartTrainningPush", [
- pushURL,
- micDeviceId,
- tranningPushEnum.index,
- ]);
- return rpcRst;
- }
-
- Future<bool> switchPushMode(TranningPushEnum tranningPushEnum) async {
- var rpcRst = await call("SwitchPushMode", [
- tranningPushEnum.index,
- ]);
- return rpcRst;
- }
-
- Future<bool> adjustAudioVoice(
- AudioTypeEnum audioTypeEnum, double audioVolume) async {
- var rpcRst = await call("AdjustAudioVoice", [
- audioTypeEnum.index,
- audioVolume,
- ]);
- return rpcRst;
- }
-
- Future<bool> stopTrainningPush() async {
- var rpcRst = await call("StopTrainningPush");
- return rpcRst;
- }
-
- Future<bool> startTrainningRecord(
- String filePrefixTitle, String pullURL) async {
- var rpcRst = await call("StartTrainningRecord", [
- filePrefixTitle,
- pullURL,
- ]);
- return rpcRst;
- }
-
- Future<bool> stopTrainningRecord(String? path) async {
- var rpcRst = await call("StopTrainningRecord", [path]);
- return rpcRst;
- }
-
- Future<void> openLiveCoursePage(String courseCode, String token) async {
- var rpcRst = await call("OpenLiveCoursePage", [courseCode, token]);
- return rpcRst;
- }
-
- Future<void> cancelDownloadBigFile() async {
- var rpcRst = await call('CancelDownloadBigFile');
- return rpcRst;
- }
-
- Future<void> copyToClipboard(String txtToCopy) async {
- var rpcRst = await call('CopyToClipboard', [txtToCopy]);
- return rpcRst;
- }
-
- Future<void> reloadSettings(String jsonStr) async {
- var rpcRst = await call('ReloadSettings', [jsonStr]);
- return rpcRst;
- }
-
- Future<void> secondWindowInited() async {
- var rpcRst = await call('SecondWindowInited');
- return rpcRst;
- }
-
- Future<List<dynamic>> getAudioDevice(AudioTypeEnum audioTypeEnum) async {
- var rpcRst = await call('GetAudioDevice', [audioTypeEnum.index]);
- return rpcRst;
- }
-
- Future<bool> setActiveDeviceVolume(
- AudioTypeEnum audioTypeEnum, double volume) async {
- var rpcRst = await call('SetActiveDeviceVolume', [
- audioTypeEnum.index,
- volume,
- ]);
- return rpcRst;
- }
-
- Future<double> getAudioDeviceVolume(AudioTypeEnum audioTypeEnum) async {
- var rpcRst = await call('GetAudioDeviceVolume', [audioTypeEnum.index]);
- return rpcRst;
- }
-
- Future<bool> setSystemAudioDevice(String deviceName) async {
- var rpcRst = await call('SetSystemAudioDevice', [deviceName]);
- return rpcRst;
- }
-
- Future<bool> stopPreview() async {
- var rpcRst = await call('StopPreview');
- return rpcRst;
- }
- }
- enum TranningPushEnum {
-
-
-
- Window,
-
-
-
- Screen,
- }
- enum AudioTypeEnum {
-
-
-
- Mic,
-
-
-
- Speaker,
- }
|