The Sense SDK is a powerful toolkit that allows developers to seamlessly connect and interact with Sense devices within their Flutter applications.

Features

  • BLE connect & disconnect
  • Data Sync
  • OTA/Firmware updates
  • Fetch the BP, Spo2 & ECG 1, 6 records
  • Generate PDF report

Getting started

Please make sure the Bluetooth,Wifi & Location is turned on.

Usage

Add the sdk module path in pubspec.yaml in your flutter app

alt text

In android/app/main/AndroidManifest.xml

    <uses-permission android:name="android.BLUETOOTH" />
    <uses-permission android:name="android.BLUETOOTH_ADMIN" />
	<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-feature android:name="android.hardware.bluetooth_le" android:required="true"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
    <uses-permission android:required="true" android:name="android.permission.ACCESS_WIFI_STATE"/>
    <uses-permission android:required="true" android:name="android.permission.CHANGE_WIFI_STATE"/>
    <uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES"/>
    <uses-feature android:name="android.hardware.wifi" />

Import the package

import 'package:sense_sdk/sense_sdk.dart';

Initialize SenseH SDK

SenseH senseH = SenseH();

Create Instance passing apiKey, name, patientId, dob(date of birth YYYY-mm-dd), gender

 senseH.instance(
          apiKey: "xyz",
          name: "user-name",
          patientId: "currentUserId",
          dob: "date of birth",
          gender: "gender");

Connect to sense device - (Make sure bluetooth & location permission are given access)

 final senseDevice = await senseH.findAndConnectSenseH();

Check the devcie connection status

await senseH.isDeviceConnected();

//Can be used with timer to check in periodic intervals
example :
 Timer.periodic(Duration(seconds: 3), (timer) async {
      final status = await senseH.isDeviceConnected();
      if (mounted) {
        setState(() {
          bleConnected = status;
          if(!bleConnected){
            isDataSyncing = false;
          }
        });
      }
    });

Sync the data

await senseH.dataSync();

Listen to the data sync percentage

  late StreamSubscription? _dataSyncSubscription;
 _dataSyncSubscription = senseH.dataSyncPercentageController.stream.listen((event) {
                 print(event);
                  }
                );

Check for OTA/firmware update

final isUpdateAvailable = await senseH.checkForFirmwareUpdate();

//if new version is found, start updating
await senseH.startFirmwareUpdate();

//Listen to the update percentage
  late StreamSubscription? _otaUpdateSubscription;

 _otaUpdateSubscription = senseH.firmwareUpdatePercentageController.stream.listen((event) {
                      }, onDone: () {
                        print("Updated latest firmware");
                      }, onError: (e) {
                     print(e);
                      });

Fetch the vitals records by passing userId filters - "day", "month", "week", "quarter" or "year". Paginate by adding Page Index and Data limit per api call.

 //Blood Pressure
 await senseH.fetchBP(
        patientId: patientUserId, period: 'day', pageIndex: '0', limit: '20');

//Sp02
await senseH.fetchSP02(
        patientId: patientUserId, period: 'week', pageIndex: '0', limit: '20');

//ECG lead 1
await senseH.fetchECG1(
        patientId: patientUserId, period: 'quarter', pageIndex: '0', limit: '20');

//ECG lead 6
await senseH.fetchECG6(
        patientId: patientUserId, period: 'month', pageIndex: '0', limit: '20');

Generate report of the user

 await senseH.fetchReport(patientId: "UserId");

Libraries

senseh_sdk