Integrating EKG device
parent
2500441832
commit
e52e75aefd
@ -0,0 +1,115 @@
|
||||
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||
import 'package:diplomaticquarterapp/viatom_ble/ble_connect.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class EKG_BLE extends StatefulWidget {
|
||||
const EKG_BLE();
|
||||
|
||||
@override
|
||||
State<EKG_BLE> createState() => _EKG_BLEState();
|
||||
}
|
||||
|
||||
class _EKG_BLEState extends State<EKG_BLE> {
|
||||
EventChannel eventChannel = EventChannel('BLE-Platform-Bridge-Event');
|
||||
String receivedData = '';
|
||||
|
||||
final ekgValueNotifier = ValueNotifier<String>("start");
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
ekgValueNotifier.dispose();
|
||||
super.dispose();
|
||||
BleChannel.disconnect();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
eventChannel.receiveBroadcastStream().listen((event) {
|
||||
print('Received event---: $event');
|
||||
ekgValueNotifier.value = event;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
appBarTitle: "EKG Tracker",
|
||||
showNewAppBar: true,
|
||||
isShowDecPage: false,
|
||||
showNewAppBarTitle: true,
|
||||
backgroundColor: Color(0xffF8F8F8),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: DefaultButton(
|
||||
"Get Info",
|
||||
() async {
|
||||
await BleChannel.getScanningResultEKG(["oximeter", "ekg"]);
|
||||
},
|
||||
textColor: Colors.white,
|
||||
),
|
||||
),
|
||||
mWidth(16.0),
|
||||
Expanded(
|
||||
child: DefaultButton(
|
||||
"Get Files List",
|
||||
() {},
|
||||
textColor: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
mHeight(50.0),
|
||||
ValueListenableBuilder(
|
||||
valueListenable: ekgValueNotifier,
|
||||
builder: (context, value, _) {
|
||||
return Text(value);
|
||||
// ? Platform.isAndroid
|
||||
// ? Column(
|
||||
// children: [
|
||||
// Text(
|
||||
// getSPO2(
|
||||
// value.toString().replaceAll("RtParam", ""),
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// getPR(
|
||||
// value.toString().replaceAll("RtParam", ""),
|
||||
// ),
|
||||
// ),
|
||||
// // Text(
|
||||
// // getPI(
|
||||
// // value.toString().replaceAll("RtParam", ""),
|
||||
// // ),
|
||||
// // ),
|
||||
// ],
|
||||
// )
|
||||
// : Column(
|
||||
// children: [
|
||||
// Text(getSPO2iOS(value.toString())),
|
||||
// Text(getPRiOS(value.toString())),
|
||||
// ],
|
||||
// )
|
||||
// : Text(value);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue