You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.2 KiB
Dart
78 lines
2.2 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
class BleChannel {
|
|
static const platform = MethodChannel('BLE-Platform-Bridge');
|
|
|
|
static const platform_ios_ekg = MethodChannel('BLE-Platform-Bridge-IOS-EKG');
|
|
|
|
// static const platform_ios_ekg = MethodChannel('BLE-Platform-Bridge-IOS-EKG');
|
|
|
|
//BLE-Platform-Bridge
|
|
static Future<String> getScanningResult(List<String> deviceType) async {
|
|
try {
|
|
String result;
|
|
print("----------Flutter Init -------");
|
|
// if (Platform.isIOS && deviceType[0] == "ekg") {
|
|
// result = await platform_ios_ekg.invokeMethod('scanEKG', deviceType);
|
|
// } else {
|
|
result = await platform.invokeMethod('scan', deviceType);
|
|
// }
|
|
print("----------Flutter Result -------");
|
|
print(result);
|
|
return result;
|
|
} catch (e) {
|
|
return "Error: $e";
|
|
}
|
|
}
|
|
|
|
static Future<String> getEKGFilesList(List<String> deviceType) async {
|
|
try {
|
|
print("----------Flutter Init -------");
|
|
final String result = await platform.invokeMethod('ekg_files_list', deviceType);
|
|
print("----------Flutter Result -------");
|
|
print(result);
|
|
return result;
|
|
} catch (e) {
|
|
return "Error: $e";
|
|
}
|
|
}
|
|
|
|
static Future<String> getBP2FilesList(List<String> deviceType) async {
|
|
try {
|
|
print("----------Flutter Init -------");
|
|
final String result = await platform.invokeMethod('bp2_files_list', deviceType);
|
|
print("----------Flutter Result -------");
|
|
print(result);
|
|
return result;
|
|
} catch (e) {
|
|
return "Error: $e";
|
|
}
|
|
}
|
|
|
|
static Future<String> getEKGFileDetails(String fileName) async {
|
|
try {
|
|
print("----------Flutter Init -------");
|
|
final String result = await platform.invokeMethod('ekg_file_detail', fileName);
|
|
print("----------Flutter Result -------");
|
|
print(result);
|
|
return result;
|
|
} catch (e) {
|
|
return "Error: $e";
|
|
}
|
|
}
|
|
|
|
static Future<String> disconnect() async {
|
|
try {
|
|
print("----------Flutter Init -------");
|
|
final String result = await platform.invokeMethod('disconnect_device');
|
|
print("----------Flutter Result -------");
|
|
print(result);
|
|
return result;
|
|
} catch (e) {
|
|
return "Error: $e";
|
|
}
|
|
}
|
|
}
|