Data Pass-through Channel Service

Last Updated on : 2024-06-24 08:13:32download

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.

Overview

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:

  • Complex protocol interaction scenarios where direct communication with the mobile app or panel is required.
  • Scenarios that require coordination with custom panel logic.
  • Certain services that are specific to a line of business.

Applicable firmware: Currently, only BF6H Bluetooth LE generic firmware supports this service, and other firmware will be available soon.

Related protocols

Enable/disable data pass-through channel (0xC400)

  • This channel is disabled by default. When a product needs to use this channel, you can run the command to enable it. This channel supports transparent transmission of data reporting and sending. The module does not process specific data, but directly transmits the raw data to the app for processing.
  • An error will be returned if the data pass-through channel is used before it is enabled.

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
  • 0x00: Disable
  • 0x01: Enable
CRC8 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

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
  • 0x00: Success
  • 0x01: Failure
  • 0x02: Length error
  • 0x03: Feature disabled
CRC8 1 Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder.

Transmit data through the pass-through channel (0xC401)

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.

Example

Here are some examples of implementation through the data pass-through channel service.

Message notification

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 WeChat
0101 0x05 Facebook
0110 0x06 Messenger
0111 0x07 Twitter
1000 0x08 WhatsApp
1001 0x09 Instagram
1010 0x0A LinkedIn
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 Email
0011 0x33 Calendar
0100 0x34 KakaoTalk
0101 0x35 VKontakte
0110 0x36 Tumblr
0111 0x37 Snapchat
1000 0x38 Telegram
1001 0x39 YouTube
1010 0x3A Pinterest
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

Support and help

If you have any problems with TuyaOS development, you can post your questions in the Tuya Developer Forum.