AlertWear-T19 Developer's Portal

Introduction

 

For development of applications, please use the resources that can guide and facilitate depending on your requirements:

1. You can use the Communication Protocols listed in the document of Sxtreo T19 (AlertWear) to the user so that the developers can develop their own application, or can integrate with your application.

2. Users can use the SDK in their Mobile App to consume all the methods as and when required. when the data consumption will be done the user can transfer those collected data to our server using the Web APIs provided by us.

3. In the case of BLE Gateway, users can assess the collected data from the server using the web API provided by us to the Mobile App being developed.

The detail of those above-mentioned points are briefed clearly in the next tabs.

BBX T19 Android SDK files
  • .gradle
  • .idea
  • app
  • gradle
  • LibrryT19
  • .gitattributes
  • .gitignore
  • build.gradle
  • gradle.properties
  • gradlew
  • gradlew.bat
  • local.properties
  • settings.gradle

Protocol Doc

Sxtreo T19 Firmware Protocol Document.
Version BLE 1.2

View Protocol Doc

Installation

 

BBX T19 Android SDK enables Developers to Communicate with BBX T19 Devices. SDK will provide Temperature and Contact tracing data from BBX T19 Device. Application set data fetching time interval and date time by SDK. The full project’s source code can be downloaded from https://github.com/avishekmca/T19Device

Before started the entire operation, you have to connect BBX T19 Device by Bluetooth Pairing with your Android Device and place the Bluetooth Address of BBX T19 Device as a parameter for connection. For establish Bluetooth connection you may follow this piece of code.

1. Give the following permissions in Manifiest file.

2. Write this piece of code to your application class.

3. If Bluetooth is supported but disabled, then the isEnabled() method will return false and we can request the user to enable Bluetooth without leaving our application by using startActivityForResult() method with ACTION_REQUEST_ENABLE intent action parameter.

4. Android Enable Discoverability

To make the device discoverable to other devices, we need to start the new activity by calling startActivityForResult(intent, int) with the ACTION_REQUEST_DISCOVERABLE intent.

5. Android List Paired Devices

By using the BluetoothAdapter method getBondedDevices(), we can get the Bluetooth paired devices list.

Compability Versions

 

This SDK is compatible for Android 6.0 (Marshmello) upto Android 10.

Project Dependency

 

To add this Device, 'com.github.avishekmca:T19Device:1.1' is necessary to add on your project. Unless it will not work.

System Requirements

 

Support for Bluetooth 4.0 on the device.

CPU architecture is on of the following: arm, arm64, x86, x86_64, mips, mips64.

Implementation Steps

 

Step 1: Add Dependency

Add this in root build.gradle at the end of repositories:

allprojects {

    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
    
}

Add it to your project:

implementation 'com.github.avishekmca:T19Device:1.1'

Step 2: Register Services

Add Services to manifiest file.

Step 3: Permissions

For BBX T19 library to work in your application, you should add the following permissions to your AndroidManifest.xml:

SDK Methods

 

Step 1: Connect to T19

implements Activity with implements BleWrapperUiCallbacks

Step 2: Initialize variables

Conn conn;

Bluetooth Bluetooth;

private final String LIST_NAME = "NAME";

private final String LIST_UUID = "UUID";

Attributes attributes=new Attributes();

bluetooth = Bluetooth.getInstance(this, this);

conn=new Conn(this,String dvc_id,bluetooth,attributes);

Step 3: Register and Unregister Receiver

For BBX T19 library to work in your application, you should add the following permissions to your AndroidManifest.xml:

Step 4: Service Binding

Intent gattServiceIntent = new Intent (this, BluetoothLeService.class);

bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);

on uiSuccessfulWrite.

Add Receiver

 

Add Broadcast Receiver mGattUpdateReceiver And get Data on OnReceive()

Calling Events

 

int i = 1;

