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

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

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

« 上一頁 版本 2 下一步 »

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 ASUS VivoWatch BP, 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" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<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_CONTACTS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>


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


<service
android:name="com.asuslife.omnicaresdk.BluetoothLeServiceVivoWatchBP"
android:enabled="true"
android:exported="false" />


Dependencies

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


build.gradle file

compile 'com.google.code.gson:gson:2.7'


How to use the OmniCare SDK

Before using the OmniCare SDK, you need to initialize it first. AsusLifeOmniCare.initialize() must be added to all entry point Activities.

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.
}
});


Release Notes

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.

  • 無標籤