Last Updated on : 2024-10-15 03:12:09download
Integration of standard Bluetooth Low Energy (LE) protocol provides data pass-through channel services for MCU and mobile app under Bluetooth LE connection. Thus, meet customized requirements and implement direct communication between the two parties.
Thanks to the generic Bluetooth module, the data pass-through channel service enables the MCU to directly establish a communication channel with the mobile app over Bluetooth, helping meet the varied development needs of the MCU.
Scenarios:
Applicable firmware: Currently, only BF6H Bluetooth LE generic firmware supports this service, and other firmware will be available soon.
MCU -> module:
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55 0xAA |
Version number | 1 | 0x00 |
Command (CMD) | 1 | 0xC4 |
Data length (Len) | 2 | 0x02 |
Subcommand | 1 | 0x00 |
DATA | 1 | Config |
CRC8 | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Description of config:
Module -> MCU:
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55 0xAA |
Version number | 1 | 0x00 |
Command (CMD) | 1 | 0xC4 |
Data length (Len) | 2 | 0x02 |
Subcommand | 1 | 0x00 |
DATA | 1 |
|
CRC8 | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
This channel supports two-way data transparent transmission. The module does not process specific data, but directly transmits the raw data to the app for processing. Typically, this channel is used in conjunction with custom logic in a panel or app.
MCU <-> module:
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55 0xAA |
Version number | 1 | 0x00 |
Command (CMD) | 1 | 0xC4 |
Data length (Len) | 2 | Upper 8 bits Lower 8 bits |
Subcommand | 1 | 0x01 |
DATA | Len-1 | RAW_DATA : The raw data. |
CRC8 | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Here are some examples of implementation through the data pass-through channel service.
When the mobile phone receives a message notification, the module will send the following data in the specified format through the data pass-through channel.
Data format of message notification (data is sent through the data pass-through channel) | |||
---|---|---|---|
Field name | TYPE | DATA_LENGTH | DATA |
Field length | 1 byte | 2 bytes | n byte(s) |
Field value | … | n | … |
The message notification is represented in type-length-data (TLD) format. The specific fields are as follows: TYPE: The notification type. DATA_LENGTH: The length of notification content, in big-endian format. DATA: The notification content. |
|||
Type, upper four bits | Sub-type, lower four bits | Values of type | Notification type | DATA_LENGTH | DATA | |
---|---|---|---|---|---|---|
0000 Message notification-originally defined |
0001 | 0x01 | Phone call | … | The type with 1 byte. 0x01: incoming call 0x02: answer 0x03: hang up |
Phone number (Unicode encoding) This field is available only when the type is incoming call. |
0010 | 0x02 | SMS message | … | Unicode encoding: uses 2 bytes for 1 character. For example, the Unicode code of the Chinese character 今 is \u4eca, and the transmission sequence is 0xCA, 0x4E. |
||
0011 | 0x03 | Tencent QQ | … | |||
0100 | 0x04 | … | ||||
0101 | 0x05 | … | ||||
0110 | 0x06 | Messenger | … | |||
0111 | 0x07 | … | ||||
1000 | 0x08 | … | ||||
1001 | 0x09 | … | ||||
1010 | 0x0A | … | ||||
1011 | 0x0B | Viber | … | |||
1100 | 0x0C | LINE | … | |||
1101 | 0x0D | Skype | … | |||
1110 | 0x0E | Outlook | … | |||
1111 | 0x0F | Others | … | |||
0011 Message notification-new |
0001 | 0x31 | WhatsApp Business | … | Unicode encoding: uses 2 bytes for 1 character. For example, the Unicode code of the Chinese character 今 is \u4eca, and the transmission sequence is 0xCA, 0x4E. |
|
0010 | 0x32 | … | ||||
0011 | 0x33 | Calendar | … | |||
0100 | 0x34 | KakaoTalk | … | |||
0101 | 0x35 | VKontakte | … | |||
0110 | 0x36 | Tumblr | … | |||
0111 | 0x37 | Snapchat | … | |||
1000 | 0x38 | Telegram | … | |||
1001 | 0x39 | YouTube | … | |||
1010 | 0x3A | … | ||||
1011 | 0x3B | TikTok | … | |||
1100 | 0x3C | Gmail | … | |||
1101 | 0x3D | Tuya | … |
Example of message notification:
WeChat: It’s really hot today
55 AA 00 C4 00 0C 01 04 00 08 CA 4E 29 59 1F 77 ED 70 68
Hang up calls (03
indicates hang up):
55 AA 00 C4 00 05 01 01 00 01 03 CE
Incoming call (01
indicates incoming call): 15000000000
55 AA 00 C4 00 19 01 01 00 17 01 31 00 35 00 30 00 30 00 30 00 30 00 30 00 30 00 30 00 30 00 30 00 0C
A: Whenever the application layer receives the message notification switch DP data as ‘on’, both the pass-through channel and the mobile message notification service must be enabled through the pass-through channel switch (0xC400). For the iOS scenario, after receiving the command to turn on, the module will send a pairing request to the phone and request system notification permissions. Users need to confirm in the panel pop-up to use the message notification feature properly.
Additionally, when the device is unbound, users should follow the app’s pop-up prompts to unpair Bluetooth in the system Bluetooth settings. Otherwise, the device might experience connection issues.
If you have any problems with TuyaOS development, you can post your questions in the Tuya Developer Forum.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback