跳至中繼資料的結尾
前往中繼資料的開頭

您正在檢視此頁面的舊版本。請檢視目前版本

比較目前 檢視頁面歷程記錄

« 上一頁 版本 4 下一步 »

Introduction

We build up the medical IoT platform called OmniCare, collecting different kinds of vital signs data from our partners’ devices, in order to be more convenient for third party integration with their application we have developed the OmniCare SDK.

It can easy to communicate with the supported devices, such as create a connection channel, connect device, upload device vital signs data to OmniCare and retrieve the vital signs data back from OmniCare.

System Requirements

Target OS: Android 5.0 (API Level 21) or higher.

How it works

See the sequence diagram below, it shows how does OmniCare SDK work.

Getting Started

Adding the OmniCare SDK to an Android Studio Project

The OmniCare SDK is distributed as aar file. To add it to your project, copy OmniCareSDK.aar to the libs folder and add the following to your build.gradle.

repositories { 
    flatDir { 
        dirs 'libs' 
    }
}

dependencies { 
    implementation(name: 'OmniCareSDK', ext: 'aar')
}

Permissions & Service

Add the properties in manifest file. For Android 6.0+, users grant permissions to apps while the app is running, not when they install the app. Please refer official document to add necessary code: https://developer.android.com/training/permissions/requesting.html.

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

<!-- Coarse Location for API <29 (Android 9 and lower) -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<!-- Fine Location for API >=29 (Android 10 and higher) -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<!-- Permission needed for Android Pie to distinguish who is calling -->
<uses-permission android:name="android.permission.READ_CALL_LOG"/>

<!-- Permission needed for Android Oreo call handling -->
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS"/>

<!-- Permission needed to reject incoming phone calls -->
<uses-permission android:name="android.permission.CALL_PHONE"/>

<!-- Media Control Permission for Advanced Music Controls -->
<uses-permission android:name="android.Manifest.permission.MEDIA_CONTENT_CONTROL"/>

<!-- Foreground Permission required for newer Android SDKs -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

Add the <service> tag below, contained in <application> tag in manifest file.

<!-- For VivoWatchBP BLE communication service--> 
<service
    android:name="com.asuslife.omnicaresdk.BluetoothLeServiceVivoWatchBP" 
    android:enabled="true"
    android:exported="false" />
<!-- You can customize NotificationListenerService label name on your own --> 
<service 
    android:name="com.asuslife.omnicaresdk.NotificationListenerService"
    android:label="Custom" 
    tools:replace="label"/>
<service 
    android:name="com.garmin.android.gncs.GNCSListenerService" 
    android:label="Custom"
    tools:replace="label"/>
<!-- You can change the foreground notification icon on your own → 
<meta-data
    tools:replace="resource" 
    android:name="com.garmin.health.foreground_notification_icon" 
    android:resource="@mipmap/ic_launcher"/>

Dependencies

The OmniCare SDK has dependencies on the following third-party library that will need to be included in you project.


build.gradle file

implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
implementation 'com.google.guava:guava:28.0-android'
implementation 'net.danlew:android.joda:2.9.9.2'
implementation "androidx.room:room-runtime:2.2.3"
implementation "androidx.room:room-guava:2.2.3"
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'com.github.tony19:logback-android:1.1.1-12'
implementation 'net.zetetic:android-database-sqlcipher:4.3.0'

How to use the OmniCare SDK

Before using the OmniCare SDK, you need to initialize it first. Add a call to AsusLifeOmniCare.initialize() in the onCreate() method of your Application class. (If you gona build with Garmin devices, please be sure to pass the license key to the init method)

AsusLifeOmniCare.initialize(context, account, password, new AsusLifeOmniCareInitializationCallback() { 
    @Override 
    public void onSuccess() { 
    // Called when the initializing process completes successfully.
    } 
    
    @Override 
    public void onFailed(AsusLifeOmniCareInitializationException e) { 
    // Called if initializing fails.
    }
});

Device Communication

Finding OmniCare Devices

The first step in communication is finding a device to communicate with. The BLE scanning APIs provided by the Android SDK are used for this.

After you hold the Location permission, you have also to verify that Location services are enabled before starting the scan.

private void verifyLocationServices() { 
    final LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); 
    if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER) && !manager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { 
        buildAlertMessageNoGps(); 
    } 
}

With the prerequisites taken care of, we can start the scan. BluetoothLeScanner requires a ScanCallback to return results of the scan. AsusLifeDeviceScanCallback is provided to filter the scan results to only include OmniCare devices that are supported by the SDK. You must extend this class to get the results of the scan.

private AsusLifeDeviceScanCallback asusLifeDeviceScanCallback = new AsusLifeDeviceScanCallback() { 
    @Override 
    public void onScannedDevice(ScannedDevice device) { 
    // Called when a OmniCare Device advertisement has been found. 
    } 
    @Override 
    public void onScanStarted() { 
    // Called when Bluetooth Low Energy start to scan. 
    } 
    @Override 
    public void onScanFinished() { 
    // Called when Bluetooth Low Energy scan finished. 
    } 
    @Override 
    public void onScanFailed() { 
    // Called when Bluetooth Low Energy scan failed. 
    } 
};

…

DeviceManager deviceManager = AsusLifeOmniCare.getDeviceManager();

deviceManager.startScan(asusLifeDeviceScanCallback, millis);

...

Pairing a Device

Attempt to pair a scanned device returned from BLE scanning in the SDK.

private PairingCallback pairingCallback = new PairingCallback() { 
    @Override 
    public void pairingFailed(PairingFailedException cause) { 
    // Called if pairing fails. 
    } 
    @Override 
    public void pairingSucceeded(Device device) { 
    // Called when the pairing process completes successfully. 
    } 
};

…

DeviceManager deviceManager = AsusLifeOmniCare.getDeviceManager();

deviceManager.requestDevicePair(scannedDevice, pairingCallback);

...

Syncing & Uploading Data

As the device has been paired, using the method below to sync the vital signs data from device and upload the data to OmniCare.

private SyncingCallback syncingCallback = new SyncingCallback() { 
    @Override 
    public void onSyncComplete(Device device) { 
    // Called when the syncing process completes successfully. 
    } 
    @Override 
    public void onSyncFailed(Device device, SyncingFailedException e) {
    // Called if syncing fails. 
    } 
    @Override 
    public void onSyncStarted(Device device) { 
    // Called if syncing starts. 
    } 
}

…

DeviceManager deviceManager = AsusLifeOmniCare.getDeviceManager();

deviceManager.requestDeviceSync(device, syncingCallback);

...

Vital Signs Data Integration

Through OmniCare Platform

After the device syncing is successful, using method below to request vital signs data from OmniCare.

OmniCareAPI.getDataByDevcie(device, startTime, endTime, new OmniCareAPI.DataRequestCallback() { 
    @Override 
    public void onSuccess(SyncResultData syncResultData) {
    // Called when the data requesting process completes successfully. 
    } 
    @Override 
    public void onError(DataRequestException dre) {
    // Called if data requesting fails. 
    } 
});

Additional Information

Proguard Configuration

A number of the libraries required as dependencies for the SDK also have proguard configuration requirements. The complete recommended configuration is located in the SDK Sample App.

Release Notes

V1.10.0(May 2022)

1.Fix VivoWatch SP Compatible with new FW.

2.Add getLocalData

 

V1.9.2(May 2022)

1.VivoWatch SP,5 support altitude, air pressure, g sensor.

 

V1.9.1(April 2022)

1.Fix crash when legacy upgrade.

 

V1.9.0(April 2022)

1.Added support for VivoWatch 5.

 

V1.8.0(May 2021)

1.Added support for GERD CAP.

 

V1.7.0(January 2021)

1.Added support for VivoWatch SP.

 

V1.6.2(December 2020)

1.Added data logging during data upload to OmniCare.

V1.6.1(September 2020)

1.Security update.

V1.6.0(August 2020)

1.In order to ensure the stability of data retrieval, we have established a local database. When the server is abnormal, the data will be returned from the local database.

V1.5.0(July 2020)

1.Added support for VivoSmart 4.

V1.4.3(June 2020)

1.Fine tuned SSL Pinning logic.

2.Fine tuned IOException(no internet or server connection timed out).

3.Fine tuned device pairing logic.

V1.4.2(May 2020)

1.Updated SSL Pinning.

V1.4.0(March 2020)

1.Modified GetTokenResponse model(removed sguri).

2.Modified OmniCareECGData model.

3.Added OmniCarePPGData model.

4.Exporting ECG, PPG data from ASUS VivoWatch BP.

V1.3.0(January 2020)

1.Set the bluetooth connection service to foreground, you can customize your own foreground service parameters from strings.xml file(keys: omnicaresdk_foreground_service_title, omnicaresdk_foreground_service_message, omnicaresdk_foreground_service_channel_name), it will run in the foreground after OmniCareSDK is initialized.

2.Fixed the sleep data missing issue.(ASUS VivoWatch BP)

3.Revised the sleep data format.(ASUS VivoWatch BP)

4.Added the location data model and ASUS VivoWatch BP exercise mode data paring.

V1.2.2(January 2020)

1.Fine tune ASUS VivoWatch BP phone call feature

2.Don't forget to add "<uses-permission android:name="android.permission.READ_CONTACTS"/>" to your AndroidManifest.xml file:

<manifest

...

    <uses-permission android:name="android.permission.READ_CONTACTS"/>

...

</manifest>

V1.2.1(January 2020)

1.Fine tune BLE connection

2.Fine tune notification feature

3.Custom label for NotificationListenerService, example as below, added it to your AndroidManifest.xml file:

...

<application

...

<service android:name="com.asuslife.omnicaresdk.NotificationListenerService"

            android:label="Custom"

            tools:replace="label"/>

...

</application>

...

V1.2.0(December 2019)

1.New feature
-Added notification setting options to VivoWatch BP

V1.1.1(December 2019)

1.Bug fix
-Solving Activity -> Activity data transferring problem.

V1.1.0(November 2019)
1.New feature
-FW update
-Pill reminder
-Frequency of checks setting

V1.0.0

1.New release.

Reference

Please see javadoc for more information.

  • 無標籤