BLUEST-SDK是ST.com提供的针对无线互联感测设备(如低功耗蓝牙传感器开发板、原型套件)开发的跨平台软件协议,以利于嵌入式设备与移动端的彼此连通同时该SDK为MCU的开发工程师在iOS和Android设备端的快速app开发提供了基本参考。
举一个非常具体的例子,在ST的传感器蓝牙产品开发套件中有很多不同的开发套件:nucleo套件(F4,L4,L0等+sensor+BLUENRG系列)、WeSU(L1+sensor+BLUENRG系列)、SensorTile(L4+sensor+BLUENRG系列),但在移动设备端的BLUSMS应用却总能和不同套件相互“握手”:这种握手之所以能够实现,都是由于相关开发套件上的MCU已经采用BlueST协议(准确的说是低功耗蓝牙的BlueSTprofile):这带来一个非常大的好处:软件人员可以从IOS/Android和嵌入式端同时开始应用设计,而不需要担心传感器数据无法连通,因为蓝牙连通的协议已经在BLUEST中预定了。
BlueST协议已经定义了不同传感器的各种数据,如惯性传感器(加速度计、磁强计和陀螺仪),环境传感器(亮度、温度、压力、湿度),电池信息(伏特,安培,充电状态)。STM32嵌入式端的兼容BlueST协议的代码已经可以在各开发套件的示例工程中找到。(也可以通过[url=]www.st.com搜索BlueMicrosystem1[/url]获取)
BlueST-SDK可使Android和iOS系统的应用开发十分简便。软件库中包含有介绍SDK使用方法的用例。而BLUEMS就是基于BLUEST-SDK开发一款跨平台app。在BlueMS中,BlueST-SDK同样用于展示BLUEMICROSYSTEM1扩展软件输出的数据及信息。
BlueST-SDK下载信息:
Order code | 描述 | 下载地址 |
BlueST-SDK-Ipa | IOS版BlueST-SDK | [url=]https://github.com/STMicroelectronics-CentralLabs/BlueSTSDK_iOS[/url] |
BlueST-SDK-Aar | Android版BlueST-SDK | [url=]https://github.com/STMicroelectronics-CentralLabs/BlueSTSDK_Android[/url] |
应用程序下载信息:
BlueMS App(Android):[url=]https://github.com/STMicroelectronics-CentralLabs/STBlueMS_Android[/url]
BlueMS App(IOS):[url=]https://github.com/STMicroelectronics-CentralLabs/STBlueMS_iOS[/url]
下面为git上BlueSTSDK的说明,有兴趣的朋友可以看看
BlueST SDK
BlueST is a multi-platform library (Android and iOS supported) that permits easy access to the data exported by a Bluetooth Low Energy (BLE) device that implements the BlueST protocol.
BlueST ProtocolAdvertiseThe library will show only the device that has a vendor-specific field formatted in the following way:
The Field Length must be 7 or 13 bytes long.
The Device Id is a number that identifies the type of device. It is used to select different types of feature mask and can manage more than 32 features. Currently used values are:
- 0x00 for a generic device
- 0x01 is reserved for the STEVAL-WESU1 board
- 0x80 for a generic Nucleo board
- 0x81 for a Nucleo board exporting remote feature
You should use a value between 0x02 and 0x7F for your custom board, as values between 0x80 and 0xFF are reserved for ST Nucleo boards.
The feature mask is a bit field that provides information regarding what characteristics/features are exported by the board. Currently, bits are mapped in the following way:
You can use one of the RFU bits or define a new device and decide how to map the feature. To see how the data is exported by pre-defined features, consult the export method Feature.ExtractResult Feature.extractData(long,byte[],int). within the feature class definition.
- The device MAC address is optional and useful only for obtaining the device MAC address on an iOS device.
Characteristics/FeaturesThe characteristics managed by the SDK must have a UUID such as: XXXXXXXX-0001-11e1-ac36-0002a5d5c51b. The SDK will scan all the services, searching for characteristics that match that pattern.
The first part of the UUID will have the bit set to 1 for each feature exported by the characteristics.
In case of multiple features mapped in a single characteristic, the data must be in the same order as the bit mask.
The characteristic data format must be:
The first 2bytes are used to communicate a time stamp. This is especially useful forrecognizing any data loss.
Since theBLE packet max length is 20 bytes, the max size for a feature data field is 18bytes.
RemoteFeatureThis type ofFeature are created for handle the case when the node collect information fromother boards the user want to know also how produced the data.
For thistype of feature a node ID is attach at the beginning of a standard featureupdate message.
For thistype of feature the characteristic data format must be:
Special Services[url=]Debug[/url]If available, the debug service must have the UUID 0000000-0000E-11e1-9ab4-0002a5d5c51b and will contains 2 characteristics:
- 00000001-000E-11e1-ac36-0002a5d5c51b (Notify/Write) is used to send string commands to the board and to notify the user of the result.
- 00000002-000E-11e1-ac36-0002a5d5c51b (Notify) is used by the board to notify the user of an error message.
ConfigurationIf available, the configuration service must have the UUID 00000000-000F-11e1-9ab4-0002a5d5c51b and will contain 2 characteristics:
The requestmessage must have the following format:
Where thefirst 4 bytes will select the recipient of the command/data package.
Theoptional command answer must have the following format:
From theSDK point of view the messages are sent using the method [url=]Feature.sendCommand[/url] and the answer is notified with acallback passed through the method [url=]Feature.parseCommandResponse[/url].
If thischaracteristic does not exist, but the characteristics that export the featureis in write mode, the command id and the commanddata are sendingdirectly to the feature characteristics. In this case is not possible answer tothe command.
ExampleThe ST Bluemicrosystem1,STBluemicrosystem2, ST Bluemicrosystem3 and ST Sensor Tile firmware implementsthis protocol, you can find the projects source here: [url=]Bluemicrosystem[/url]
How to install the libraryAs an external library- Clone the repository
- Add the BlueSTSDK directory as a submodule of your project: File->Import Module
As a git submodule1. Add the repository as a submodule:
$ git submodule add https://github.com/STMicroelectr ... ueSTSDK_Android.git BlueSTSDK- Add the SDK as a project submodule in the settings.gradle file, adding the line:
include ':BlueSTSDK:BlueSTSDK'