CN114640980A - Bluetooth communication method and system - Google Patents

Bluetooth communication method and system Download PDF

Info

Publication number
CN114640980A
CN114640980A CN202210423010.0A CN202210423010A CN114640980A CN 114640980 A CN114640980 A CN 114640980A CN 202210423010 A CN202210423010 A CN 202210423010A CN 114640980 A CN114640980 A CN 114640980A
Authority
CN
China
Prior art keywords
terminal
terminal controller
bluetooth
key
connection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210423010.0A
Other languages
Chinese (zh)
Other versions
CN114640980B (en
Inventor
雷旭东
刘从锋
邹文婷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Changhong Electric Co Ltd
Original Assignee
Sichuan Changhong Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Changhong Electric Co Ltd filed Critical Sichuan Changhong Electric Co Ltd
Priority to CN202210423010.0A priority Critical patent/CN114640980B/en
Publication of CN114640980A publication Critical patent/CN114640980A/en
Application granted granted Critical
Publication of CN114640980B publication Critical patent/CN114640980B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/11Allocation or use of connection identifiers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/19Connection re-establishment
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/22Processing or transfer of terminal data, e.g. status or physical capabilities
    • H04W8/24Transfer of terminal data

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明涉及蓝牙通信领域,具体涉及一种蓝牙通信方法及系统,解决已配对的两个蓝牙设备在实现回连前后的通信问。技术方案包括:蓝牙连接断开后,终端控制器发出回连广播报文,终端接收到回连广播报文后,发出扫描请求,终端控制器收到扫描请求并进行白名单检测,若通过白名单检测,则回复扫描响应;若不进行白名单扫描,则直接回复扫描响应,终端收到扫描响应后,发出连接请求,若连接成功,则此次回连成功,回连成功后在数据通道进行按键键值传输;否则对收到的扫描响应进行解析,若按键编号与终端中对应的编号不一致,则将键值上传到终端系统以实现对应的按键操作。本发明适用于终端与对应终端控制器的蓝牙通信。

Figure 202210423010

The invention relates to the field of bluetooth communication, in particular to a bluetooth communication method and system, which solves the communication problem of two paired bluetooth devices before and after realizing back-connection. The technical solution includes: after the Bluetooth connection is disconnected, the terminal controller sends a connection back broadcast message, and after the terminal receives the connection back broadcast message, it sends out a scan request, and the terminal controller receives the scan request and performs whitelist detection. If the list is detected, it will reply to the scan response; if the whitelist scan is not performed, it will directly reply to the scan response. After the terminal receives the scan response, it sends a connection request. If the connection is successful, the connection is successful this time. Button key value transmission; otherwise, the received scan response is parsed. If the button number is inconsistent with the corresponding number in the terminal, the key value is uploaded to the terminal system to realize the corresponding button operation. The present invention is suitable for the Bluetooth communication between the terminal and the corresponding terminal controller.

Figure 202210423010

Description

蓝牙通信方法及系统Bluetooth communication method and system

技术领域technical field

本发明涉及蓝牙通信领域,具体涉及一种蓝牙通信方法及系统。The invention relates to the field of Bluetooth communication, in particular to a Bluetooth communication method and system.

背景技术Background technique

传统的蓝牙设备间通信基于配对、连接进行,在建立连接后,通过储存对端设备的Mac(Medium/Media Access Control)地址实现快速回连。但在实际应用中,有时会出现一方储存的对端连接信息丢失,或者由于环境干扰,导致两者的回连一直建立不起,此时就会极大地影响通信,导致数据丢失。The traditional communication between Bluetooth devices is based on pairing and connection. After the connection is established, the fast connection is realized by storing the Mac (Medium/Media Access Control) address of the opposite device. However, in practical applications, sometimes the connection information of the opposite end stored by one party is lost, or due to environmental interference, the back connection between the two cannot be established all the time, which will greatly affect the communication and lead to data loss.

发明内容SUMMARY OF THE INVENTION

本发明的目的是提供一种蓝牙通信方法及系统,解决已配对的两个蓝牙设备在实现回连过程中的通信问题,无论蓝牙是否回连成功,均可实现信息交互,提高了通信的稳定性。The purpose of the present invention is to provide a bluetooth communication method and system to solve the communication problem in the process of realizing back-connection between two paired bluetooth devices. Regardless of whether the bluetooth back-connection is successful or not, information exchange can be realized and the stability of communication is improved. sex.

本发明采取如下技术方案实现上述目的,蓝牙通信方法,应用于终端与对应终端控制器的通信,所述方法包括:The present invention adopts the following technical solutions to achieve the above objects. A Bluetooth communication method is applied to the communication between a terminal and a corresponding terminal controller, and the method includes:

步骤1、终端与对应的终端控制器完成蓝牙配对,并分别保存对方的Mac地址以及密钥信息;Step 1. The terminal and the corresponding terminal controller complete the Bluetooth pairing, and respectively save the other party's Mac address and key information;

步骤2、蓝牙连接断开后,所述终端控制器发出回连广播报文;Step 2. After the Bluetooth connection is disconnected, the terminal controller sends a back-connection broadcast message;

步骤3、终端接收到回连广播报文后,判断是否符合终端的自定义规则,若符合则发出扫描请求,所述扫描请求中携带双方的蓝牙Mac地址;Step 3. After the terminal receives the link-back broadcast message, it judges whether it conforms to the custom rules of the terminal, and if so, sends a scan request, and the scan request carries the Bluetooth Mac addresses of both parties;

步骤4、对终端控制器存储的配对信息进行判断,若终端控制器存储的配对信息未丢失,则将已完成配对的蓝牙Mac地址作为白名单,并进入步骤5;否则,不设置白名单,并进入步骤6;Step 4. Judge the pairing information stored in the terminal controller. If the pairing information stored in the terminal controller is not lost, use the Bluetooth Mac address that has been paired as a whitelist, and proceed to step 5; otherwise, do not set a whitelist. and go to step 6;

步骤5、终端控制器收到扫描请求并进行白名单检测,若通过白名单检测,则回复扫描响应,并进入步骤7,所述回复扫描响应中包括终端控制器按键的键值、密钥、Mac地址以及按键的编号信息;Step 5. The terminal controller receives the scan request and performs whitelist detection. If it passes the whitelist detection, it will reply to the scan response, and enter step 7. The reply scan response includes the key value, key, and key of the terminal controller button. Mac address and key number information;

步骤6、终端控制器收到扫描请求后直接回复扫描响应,并进入步骤7;Step 6. After receiving the scan request, the terminal controller directly replies to the scan response, and proceeds to step 7;

步骤7、终端收到扫描响应后,若能按照正常流程发出连接请求,并连接成功,则此次回连成功,回连成功后在数据通道进行按键键值传输,结束流程;否则进入步骤8;Step 7. After the terminal receives the scan response, if it can send a connection request according to the normal process and the connection is successful, the connection is successful this time. After the connection is successful, the key value transmission is performed on the data channel to end the process; otherwise, go to step 8;

步骤8、终端对收到的扫描响应进行解析,判断扫描响应的Mac地址,若扫描响应的Mac地址为已保存的配对终端控制器的蓝牙Mac地址,则进入步骤9;Step 8. The terminal parses the received scan response, and determines the Mac address of the scan response. If the Mac address of the scan response is the saved Bluetooth Mac address of the paired terminal controller, enter step 9;

步骤9、解析扫描响应中携带的按键编号及按键键值,若按键编号与终端中对应的编号不一致,则将键值上传到终端系统以实现对应的按键操作,结束流程。Step 9: Parse the key number and key value carried in the scan response. If the key number is inconsistent with the corresponding number in the terminal, upload the key value to the terminal system to realize the corresponding key operation, and end the process.

进一步的是,步骤2中,所述回连广播报文包括所述回连广播报文包括自定义规则的终端控制器信号以及私有协议信息。Further, in step 2, the link-back broadcast packet includes the terminal controller signal of the custom rule and the private protocol information in the link-back broadcast packet.

进一步的是,所述方法还包括:步骤7中,在回连成功前,若有新的按键信息从终端控制器通过广播发送到终端,则进入步骤3。Further, the method further includes: in step 7, before the connection back is successful, if there is new key information sent from the terminal controller to the terminal by broadcasting, then go to step 3.

蓝牙通信系统,用于实现上述蓝牙通信方法,包括终端以及与终端对应的终端控制器,终端与对应的终端控制器完成蓝牙配对,终端与对应的终端控制器分别保存对方的Mac地址以及按键信息;蓝牙连接断开后,所述终端控制器发出回连广播报文;终端接收到回连广播报文后,判断是否符合终端的自定义规则,若符合则发出扫描请求,所述扫描请求中携带双方的蓝牙Mac地址;对终端控制器存储的配对信息进行判断,若终端控制器存储的配对信息未丢失,则将已完成配对的蓝牙Mac地址作为白名单,终端控制器收到扫描请求并进行白名单检测,若通过白名单检测,则回复扫描响应,所述回复扫描响应中包括终端控制器按键的键值、Mac地址以及按键的编号信息;否则不设置白名单,终端控制器收到扫描请求后直接回复扫描响应;终端收到扫描响应后,若能按照正常流程发出连接请求,并连接成功,则此次回连成功,回连成功后在数据通道进行按键键值传输;否则对收到的扫描响应进行解析,判断扫描响应的Mac地址,若扫描响应的Mac地址为已保存的配对终端控制器的蓝牙Mac地址,则解析扫描响应中携带的按键编号及按键键值,若按键编号与终端中对应的编号不一致,则将键值上传到终端系统以实现对应的按键操作。A Bluetooth communication system for implementing the above Bluetooth communication method, including a terminal and a terminal controller corresponding to the terminal, the terminal and the corresponding terminal controller complete Bluetooth pairing, and the terminal and the corresponding terminal controller respectively save each other's Mac address and key information ; After the bluetooth connection is disconnected, the terminal controller sends a connection back broadcast message; after the terminal receives the connection back broadcast message, it judges whether it conforms to the custom rules of the terminal, and if it conforms, sends a scan request, and the scan request contains Carry the Bluetooth Mac addresses of both parties; judge the pairing information stored in the terminal controller. If the pairing information stored in the terminal controller is not lost, the paired Bluetooth Mac address will be used as a whitelist, and the terminal controller will receive the scan request and Perform whitelist detection, and if it passes the whitelist detection, reply a scan response, and the reply scan response includes the key value of the terminal controller button, the Mac address, and the number information of the button; otherwise, no whitelist is set, and the terminal controller receives After the scan request, reply the scan response directly; after the terminal receives the scan response, if it can send a connection request according to the normal process and the connection is successful, the connection is successful this time, and the key value transmission is performed on the data channel after the connection is successful; The received scan response is analyzed, and the Mac address of the scan response is determined. If the Mac address of the scan response is the saved Bluetooth Mac address of the paired terminal controller, the key number and key value carried in the scan response are parsed. If the key number is If it is inconsistent with the corresponding number in the terminal, upload the key value to the terminal system to realize the corresponding key operation.

本发明在蓝牙回连成功后,在数据通道进行按键键值传输,将终端控制器的按键键值信息传送给终端,实现对终端的控制;在回连异常的过程中,终端先对收到的扫描响应进行解析,判断扫描响应的Mac地址,若扫描响应的Mac地址为已保存的配对终端控制器的蓝牙Mac地址,则解析扫描响应中携带的按键编号及按键键值,若按键编号与终端中对应的编号不一致,则将键值上传到终端系统以实现对应的按键操作,完成终端控制器按键信息的传输,实现对终端的控制;由此实现了无论蓝牙是否回连成功,均可实现终端与对应终端控制器的信息交互,提高了通信的稳定性。In the present invention, after the Bluetooth connection is successful, the key value transmission is performed on the data channel, and the key value information of the terminal controller is transmitted to the terminal, so as to realize the control of the terminal; The scan response is parsed, and the Mac address of the scan response is determined. If the Mac address of the scan response is the saved Bluetooth Mac address of the paired terminal controller, the key number and key value carried in the scan response are parsed. If the corresponding numbers in the terminal are inconsistent, upload the key value to the terminal system to realize the corresponding key operation, complete the transmission of the key information of the terminal controller, and realize the control of the terminal; thus, whether the Bluetooth connection is successful or not, it can be The information exchange between the terminal and the corresponding terminal controller is realized, and the stability of the communication is improved.

附图说明Description of drawings

图1是本发明实施例提供的一种蓝牙通信流程图。FIG. 1 is a flow chart of Bluetooth communication according to an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。To make the purposes, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

本发明蓝牙通信方法,应用于终端与对应终端控制器的通信,所述方法包括:The Bluetooth communication method of the present invention is applied to the communication between a terminal and a corresponding terminal controller, and the method includes:

步骤1、终端与对应的终端控制器完成蓝牙配对,并分别保存对方的Mac地址以及密钥信息;Step 1. The terminal and the corresponding terminal controller complete the Bluetooth pairing, and respectively save the other party's Mac address and key information;

步骤2、蓝牙连接断开后,所述终端控制器发出回连广播报文;Step 2. After the Bluetooth connection is disconnected, the terminal controller sends a back-connection broadcast message;

步骤3、终端接收到回连广播报文后,判断是否符合终端的自定义规则,若符合则发出扫描请求,所述扫描请求中携带双方的蓝牙Mac地址;Step 3. After the terminal receives the link-back broadcast message, it judges whether it conforms to the custom rules of the terminal, and if so, sends a scan request, and the scan request carries the Bluetooth Mac addresses of both parties;

步骤4、对终端控制器存储的配对信息进行判断,若终端控制器存储的配对信息未丢失,则将已完成配对的蓝牙Mac地址作为白名单,并进入步骤5;否则,不设置白名单,并进入步骤6;Step 4. Judge the pairing information stored in the terminal controller. If the pairing information stored in the terminal controller is not lost, use the Bluetooth Mac address that has been paired as a whitelist, and proceed to step 5; otherwise, do not set a whitelist. and go to step 6;

步骤5、终端控制器收到扫描请求并进行白名单检测,若通过白名单检测,则回复扫描响应,并进入步骤7,所述回复扫描响应中包括终端控制器按键的键值、密钥、Mac地址以及按键的编号信息;Step 5. The terminal controller receives the scan request and performs whitelist detection. If it passes the whitelist detection, it will reply to the scan response, and enter step 7. The reply scan response includes the key value, key, and key of the terminal controller button. Mac address and key number information;

步骤6、终端控制器收到扫描请求后直接回复扫描响应,并进入步骤7;Step 6. After receiving the scan request, the terminal controller directly replies to the scan response, and proceeds to step 7;

步骤7、终端收到扫描响应后,若能按照正常流程发出连接请求,并连接成功,则此次回连成功,回连成功后在数据通道进行按键键值传输,结束流程;否则进入步骤8;Step 7. After the terminal receives the scan response, if it can send a connection request according to the normal process and the connection is successful, the connection is successful this time. After the connection is successful, the key value transmission is performed on the data channel to end the process; otherwise, go to step 8;

步骤8、终端对收到的扫描响应进行解析,判断扫描响应的Mac地址,若扫描响应的Mac地址为已保存的配对终端控制器的蓝牙Mac地址,则进入步骤9;Step 8. The terminal parses the received scan response, and determines the Mac address of the scan response. If the Mac address of the scan response is the saved Bluetooth Mac address of the paired terminal controller, then enter step 9;

步骤9、解析扫描响应中携带的按键编号及按键键值,若按键编号与终端中对应的编号不一致,则将键值上传到终端系统以实现对应的按键操作,结束流程。Step 9: Parse the key number and key value carried in the scan response. If the key number is inconsistent with the corresponding number in the terminal, upload the key value to the terminal system to realize the corresponding key operation, and end the process.

步骤2中,所述回连广播报文包括所述回连广播报文包括自定义规则的终端控制器信号以及私有协议信息。In step 2, the link-back broadcast packet includes the terminal controller signal of the custom rule and the private protocol information in the link-back broadcast packet.

步骤7中,在回连成功前,若有新的按键信息从终端控制器通过广播发送到终端,则进入步骤3。In step 7, before the connection back is successful, if there is new key information sent from the terminal controller to the terminal by broadcasting, then go to step 3.

蓝牙通信系统,包括终端以及与终端对应的终端控制器,终端与对应的终端控制器完成蓝牙配对,终端与对应的终端控制器分别保存对方的Mac地址以及按键信息;蓝牙连接断开后,所述终端控制器发出回连广播报文;终端接收到回连广播报文后,判断是否符合终端的自定义规则,若符合则发出扫描请求,所述扫描请求中携带双方的蓝牙Mac地址;对终端控制器存储的配对信息进行判断,若终端控制器存储的配对信息未丢失,则将已完成配对的蓝牙Mac地址作为白名单,终端控制器收到扫描请求并进行白名单检测,若通过白名单检测,则回复扫描响应,所述回复扫描响应中包括终端控制器按键的键值、Mac地址以及按键的编号信息;否则不设置白名单,终端控制器收到扫描请求后直接回复扫描响应;终端收到扫描响应后,若能按照正常流程发出连接请求,并连接成功,则此次回连成功,回连成功后在数据通道进行按键键值传输;否则对收到的扫描响应进行解析,判断扫描响应的Mac地址,若扫描响应的Mac地址为已保存的配对终端控制器的蓝牙Mac地址,则解析扫描响应中携带的按键编号及按键键值,若按键编号与终端中对应的编号不一致,则将键值上传到终端系统以实现对应的按键操作。The Bluetooth communication system includes a terminal and a terminal controller corresponding to the terminal. The terminal and the corresponding terminal controller complete Bluetooth pairing, and the terminal and the corresponding terminal controller respectively save each other's Mac address and key information; after the Bluetooth connection is disconnected, all The terminal controller sends a back-connection broadcast message; after receiving the back-connection broadcast message, the terminal judges whether it conforms to the custom rules of the terminal, and if so, sends a scan request, and the scan request carries the Bluetooth Mac addresses of both parties; The terminal controller judges the pairing information stored in the terminal controller. If the pairing information stored in the terminal controller is not lost, the paired Bluetooth Mac address will be used as the whitelist. The terminal controller receives the scan request and performs whitelist detection. List detection, then reply to the scan response, and the reply scan response includes the key value of the terminal controller button, the Mac address and the number information of the button; otherwise, no whitelist is set, and the terminal controller directly responds to the scan response after receiving the scan request; After the terminal receives the scan response, if it can send a connection request according to the normal process and the connection is successful, the connection back is successful, and the key value transmission is performed on the data channel after the back connection is successful; otherwise, the received scan response is parsed and judged. Scan the Mac address of the response. If the Mac address of the scan response is the saved Bluetooth Mac address of the paired terminal controller, parse the key number and key value carried in the scan response. If the key number is inconsistent with the corresponding number in the terminal, Then upload the key value to the terminal system to realize the corresponding key operation.

本实施例以电视和遥控器之间的蓝牙通信为例。This embodiment takes the Bluetooth communication between the TV and the remote control as an example.

电视和遥控器之间蓝牙通信方法,如图1所示,具体包括以下步骤:The Bluetooth communication method between the TV and the remote control, as shown in Figure 1, specifically includes the following steps:

第一步,电视与遥控器完成配对,并分别保存对方的Mac地址和key(密钥)信息;The first step is to complete the pairing of the TV and the remote control, and save the other party's Mac address and key (key) information respectively;

第二步,在蓝牙连接断开后,蓝牙遥控器做回连动作(例如用户按键回连或自动回连),尝试与电视恢复连接,回连动作具体包括遥控器在广播信道发出回连广播报文ADV_IND,该报文包含符合自定义规则的遥控器型号、私有协议信息等;In the second step, after the Bluetooth connection is disconnected, the Bluetooth remote control performs a reconnection action (for example, the user presses a button to reconnect or automatically reconnects), and tries to restore the connection with the TV. The reconnection action includes the remote control sending a reconnection broadcast on the broadcast channel. Packet ADV_IND, which contains the remote controller model and private protocol information that conform to the custom rules;

第三步,电视接收到回连广播报文ADV_IND后,判断是符合自定义规则,若符合则发出扫描请求SCAN_REQ,在SCAN_REQ中携带双方的蓝牙MAC地址;In the third step, after the TV receives the link-back broadcast message ADV_IND, it judges that it conforms to the custom rules, and if so, sends a scan request SCAN_REQ, which carries the Bluetooth MAC addresses of both parties in SCAN_REQ;

第四步,在遥控器的配对信息未丢失的情况下,将已配对电视的蓝牙MAC地址作为白名单过滤条件。遥控器收到的SCAN_REQ后,若通过白名单检测,则回复扫描响应SCAN_RSP。在遥控器配对信息丢失的情况下,则不再进行白名单检测,直接回复扫描响应SCAN_RSP;The fourth step, in the case that the pairing information of the remote control is not lost, use the Bluetooth MAC address of the paired TV as the whitelist filter condition. After the remote control receives the SCAN_REQ, if it passes the whitelist detection, it will reply the scan response SCAN_RSP. In the case that the pairing information of the remote control is lost, the whitelist detection is no longer performed, and the scan response SCAN_RSP is directly replied;

其中,在遥控器回复的扫描响应SCAN_RSP中,携带有特定信息,包括:用户按键的键值、key信息、遥控器MAC地址以及对当次按键的编号(遥控器上电后,在蓝牙断开状态下,对每次按键从1~255按每次加1进行循环编号,以让电视端区分每次的按键动作);Among them, the scan response SCAN_RSP returned by the remote control carries specific information, including: the key value of the user key, key information, the remote control MAC address, and the number of the current key (after the remote control is powered on, when the Bluetooth is disconnected In the state, the number of each key is cyclically numbered from 1 to 255 by adding 1 each time, so that the TV terminal can distinguish each key action);

第五步,电视收到SCAN_RSP后,若能按正常流程发起连接,下发CONNET_REQ,且能成功走完整个连接过程,则此次回连成功;后续在数据通道进行按键键值传输。若因为电视保存的按键数据丢失、损坏,或环境干扰等原因不能正常完成回连,则进入第六步;Step 5: After the TV receives the SCAN_RSP, if it can initiate a connection according to the normal process, send the CONNET_REQ, and can successfully go through the entire connection process, the connection is successful; then the key value transmission is performed on the data channel. If the key data saved by the TV is lost, damaged, or due to environmental interference, the connection cannot be completed normally, then go to step 6;

第六步,电视对收到的SCAN_RSP进行解析,若判定扫描响应中的Mac地址是已保存的配对遥控器的蓝牙MAC地址,则进一步解析SCAN_RSP中携带的按键编号及按键键值。若按键序号跟当前值不同(电视开机后,按键序号当前值设为0,后续则同步收到的遥控器SCAN_RSP中携带的按键序号),则将键值上传到终端系统以实现对应的按键操作,完成按键信息的一次完整传输过程;In the sixth step, the TV parses the received SCAN_RSP. If it is determined that the Mac address in the scan response is the saved Bluetooth MAC address of the paired remote control, it further parses the key number and key value carried in the SCAN_RSP. If the key sequence number is different from the current value (after the TV is turned on, the current value of the key sequence number is set to 0, and then the key sequence number carried in the received remote control SCAN_RSP will be synchronously received), then upload the key value to the terminal system to realize the corresponding key operation , to complete a complete transmission process of key information;

上述过程中,在回连成功前,若有新的按键信息从遥控器通过广播信道发到电视端,进入第三步。In the above process, before the connection back is successful, if there is new key information sent from the remote control to the TV terminal through the broadcast channel, go to the third step.

综上所述,本发明实现了无论蓝牙是否回连成功,均可实现终端与对应终端控制器的信息交互,提高了通信的稳定性。To sum up, the present invention realizes that the information exchange between the terminal and the corresponding terminal controller can be realized regardless of whether the Bluetooth connection is successful or not, and the stability of the communication is improved.

Claims (4)

1. The Bluetooth communication method is applied to the communication between a terminal and a corresponding terminal controller, and is characterized by comprising the following steps:
step 1, the terminal and a corresponding terminal controller finish Bluetooth pairing, and respectively store Mac addresses and key information of the opposite side;
step 2, after the Bluetooth connection is disconnected, the terminal controller sends a back connection broadcast message;
step 3, after receiving the back connection broadcast message, the terminal judges whether the back connection broadcast message accords with the self-defined rule of the terminal, if so, a scanning request is sent out, and the scanning request carries the Bluetooth Mac addresses of the two parties;
step 4, the pairing information stored in the terminal controller is judged, if the pairing information stored in the terminal controller is not lost, the Bluetooth Mac address matched with the terminal controller is used as a white list, and the step 5 is carried out; otherwise, not setting a white list, and entering the step 6;
step 5, the terminal controller receives the scanning request and carries out white list detection, if the white list detection is passed, scanning response is replied, and the step 7 is carried out, wherein the replied scanning response comprises key values, keys, Mac addresses and number information of the keys of the terminal controller;
step 6, the terminal controller directly replies a scanning response after receiving the scanning request, and the step 7 is carried out;
step 7, after receiving the scanning response, if the terminal can send out a connection request according to a normal process and the connection is successful, the reconnection is successful, and after the reconnection is successful, the key value transmission of the key is carried out in a data channel, and the process is ended; otherwise, entering a step 8;
step 8, the terminal analyzes the received scanning response, judges the Mac address of the scanning response, and enters step 9 if the Mac address of the scanning response is the stored Bluetooth Mac address of the pairing terminal controller;
and 9, analyzing the key number and the key value carried in the scanning response, if the key number is inconsistent with the corresponding number in the terminal, uploading the key value to a terminal system to realize corresponding key operation, and ending the process.
2. The bluetooth communication method according to claim 1, wherein in step 2, the loopback broadcast message comprises a terminal controller signal of a custom rule and private protocol information.
3. The bluetooth communication method according to claim 1, characterized in that the method further comprises: in step 7, before the completion of the reconnection, if new key information is transmitted from the terminal controller to the terminal by broadcasting, the process proceeds to step 3.
4. The Bluetooth communication system is used for realizing the Bluetooth communication method according to any one of claims 1 to 3, and is characterized by comprising a terminal and a terminal controller corresponding to the terminal, wherein the terminal and the corresponding terminal controller finish Bluetooth pairing, and the terminal and the corresponding terminal controller respectively store Mac addresses and key information of opposite sides; after the Bluetooth connection is disconnected, the terminal controller sends a back connection broadcast message; after receiving the back connection broadcast message, the terminal judges whether the back connection broadcast message accords with the self-defined rule of the terminal, if so, a scanning request is sent out, and the scanning request carries Bluetooth Mac addresses of both parties; then, pairing information stored by a terminal controller is judged, if the pairing information stored by the terminal controller is not lost, the Bluetooth Mac address which is paired is used as a white list, the terminal controller receives a scanning request and detects the white list, if the white list is detected, a scanning response is replied, and the replied scanning response comprises key values of keys of the terminal controller, the Mac address and the number information of the keys; otherwise, the white list is not set, and the terminal controller directly replies a scanning response after receiving the scanning request; after receiving the scanning response, if the terminal can send out a connection request according to a normal flow and the connection is successful, the reconnection is successful, and key value transmission of the keys is carried out in a data channel after the reconnection is successful; otherwise, analyzing the received scanning response, judging the Mac address of the scanning response, if the Mac address of the scanning response is the stored Bluetooth Mac address of the paired terminal controller, analyzing the key number and the key value carried in the scanning response, and if the key number is not consistent with the corresponding number in the terminal, uploading the key value to the terminal system to realize the corresponding key operation.
CN202210423010.0A 2022-04-21 2022-04-21 Bluetooth communication method and system Active CN114640980B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210423010.0A CN114640980B (en) 2022-04-21 2022-04-21 Bluetooth communication method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210423010.0A CN114640980B (en) 2022-04-21 2022-04-21 Bluetooth communication method and system

Publications (2)

Publication Number Publication Date
CN114640980A true CN114640980A (en) 2022-06-17
CN114640980B CN114640980B (en) 2024-12-17

Family

ID=81951627

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210423010.0A Active CN114640980B (en) 2022-04-21 2022-04-21 Bluetooth communication method and system

Country Status (1)

Country Link
CN (1) CN114640980B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115484340A (en) * 2022-09-13 2022-12-16 宁波奥克斯电气股份有限公司 A Bluetooth-based operation matching method for multiple intelligent air conditioners, and intelligent air conditioners

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105163371A (en) * 2015-08-26 2015-12-16 四川长虹电器股份有限公司 WIFI setting system and method based on Bluetooth
CN105303651A (en) * 2014-07-30 2016-02-03 许加庆 Bluetooth based two-way communication automatic locking system and method
CN106412656A (en) * 2016-10-26 2017-02-15 四川长虹电器股份有限公司 Method enabling Android smart device to quickly connect with Bluetooth
CN109451474A (en) * 2018-10-15 2019-03-08 四川长虹电器股份有限公司 Controlled terminal equipment and its bluetooth return even method
CN111602344A (en) * 2018-08-01 2020-08-28 华为技术有限公司 Bluetooth communication method and dual-mode Bluetooth terminal
CN112203132A (en) * 2020-11-13 2021-01-08 四川长虹电器股份有限公司 Method for quickly connecting Bluetooth remote controller during startup of android smart television
CN113490218A (en) * 2021-06-08 2021-10-08 深圳Tcl新技术有限公司 Pairing method, pairing device, Bluetooth remote controller, intelligent device and storage medium
CN113543104A (en) * 2021-07-13 2021-10-22 深圳创维-Rgb电子有限公司 Bluetooth communication method, multimedia device and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105303651A (en) * 2014-07-30 2016-02-03 许加庆 Bluetooth based two-way communication automatic locking system and method
CN105163371A (en) * 2015-08-26 2015-12-16 四川长虹电器股份有限公司 WIFI setting system and method based on Bluetooth
CN106412656A (en) * 2016-10-26 2017-02-15 四川长虹电器股份有限公司 Method enabling Android smart device to quickly connect with Bluetooth
CN111602344A (en) * 2018-08-01 2020-08-28 华为技术有限公司 Bluetooth communication method and dual-mode Bluetooth terminal
CN109451474A (en) * 2018-10-15 2019-03-08 四川长虹电器股份有限公司 Controlled terminal equipment and its bluetooth return even method
CN112203132A (en) * 2020-11-13 2021-01-08 四川长虹电器股份有限公司 Method for quickly connecting Bluetooth remote controller during startup of android smart television
CN113490218A (en) * 2021-06-08 2021-10-08 深圳Tcl新技术有限公司 Pairing method, pairing device, Bluetooth remote controller, intelligent device and storage medium
CN113543104A (en) * 2021-07-13 2021-10-22 深圳创维-Rgb电子有限公司 Bluetooth communication method, multimedia device and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115484340A (en) * 2022-09-13 2022-12-16 宁波奥克斯电气股份有限公司 A Bluetooth-based operation matching method for multiple intelligent air conditioners, and intelligent air conditioners
CN115484340B (en) * 2022-09-13 2024-03-08 宁波奥克斯电气股份有限公司 Operation matching method for multiple intelligent air conditioners based on Bluetooth and intelligent air conditioner

Also Published As

Publication number Publication date
CN114640980B (en) 2024-12-17

Similar Documents

Publication Publication Date Title
WO2020077658A1 (en) Extended connection method and extended connection system for bluetooth devices
US8984590B2 (en) Enabling access to key lifetimes for wireless link setup
CN102882938A (en) A data sharing method and mobile terminal
JP2021513805A (en) High-speed audio data transmission method and equipment
CN111447603A (en) Data transmission method and device
WO2021047564A1 (en) Data sending and receiving method and device and storage medium
CN106851198B (en) Network camera operation method and network camera
CN112437371B (en) BLE link switching method, equipment, earphone pair, chip and medium
CN114640980A (en) Bluetooth communication method and system
US9788356B2 (en) Terminal device, and frame sending and receiving methods
CN110891260A (en) Bluetooth connection method, equipment, terminal, system and storage medium
CN112616171B (en) Communication method and device based on wireless local area network and computer readable storage medium
CN115119190A (en) Bluetooth connection method, device, computer equipment and readable storage medium
CN108076481B (en) Method for terminal to access cluster group calling later
CN116095882A (en) Non-inductive pairing method, device and equipment
CN110034858B (en) Data packet retransmission method, device, mobile terminal and storage medium
CN103475650B (en) Data processing method and device based on wireless communication protocol
CN115515254A (en) Point-to-point connection establishment method, device, storage medium and electronic equipment
CN113746217A (en) Wireless equipment matching communication method and system based on trend judgment and electronic equipment
CN106850925A (en) The synchronous method of a kind of mobile unit and cellphone directory based on WiFi
CN106255104A (en) A kind of smart machine Auto-reconnect method and apparatus
CN111278011B (en) Network distribution method of intelligent sound box and intelligent sound box
CN111343261A (en) Mobile phone data backup method based on wireless hotspot transmission
WO2023246056A1 (en) Device connection method and apparatus, and storage medium and chip
EP4055891B1 (en) Wireless network access point and method for operation thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant