BGXpress Framework Introduction

BGX General Overview

Introduction

The Silicon Labs BGX device provides a bridge between Bluetooth Low Energy (BLE) and Serial communication. The BGXpressService makes it easy to build an Android app that interacts with BGX. It supports discovery of BGX devices, connecting and disconnecting, setting and detecting the bus mode of the BGX, sending and receiving data, and OTA (Over The Air) Firmware Updates of the BGX accessed through the Silicon Labs DMS (Device Management Service).

Getting Started

To use the BGXpressService in your Android app, you will add the BGXpressService.java file to your android project, declare the BGXpressService as an intent service to in your AndroidManifest.xml file, and add your DMS_API_KEY to the manifest. If you don't have a DMS_API_KEY yet, supply an empty string and be aware that you won't be able to access the Silicon Labs DMS Server until you obtain a DMS_API_KEY.

In order to use DMS to obtain firmware updates using your app, you should obtain a DMS_API_KEY from Silicon Labs by emailing xpress@silabs.com . This key can be used by both your Android and iOS apps. It should however be specific to your company and/or product.

Design Limitations

Android Minimum SDK

BGXpressService is designed to target SDK version 27. It requires a minimum SDK version 23.

One BGX at a time

BGXpressService is currently designed for connecting to one BGX at a time.

Adding BGXpressService to your Android app

To use the BGXpressService in your Android app, follow these steps:

  1. Add the files BGXpressService.java and BusMode.java into your Android app.
  2. Declare the BGXpressService in your AndroidManifest.xml file like this:
  3. If you do not yet have a DMS_API_KEY, supply an empty string for now.
  4. Add the following declarations to your AndroidManifest.xml file:

Understanding BGX

Discovery

In order to communicate with a BGX device, use the BGXpressService to discovery BGX devices, then select a BGX device and connect.

BusMode

BGX operates in one of three Bus Modes: STREAM_MODE, LOCAL_COMMAND_MODE, and REMOTE_COMMAND_MODE. In LOCAL_COMMAND_MODE mode, data that is sent to the BGX using the serial lines is interpreted by a command processor. In REMOTE_COMMAND_MODE mode, data that is sent over Bluetooth stream service is interpreted by the Command API. In STREAM_MODE mode, a serial connection is made between serial lines of the BGX and the app using BGXpressService.

The command mode can be used to read and write properties of the BGX including characteristics of the serial interface (e.g. baud rate, flow control...), bluetooth device properties, and the BGX itself. See BGX13-1.0 Command Reference for more information.

Serial Communication

Your Android app can send data to and receive data from the connected BGX device.

Firmware Update

You can use BGXpressService to detect when a new version of firmware is available for your BGX.

DMS

DMS (Device Managemnt Service) is used to retrieve available firmware for BGX. There is a module built into BGXpressService that supports the operations of retriving a list of the available firmware for your BGX and loading the firmware onto your mobile device.

OTA_Update

BGXpressService can be used to udpate the firmware on BGX devices using a firmware update retrieved through DMS. Your app can register a BroadcastReceiver to receive OTA_STATUS_MESSAGE Broadcast Intents from the BGXpressService.