class MyTask extends TimerTask {

public void run() {
        if (mGattCharacteristics != null) {
            if (mGattCharacteristics.size() > 3) {
                // for(int i=1;i<4;i++) {
                if (i == 5) i = 1;
                BluetoothGattCharacteristic characteristic;
                if (i == 1) {
                    characteristic =
                            mGattCharacteristics.get(3).get(0);
                } else {
                    characteristic =
                            mGattCharacteristics.get(6).get(i-1);
                }
                Log.e("count", i + "");
                i = i + 1;
                final int charaProp = characteristic.getProperties();
                if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {
                    // If there is an active notification on a characteristic, clear
                    // it first so it doesn't update the data field on the user interface.
                    if (mNotifyCharacteristic != null
                            && mBluetoothLeService != null) {
                        mBluetoothLeService.setCharacteristicNotification(
                                mNotifyCharacteristic, false);
                        mNotifyCharacteristic = null;
                    }
                    if (mBluetoothLeService != null) {
                        mBluetoothLeService.readCharacteristic(characteristic);
                    }
                }
                if ((charaProp | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
                    mNotifyCharacteristic = characteristic;
                    if (mBluetoothLeService != null) {
                        mBluetoothLeService.setCharacteristicNotification(
                                characteristic, true);
                    }
                }
            }
        }
    }

}

Data Storage

 

private void displayGattServices(List gattServices) {

    if (gattServices == null) return;
    String uuid = null;
    String unknownServiceString = getResources().getString(R.string.unknown_service);
    String unknownCharaString = getResources().getString(R.string.unknown_characteristic);
    ArrayList<HashMap<String, String>> gattServiceData = new ArrayList<>();
    ArrayList<ArrayList<HashMap<String, String>>> gattCharacteristicData
            = new ArrayList<ArrayList<HashMap<String, String>>>();
    mGattCharacteristics = new ArrayList<>();
    // Loops through available GATT Services.
    for (BluetoothGattService gattService : gattServices) {
        HashMap<String, String> currentServiceData = new HashMap<>();
        uuid = gattService.getUuid().toString();
        currentServiceData.put(
                LIST_NAME, SampleGattAttributes.lookup(uuid, unknownServiceString));
        currentServiceData.put(LIST_UUID, uuid);

        gattServiceData.add(currentServiceData);

        ArrayList<HashMap<String, String>> gattCharacteristicGroupData =
                new ArrayList<HashMap<String, String>>();
        List<BluetoothGattCharacteristic> gattCharacteristics =
                gattService.getCharacteristics();
        ArrayList<BluetoothGattCharacteristic> charas =
                new ArrayList<BluetoothGattCharacteristic>();

        for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {
            charas.add(gattCharacteristic);
            HashMap<String, String> currentCharaData = new HashMap<String, String>();
            uuid = gattCharacteristic.getUuid().toString();
            currentCharaData.put(
                    LIST_NAME, SampleGattAttributes.lookup(uuid, unknownCharaString));
            currentCharaData.put(LIST_UUID, uuid);
            gattCharacteristicGroupData.add(currentCharaData);
        }
        mGattCharacteristics.add(charas);
        gattCharacteristicData.add(gattCharacteristicGroupData);
    }

    SimpleExpandableListAdapter gattServiceAdapter = new SimpleExpandableListAdapter(
            this,
            gattServiceData,
            android.R.layout.simple_expandable_list_item_2,
            new String[]{LIST_NAME, LIST_UUID},
            new int[]{android.R.id.text1, android.R.id.text2},
            gattCharacteristicData,
            android.R.layout.simple_expandable_list_item_2,
            new String[]{LIST_NAME, LIST_UUID},
            new int[]{android.R.id.text1, android.R.id.text2}
    );
    mGattServicesList.setAdapter(gattServiceAdapter);

}

private static IntentFilter makeGattUpdateIntentFilter() {

    final IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(BluetoothLeService.ACTION_GATT_CONNECTED);
    intentFilter.addAction(BluetoothLeService.ACTION_GATT_DISCONNECTED);
        intentFilter.addAction(BluetoothLeService.ACTION_GATT_SERVICES_DISCOVERED);
    intentFilter.addAction(BluetoothLeService.ACTION_DATA_AVAILABLE);
    return intentFilter;

}

Device Battery Status

 

Call this methods to get Battery Information.

attributes.getBattery() methods returns Battery Information details.

Add this after conn.display(intent.getStringExtra(BluetoothLeService.EXTRA_DATA));

Device Contact Tracing Data

 

Step 1: Add this piece of code

int i = 4;

class MyTask extends TimerTask {

public void run() {
    if (mGattCharacteristics != null) {
        if (mGattCharacteristics.size() > 3) {
            if (i == 78) i = 4;
            BluetoothGattCharacteristic characteristic;
            characteristic =
                    mGattCharacteristics.get(6).get(i);
            i = i + 1;
            final int charaProp = characteristic.getProperties();
            if ((charaProp | BluetoothGattCharacteristic.PROPERTY_READ) > 0) {
                if (mNotifyCharacteristic != null
                        && mBluetoothLeService != null) {
                    mBluetoothLeService.setCharacteristicNotification(
                            mNotifyCharacteristic, false);
                    mNotifyCharacteristic = null;
                }
                if (mBluetoothLeService != null) {
                    mBluetoothLeService.readCharacteristic(characteristic);
                }
            }
            if ((charaProp | BluetoothGattCharacteristic.PROPERTY_NOTIFY) > 0) {
                mNotifyCharacteristic = characteristic;
                if (mBluetoothLeService != null) {
                    mBluetoothLeService.setCharacteristicNotification(
                            characteristic, true);
                }
            }
        }
    }
 }

}

Step 2: Fetching Contact Tracing Data

attributes.getAlrt_wr_mac_id() & attributes.getCntct_dt() returns Contact Tracing Data.

Add this after conn.display(intent.getStringExtra(BluetoothLeService.EXTRA_DATA)); Provides Conditions
!attributes.getAlrt_wr_mac_id().matches("") && attributes.getAlrt_wr_mac_id().length() > 4.

Device Temperature Data

 

Call this methods to get Temparature Information.

attributes.getTemp_cen(), attributes.getTemp_frn() methods returns Temparature details.

Add this after conn.display(intent.getStringExtra(BluetoothLeService.EXTRA_DATA));

Web API

Security Policy

 

Use of personal information

Personal data and other kinds of information is collected and used for the purpose of providing our services to you. This kind of information might be collected as required by us and we would aim to prevent the violation of personal integrity in the processing of personal data. We will, of course, always handle personal data about you in accordance with the relevant legislation.

Let's Get In Touch!


Ready to start your next project with us?
That's great! Give us a call or send us an email and we will get back to you as soon as possible!

Black Box Network Services India Pvt. Ltd.

+91 990 309 1725 / +91 907 392 9780

Copyright © 2021 Sxtreo. All Rights Reserved.