WO2022127171A1 - 蓝牙连接方法、系统、智能终端及计算机存储介质 - Google Patents

蓝牙连接方法、系统、智能终端及计算机存储介质 Download PDF

Info

Publication number
WO2022127171A1
WO2022127171A1 PCT/CN2021/113861 CN2021113861W WO2022127171A1 WO 2022127171 A1 WO2022127171 A1 WO 2022127171A1 CN 2021113861 W CN2021113861 W CN 2021113861W WO 2022127171 A1 WO2022127171 A1 WO 2022127171A1
Authority
WO
WIPO (PCT)
Prior art keywords
bluetooth device
bluetooth
service
connection
audio
Prior art date
Application number
PCT/CN2021/113861
Other languages
English (en)
French (fr)
Inventor
曾庆忠
朱枫
Original Assignee
深圳Tcl新技术有限公司
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 深圳Tcl新技术有限公司 filed Critical 深圳Tcl新技术有限公司
Priority to US18/257,299 priority Critical patent/US20240048990A1/en
Priority to GB2310146.2A priority patent/GB2617297A/en
Publication of WO2022127171A1 publication Critical patent/WO2022127171A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/50Secure pairing of devices
    • 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
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/03Protecting confidentiality, e.g. by encryption
    • H04W12/037Protecting confidentiality, e.g. by encryption of the control plane, e.g. signalling traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W12/00Security arrangements; Authentication; Protecting privacy or anonymity
    • H04W12/04Key management, e.g. using generic bootstrapping architecture [GBA]
    • H04W12/041Key generation or derivation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W8/00Network data management
    • H04W8/005Discovery of network devices, e.g. terminals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/18Self-organising networks, e.g. ad-hoc networks or sensor networks

Definitions

  • the present application relates to the technical field of Bluetooth connection, and in particular, to a Bluetooth connection method, system, intelligent terminal and computer storage medium.
  • Bluetooth is a radio technology that supports short-range communication between devices, which can effectively simplify data communication and voice communication between mobile devices.
  • people's demand for wireless devices is increasing, and devices such as smart Bluetooth speakers and Bluetooth headsets are emerging in an endless stream.
  • devices such as smart Bluetooth speakers and Bluetooth headsets are emerging in an endless stream.
  • a smart terminal when using a BR (Basic Rate) device (ie, a Bluetooth device) such as a Bluetooth speaker, a smart terminal (such as a smart TV or a smart phone) initiates a Bluetooth scan to scan for Bluetooth speakers that are broadcasting discoverable and connectable.
  • a smart device scans the Bluetooth speaker, it initiates a pairing and binding connection to establish a wireless link connection between the smart terminal and the Bluetooth speaker.
  • the smart terminal and the Bluetooth speaker distribute the key negotiated during the binding process, and then the smart terminal passes the SDP (Service Discovery Protocol, Service Discovery Protocol, SDP provides a method for discovering services and these available service attributes) service discovery requests to obtain the service attributes supported by the Bluetooth speaker.
  • SDP Service Discovery Protocol, Service Discovery Protocol, SDP provides a method for discovering services and these available service attributes
  • the smart terminal When the connected Bluetooth device supports multiple protocols at the same time, and the smart terminal initiates the connection, it will inevitably lead to slow connection speed and connection conflict, which will eventually lead to the problem of connection failure. In addition, when some Bluetooth speakers initiate a service request again, the smart terminal will The request will not be responded or the content of the response reply is empty, which will cause the Bluetooth device to never receive a response or to respond abnormally, which will eventually lead to a timeout and disconnection.
  • the main purpose of the present application is to provide a Bluetooth connection method, system, intelligent terminal and computer storage medium, which aims to solve the problem that the connection failure or disconnection of the intelligent terminal and the Bluetooth device is prone to occur in the prior art.
  • the present application provides a Bluetooth connection method, which includes the following steps:
  • the bluetooth connection method wherein the establishing and binding with the bluetooth device to obtain the services supported by the bluetooth device specifically includes:
  • the acquiring the device subtype of the Bluetooth device, and selecting the service that needs to be connected from the services supported by the Bluetooth device according to the device subtype specifically includes: :
  • the device subtype is a Bluetooth speaker, actively send a service request to the Bluetooth speaker, and receive a service request response sent by the Bluetooth speaker;
  • the bluetooth connection method wherein the sending an audio input service request to the bluetooth device and receiving a response, receiving the audio output service request sent by the bluetooth device, generating a response data packet and sending it to the bluetooth device equipment, including:
  • the audio output record is acquired and the corresponding identity value is added, and a response data packet is generated and sent to the Bluetooth device.
  • the step of judging whether the audio receiving end service connection is enabled further includes:
  • the content of the response reply sent to the Bluetooth device is empty.
  • the step of acquiring the device subtype of the Bluetooth device further includes:
  • the device subtype is not a Bluetooth speaker, obtain other service requests.
  • the binding mode includes at least one of: numerical comparison, only working mode, out-of-band and password login.
  • the present application also provides an intelligent terminal, wherein the intelligent terminal includes: a memory, a processor, and a Bluetooth connection program stored in the memory and running on the processor, so When the Bluetooth connection program is executed by the processor, the steps of the above-mentioned Bluetooth connection method are realized.
  • the present application also provides a Bluetooth connection system, wherein the system includes a Bluetooth device and the above-mentioned smart terminal, and the smart terminal and the Bluetooth device establish a connection and binding;
  • the intelligent terminal is used to obtain the service supported by the Bluetooth device
  • the intelligent terminal is further configured to acquire the device subtype of the Bluetooth device, and select the service that needs to be connected among the services supported by the Bluetooth device according to the device subtype;
  • the intelligent terminal is further configured to send an audio input service request to the Bluetooth device and receive a response;
  • the Bluetooth device is configured to send an audio output service request to the intelligent terminal, and the intelligent terminal generates a response data packet and sends it to the Bluetooth device;
  • the intelligent terminal is further configured to send an encryption instruction to the Bluetooth device, start the audio receiving end service connected to the Bluetooth device after the encryption is completed, and start the audio transmission after the connection is successful.
  • the present application also provides a computer storage medium, wherein the computer storage medium stores a Bluetooth connection program, and when the Bluetooth connection program is executed by the processor, the steps of the above-mentioned Bluetooth connection method are implemented .
  • the present application establishes connection and binding with a Bluetooth device through a smart terminal, and obtains the services supported by the Bluetooth device; obtains the device subtype of the Bluetooth device, and selects the required services from the services supported by the Bluetooth device according to the device subtype.
  • connection service send audio input service request to the bluetooth device and receive a response, receive the audio output service request sent by the bluetooth device, generate a response data packet and send it to the bluetooth device; send an encryption instruction to the bluetooth device , after the encryption is completed, start the audio receiver service connected to the Bluetooth device, and start the audio transmission after the connection is successful.
  • the application actively obtains and selects the service of the Bluetooth device, and responds to the service request of the Bluetooth device in time, which can not only improve the binding connection speed with the Bluetooth device, but also improve the speed of the Bluetooth device. compatibility and versatility.
  • step S10 is a flowchart of step S10 in a preferred embodiment of the Bluetooth connection method of the present application
  • step S20 is a flowchart of step S20 in a preferred embodiment of the Bluetooth connection method of the present application
  • FIG. 4 is a schematic diagram of a smart terminal actively sending a service request to a Bluetooth device and selecting a service to be connected in a preferred embodiment of the Bluetooth connection method of the present application;
  • step S30 is a flowchart of step S30 in a preferred embodiment of the Bluetooth connection method of the present application.
  • FIG. 6 is a schematic diagram of a Bluetooth device actively initiating a service discovery request to an intelligent terminal in a preferred embodiment of the Bluetooth connection method of the present application;
  • FIG. 8 is a schematic diagram of an operating environment of a preferred embodiment of an intelligent terminal of the present application.
  • the Bluetooth connection method described in the preferred embodiment of the present application includes the following steps:
  • Step S10 establishing a connection and binding with a Bluetooth device, and acquiring the services supported by the Bluetooth device.
  • FIG. 2 is a flowchart of step S10 in the Bluetooth connection method provided by the present application.
  • the step S10 includes:
  • the execution subject of this application is a smart terminal (such as a smart TV, a smart phone, and other devices that can play audio and video), that is, this application is the process of establishing a connection between the smart terminal and the Bluetooth device for audio transmission, so
  • the smart terminal (such as a smart TV) first establishes a link connection with the Bluetooth device, for example, the smart terminal (such as the host host of the smart terminal) initiates HCI_Create_Connection (link connection) to the Bluetooth device through the protocol stack, so After the link between the smart terminal and the Bluetooth device is successfully connected, the smart terminal sends a request for acquiring the input and output capabilities of the Bluetooth device to the Bluetooth device, so that the smart terminal knows the input and output of the Bluetooth device.
  • HCI_Create_Connection link connection
  • the Bluetooth device After the Bluetooth device receives the request from the smart terminal to obtain the input and output capabilities of the Bluetooth device, the Bluetooth device feeds back the input and output capabilities to the smart terminal according to the request, and the smart terminal receives the After the input and output capabilities are fed back by the Bluetooth device, the binding mode with the Bluetooth device is selected according to the input and output capabilities.
  • the binding mode includes at least one of the following modes: Numeric Comparison (Numeric Comparison, which is applicable to low-power secure connections, but not applicable to traditional pairing), Just Works (Just Works, that is, this binding
  • the fixed mode does not require confirmation by the Bluetooth device, which also means that the Bluetooth device has no input and output capabilities at this time), Out of Band (Out of Band, which means that one of the two parties in the connection has an important event and wants to notify the other party quickly.
  • it is hoped that a certain type of information will not be transmitted to the user through conventional transmission methods for timely processing, such as the UNIX system's interrupt key, terminal flow control character, called out-of-band data) and password login (Passkey Entry, which is authenticated by password). login).
  • the smart terminal determines the binding method with the Bluetooth device (one of the above four binding methods, for example, if the Bluetooth device is a Bluetooth speaker without input and output capability, the binding method selects Just Works). , that is, no confirmation from the Bluetooth speaker is required), the smart device generates a key (a key is a parameter that is input in the algorithm for converting plaintext to ciphertext or converting ciphertext to plaintext) and sends it to all After that, the smart terminal sends an SDP (Service Discovery Protocol, Service Discovery Protocol) service discovery request to the Bluetooth device to obtain the services supported by the Bluetooth device, because the smart terminal knows the After checking the services supported by the Bluetooth device, you can select the service that needs to be connected.
  • SDP Service Discovery Protocol, Service Discovery Protocol
  • Step S20 Acquire a device subtype of the Bluetooth device, and select a service that needs to be connected among services supported by the Bluetooth device according to the device subtype.
  • FIG. 3 is a flowchart of step S20 in the Bluetooth connection method provided by the present application.
  • the step S20 includes:
  • the device subtype is a Bluetooth speaker, actively send a service request to the Bluetooth speaker, and receive a service request response sent by the Bluetooth speaker;
  • the intelligent terminal obtains the device subtype (Device Class) of the Bluetooth device, and the Bluetooth device is classified into major categories by the major device class, and by the minor device class
  • the device class is divided into sub-categories, for example, the speaker major is audio, and the minor is speaker; the intelligent terminal determines whether the device subtype is a Bluetooth speaker (0x0400, that is, if the byte is 0x0400 when judging, it means that the Bluetooth device is a Bluetooth speaker.
  • the device subtype is a Bluetooth speaker (0x0400)
  • it will actively send a service request (SDP_ServiceSearchAttributeRequest) to the Bluetooth speaker
  • the Bluetooth speaker will respond after receiving the service request
  • the smart terminal will receive all The service request response (SDP_ServiceSearchAttributeResponse) sent by the Bluetooth speaker
  • the intelligent terminal parses the service request response (that is, parses the field Service in the SDP Packet The value of Record Attributes) and stored in a singly linked list
  • the smart terminal traverses the UUID value (UniversalUniqueIdentifier, identity identifier) in the singly linked list, the purpose is to make all elements in the distributed system have unique identification information, and There is no need to specify the identification information through the central control terminal), so that the service that needs to be connected preferentially can be selected from the services supported by the Bluetooth device according to the identification value (different identification values correspond to different services).
  • UUID value UniversalUniqueIdentifier, identity identifier
  • the Bluetooth speaker Audio first Sink audio input terminal
  • this strategy can solve the problem of conflict connection failure of speakers that support multi-service.
  • other service requests are obtained, such as obtaining power service of the Bluetooth device, obtaining motion data of the Bluetooth device, obtaining weather data of the Bluetooth device, and the like.
  • the singly linked list is a chained access data structure, which uses a set of storage units with arbitrary addresses to store the data elements in the linear list;
  • the data in the linked list is represented by nodes, and each node consists of: Element (image of data element) + pointer (indicating the storage location of subsequent elements), the element is the storage unit for storing data, and the pointer is the address data connecting each node.
  • the intelligent terminal actively sends a service request (ie, an SDP service discovery request) to the Bluetooth device to determine whether the device subtype of the Bluetooth device is a Bluetooth speaker, and if the device subtype If it is a bluetooth speaker, it will actively send a service request to the bluetooth speaker, and receive the service request response sent by the bluetooth speaker, parse the service request response, obtain the identity value and store it in a singly linked list, and traverse the singly linked list For the identity value in , select the service that needs to be connected among the services supported by the Bluetooth device; if the device subtype is not a Bluetooth speaker, obtain other service requests.
  • a service request ie, an SDP service discovery request
  • Step S30 Send an audio input service request to the Bluetooth device and receive a response, receive an audio output service request sent by the Bluetooth device, generate a response data packet and send it to the Bluetooth device.
  • FIG. 5 is a flowchart of step S30 in the Bluetooth connection method provided by the present application.
  • the step S30 includes:
  • the smart terminal sends an audio input (AudioSink) service request to the Bluetooth device
  • the Bluetooth device responds after receiving the audio input service request
  • the smart terminal receives the audio input service from the Bluetooth device.
  • the response of the request and parse the response of the Bluetooth device to the audio input service request; because different Bluetooth devices support different services, some Bluetooth devices will actively initiate an audio output (AudioSource) service request confirmation
  • the smart terminal After receiving the AudioSource service request, determine whether the audio sink (sink) service connection is open, if the audio sink service connection is open, the intelligent terminal fills the AudioSource (audio output) record and increases the corresponding UUID value (identity value), After assembling the response packet (ie, the response data packet), a reply is sent to the Bluetooth device. In addition, if the audio receiver service connection is not enabled, the content of the response reply sent to the Bluetooth device is empty.
  • the bluetooth device is a bluetooth speaker, that is, the bluetooth speaker is the source, and the smart terminal (TV) is the sink, then the TV needs to determine whether the sink is turned on before sending packets (data packets) to the bluetooth speaker.
  • the smart terminal sends an audio input service request (AudioSink) to the Bluetooth device.
  • some Bluetooth devices will actively initiate an audio output (Audio Source) service discovery request to the Bluetooth device.
  • Smart terminal when the smart terminal receives the audio output (Audio Source) service discovery request, it will fill in the response data field and respond to the Bluetooth device, but some Bluetooth speakers will not initiate audio output (Audio Source) service discovery request, then the information returned by the intelligent terminal is NULL (empty), that is, the content of the response reply sent by the intelligent terminal to the Bluetooth device is empty.
  • Step S40 sending an encryption instruction to the Bluetooth device, after the encryption is completed, start the audio receiving end service connected to the Bluetooth device, and start the audio transmission after the connection is successful.
  • the smart terminal starts encryption, sends an encryption instruction to the bluetooth device, and encrypts the bluetooth device after receiving the encryption instruction, for example , the smart terminal will send the encryption command HCI_Set_Connection_Encryption to the Bluetooth device, when both parties agree to encrypt, both parties will receive event: sHCI_Encryption_Change (on), complete the encryption, after the encryption is completed, the intelligent terminal is pneumatically connected to initiate an audio sink (sink) service to the Bluetooth device, and finally starts audio transmission after the connection is successful.
  • sHCI_Encryption_Change on
  • the entire process of the Bluetooth connection method between the smart terminal and the Bluetooth device in the present application is as follows:
  • the smart terminal (eg TV) establishes a binding connection with the Bluetooth device, and after a link connection (HCI_Create_Connection) is successfully established, the smart terminal acquires the input and output capabilities fed back by the Bluetooth device, and the smart terminal determines the connection with the Bluetooth device. After the binding mode of the Bluetooth device is determined, a key is generated and sent to the Bluetooth device.
  • the intelligent terminal sends an SDP service discovery request to the Bluetooth device to determine the device subtype of the Bluetooth device. If the device subtype If the type is not a Bluetooth speaker, other service requests are obtained, and other service connections are made according to the parsing response (the smart terminal determines the service connection).
  • the smart terminal actively sends the AudioSink service request to the Bluetooth speaker, and receive and parse the service request response sent by the Bluetooth speaker, start the timer (Timer) to wait, and determine whether the smart terminal has received the Audio Source service request sent by the Bluetooth device (this time, the Bluetooth speaker). , if not, the bluetooth device does not send the service request, if the smart terminal receives the Audio Source service request sent by the bluetooth device, the bluetooth device responds to the profile (protocol) information of the smart terminal, the smart terminal The terminal starts encryption and opens the audio sink (sink) service connection.
  • the smart terminal by improving and optimizing the connection process between the smart terminal and the bluetooth device, the smart terminal actively initiates the acquisition of the bluetooth device service, the smart terminal decides to select the service connection, and the smart terminal additionally receives the service request of the bluetooth device, and makes corresponding response processing, so as to maximize the Improving the compatibility and versatility of Bluetooth can not only improve the speed of binding connection with Bluetooth devices, but also solve compatibility problems, and at the same time bring a good product experience to users and improve the core competitiveness of products.
  • the present application also provides an intelligent terminal correspondingly, and the intelligent terminal includes a processor 10 , a memory 20 and a display 30 .
  • FIG. 8 only shows some components of the smart terminal, but it should be understood that it is not required to implement all the shown components, and more or less components may be implemented instead.
  • the memory 20 may be an internal storage unit of the smart terminal, such as a hard disk or a memory of the smart terminal.
  • the memory 20 may also be an external storage device of the smart terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure) digital Digital, SD) card, flash memory card (Flash Card), etc.
  • the memory 20 may also include both an internal storage unit of the smart terminal and an external storage device.
  • the memory 20 is used to store application software and various types of data installed in the smart terminal, such as program codes for installing the smart terminal.
  • the memory 20 can also be used to temporarily store data that has been output or is to be output.
  • a Bluetooth connection program 40 is stored in the memory 20, and the Bluetooth connection program 40 can be executed by the processor 10, thereby realizing the Bluetooth connection method in the present application.
  • the processor 10 may be a central processing unit (Central Processing Unit) in some embodiments.
  • Central Processing Unit CPU
  • microprocessor or other data processing chips, used for running program codes or processing data stored in the memory 20, for example, executing the Bluetooth connection method and the like.
  • the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Display) in some embodiments. Light-Emitting Diode, Organic Light Emitting Diode) Touch, etc.
  • the display 30 is used for displaying information on the smart terminal and for displaying a visual user interface.
  • the components 10-30 of the intelligent terminal communicate with each other through the system bus.
  • establishing a connection and binding with a Bluetooth device to obtain services supported by the Bluetooth device specifically includes:
  • the service that needs to be connected is selected from the services supported by the Bluetooth device according to the device subtype, specifically including:
  • the device subtype is a Bluetooth speaker, actively send a service request to the Bluetooth speaker, and receive a service request response sent by the Bluetooth speaker;
  • the sending an audio input service request to the Bluetooth device and receiving a response, receiving an audio output service request sent by the Bluetooth device, and generating a response data packet and sending it to the Bluetooth device specifically include:
  • the audio output record is acquired and the corresponding identity value is added, and a response data packet is generated and sent to the Bluetooth device.
  • the step of judging whether the audio receiving end service connection is enabled it further includes:
  • the content of the response reply sent to the Bluetooth device is empty.
  • the method further includes:
  • the device subtype is not a Bluetooth speaker, obtain other service requests.
  • the binding mode includes at least one of: numerical comparison, working mode only, out-of-band and password login.
  • the present application also provides a Bluetooth connection system, the system includes an intelligent terminal and a Bluetooth device; the intelligent terminal and the Bluetooth device establish a connection and binding; wherein, the The intelligent terminal is used to obtain the service supported by the Bluetooth device; the intelligent terminal is also used to obtain the device subtype of the Bluetooth device, and select the required service from the services supported by the Bluetooth device according to the device subtype connection service; the intelligent terminal is also used to send an audio input service request to the bluetooth device and receive a response; the bluetooth device is used to send an audio output service request to the intelligent terminal, and the intelligent terminal generates response data
  • the package is sent to the bluetooth device; the intelligent terminal is further configured to send an encryption instruction to the bluetooth device, after the encryption is completed, the audio receiving end service connected to the bluetooth device is started, and the audio transmission is started after the connection is successful.
  • the present application also provides a computer storage medium, wherein the computer storage medium stores a Bluetooth connection program, and when the Bluetooth connection program is executed by the processor, the steps of the above-mentioned Bluetooth connection method are implemented.
  • the present application provides a Bluetooth connection method, system, smart terminal and computer storage medium, the method includes: establishing a connection and binding with a Bluetooth device, obtaining services supported by the Bluetooth device; obtaining the Bluetooth device According to the device subtype, select the service that needs to be connected among the services supported by the Bluetooth device according to the device subtype; send an audio input service request to the Bluetooth device and receive a response, and receive the audio sent by the Bluetooth device.
  • a service request is output, a response data packet is generated and sent to the bluetooth device; an encryption instruction is sent to the bluetooth device, after the encryption is completed, the audio receiving end service connected to the bluetooth device is started, and the audio transmission is started after the connection is successful.
  • the application actively obtains and selects the service of the Bluetooth device, and responds to the service request of the Bluetooth device in time, which can not only improve the binding connection speed with the Bluetooth device, but also improve the speed of the Bluetooth device. compatibility and versatility.
  • the computer storage medium may be a memory, a magnetic disk, an optical disk, or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请公开了一种蓝牙连接方法、系统、智能终端及计算机存储介质,所述方法包括:与蓝牙设备建立连接和绑定,获取蓝牙设备所支持的服务;获取蓝牙设备的设备子类型,根据设备子类型在服务中选择需要连接的服务;发送音频输入服务请求到蓝牙设备并接收响应,接收蓝牙设备发送的音频输出服务请求,生成响应数据包发送给蓝牙设备;发送加密指令给蓝牙设备,加密完成后启动连接蓝牙设备的音频接收端服务,连接成功后启动音频传输。本申请不仅提升了与蓝牙设备的绑定连接速度,还提高了蓝牙设备的兼容性和通用性。

Description

蓝牙连接方法、系统、智能终端及计算机存储介质 技术领域
本申请涉及蓝牙连接技术领域,尤其涉及一种蓝牙连接方法、系统、智能终端及计算机存储介质。
背景技术
蓝牙(Bluetooth),是一种支持设备短距离通讯的无线电技术,能够有效简化移动设备间的数据通信和语音通信。现在人们对无线设备的需求日益增强,市面上的智能蓝牙音箱,蓝牙耳机等设备层出不穷。当使用蓝牙设备的各种功能,比如播放歌曲,首先需要和这些蓝牙设备进行配对,建立无线链路。
目前在使用蓝牙音箱等BR(Basic Rate 基础速率)设备(即蓝牙设备)时,智能终端(例如智能电视或者智能手机)发起蓝牙扫描,扫描周围正处于广播可发现、可连接的蓝牙音箱,当智能设备扫描到蓝牙音响时,发起配对绑定连接,建立智能终端与蓝牙音箱的无线链路连接,绑定成功后,智能终端和蓝牙音箱分发绑定过程中协商的密钥,然后智能终端通过SDP(Service Discovery Protocol,服务发现协议,SDP提供了一种用于发现服务及这些可用服务属性的方法)服务发现请求获取蓝牙音箱支持的服务属性。
技术问题
当被发起连接的蓝牙设备同时支持多种协议,智能终端都发起连接时,势必造成连接速度慢和连接冲突,最终导致连接失败的问题,另外,部分蓝牙音箱再次主动发起服务请求时,智能终端不会响应该请求或者响应回复的内容为空,这样就会导致蓝牙设备一直没有收到响应或者响应异常,最终导致超时断开连接。
因此,现有技术还有待于改进和发展。
技术解决方案
本申请的主要目的在于提供一种蓝牙连接方法、系统、智能终端及计算机存储介质,旨在解决现有技术中智能终端和蓝牙设备容易出现连接失败或者连接断开的问题。
为实现上述目的,本申请提供一种蓝牙连接方法,所述蓝牙连接方法包括如下步骤:
与蓝牙设备建立连接和绑定,获取所述蓝牙设备所支持的服务;
获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务;
发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备;
发送加密指令给所述蓝牙设备,加密完成后启动连接所述蓝牙设备的音频接收端服务,连接成功后启动音频传输。
可选地,所述的蓝牙连接方法,其中,所述与蓝牙设备建立连接和绑定,获取蓝牙设备所支持的服务,具体包括:
与所述蓝牙设备建立链路连接;
发送获取所述蓝牙设备的输入输出能力的请求到所述蓝牙设备,接收所述蓝牙设备根据所述请求反馈的输入输出能力,并根据所述输入输出能力选择与所述蓝牙设备的绑定方式;
确定与所述蓝牙设备的绑定方式后,生成密钥并发送给所述蓝牙设备;
发送SDP服务发现请求给所述蓝牙设备,以获取所述蓝牙设备所支持的服务。
可选地,所述的蓝牙连接方法,其中,所述获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务,具体包括:
获取所述蓝牙设备的设备子类型;
若所述设备子类型为蓝牙音箱,则主动发送服务请求至所述蓝牙音箱,并接收所述蓝牙音箱发送的服务请求响应;
解析所述服务请求响应,获取身份标识值并存储在单链表中;
遍历所述单链表中的所述身份标识值,在所述蓝牙设备所支持的服务中选择需要进行连接的服务。
可选地,所述的蓝牙连接方法,其中,所述发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备,具体包括:
发送音频输入服务请求到所述蓝牙设备,接收并解析所述蓝牙设备对所述音频输入服务请求的响应;
若接收到所述蓝牙设备发送的音频输出服务请求,判断所述音频接收端服务连接是否开启;
若开启,则获取音频输出记录并增加对应的身份标识值,生成响应数据包发送给所述蓝牙设备。
可选地,所述的蓝牙连接方法,其中,所述判断音频接收端服务连接是否开启的步骤,之后还包括:
若未开启,则发给所述蓝牙设备的响应回复的内容为空。
可选地,所述的蓝牙连接方法,其中,所述获取所述蓝牙设备的设备子类型的步骤,之后还包括:
若所述设备子类型不为蓝牙音箱,则获取其他服务请求。
可选地,所述的蓝牙连接方法,其中,所述绑定方式包括:数值比较、只是工作方式、带外和密码登录的至少之一。
此外,为实现上述目的,本申请还提供一种智能终端,其中,所述智能终端包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的蓝牙连接程序,所述蓝牙连接程序被所述处理器执行时实现如上所述的蓝牙连接方法的步骤。
此外,为实现上述目的,本申请还提供一种蓝牙连接系统,其中,所述系统包括蓝牙设备和如上所述的智能终端,所述智能终端和所述蓝牙设备建立连接和绑定;
其中,所述智能终端用于获取所述蓝牙设备所支持的服务;
所述智能终端还用于获取所述蓝牙设备的设备子类型,并根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务;
所述智能终端还用于发送音频输入服务请求到所述蓝牙设备并接收响应;
所述蓝牙设备用于发送音频输出服务请求给所述智能终端,所述智能终端生成响应数据包发送给所述蓝牙设备;
所述智能终端还用于发送加密指令给所述蓝牙设备,加密完成后启动连接所述蓝牙设备的音频接收端服务,连接成功后启动音频传输。
此外,为实现上述目的,本申请还提供一种计算机存储介质,其中,所述计算机存储介质存储有蓝牙连接程序,所述蓝牙连接程序被处理器执行时实现如上所述的蓝牙连接方法的步骤。
有益效果
本申请通过智能终端与蓝牙设备建立连接和绑定,获取蓝牙设备所支持的服务;获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务;发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备;发送加密指令给所述蓝牙设备,加密完成后启动连接所述蓝牙设备的音频接收端服务,连接成功后启动音频传输。本申请通过优化和蓝牙设备的连接过程,主动获取和选择蓝牙设备的服务,并对蓝牙设备的的服务请求及时进行响应处理,不仅可以提升与蓝牙设备的绑定连接速度,还可以提高蓝牙设备的兼容性和通用性。
附图说明
图1是本申请蓝牙连接方法的较佳实施例的流程图;
图2是本申请蓝牙连接方法的较佳实施例中步骤S10的流程图;
图3是本申请蓝牙连接方法的较佳实施例中步骤S20的流程图;
图4是本申请蓝牙连接方法的较佳实施例中智能终端主动发送服务请求给蓝牙设备并选择需要连接的服务的示意图;
图5是本申请蓝牙连接方法的较佳实施例中步骤S30的流程图;
图6是本申请蓝牙连接方法的较佳实施例中蓝牙设备主动发起服务发现请求给智能终端的示意图;
图7是本申请蓝牙连接方法的较佳实施例中整个连接过程的流程示意图;
图8为本申请智能终端的较佳实施例的运行环境示意图。
本发明的实施方式
为使本申请的目的、技术方案及优点更加清楚、明确,以下参照附图并举实施例对本申请进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请较佳实施例所述的蓝牙连接方法,如图1所示,所述蓝牙连接方法包括以下步骤:
步骤S10、与蓝牙设备建立连接和绑定,获取所述蓝牙设备所支持的服务。
具体的过程请参阅图2,其为本申请提供的蓝牙连接方法中步骤S10的流程图。
如图2所示,所述步骤S10包括:
S11、与所述蓝牙设备建立链路连接;
S12、发送获取所述蓝牙设备的输入输出能力的请求到所述蓝牙设备,接收所述蓝牙设备根据所述请求反馈的输入输出能力,并根据所述输入输出能力选择与所述蓝牙设备的绑定方式;
S13、确定与所述蓝牙设备的绑定方式后,生成密钥并发送给所述蓝牙设备;
S14、发送SDP服务发现请求给所述蓝牙设备,以获取所述蓝牙设备所支持的服务。
具体地,本申请的执行主体为智能终端(例如智能电视,智能手机等可进行音视频播放的设备),即本申请是所述智能终端和所述蓝牙设备建立连接进行音频传输的过程,所述智能终端(例如智能电视TV)首先和所述蓝牙设备建立链路连接,例如所述智能终端(例如智能终端的主机host)通过协议栈向所述蓝牙设备发起HCI_Create_Connection(链路连接),所述智能终端和所述蓝牙设备的链路连接成功后,所述智能终端发送获取所述蓝牙设备的输入输出能力的请求到所述蓝牙设备,以便所述智能终端知悉所述蓝牙设备的输入输出能力,所述蓝牙设备接收到所述智能终端获取所述蓝牙设备的输入输出能力的请求后,所述蓝牙设备根据所述请求反馈输入输出能力给所述智能终端,所述智能终端接收所述蓝牙设备反馈的输入输出能力后,根据所述输入输出能力选择与所述蓝牙设备的绑定方式。
其中,所述绑定方式包括如下方式的至少之一:数值比较(Numeric Comparison,数值比较适用于低功耗安全连接,而不适用于传统配对)、只是工作方式(Just Works,即这种绑定方式不需要蓝牙设备进行确认,也表示这时的蓝牙设备无输入输出能力)、带外(Out of Band,是指连接双方中的一方发生重要事情,想要迅速地通知对方,在数据传送过程中,希望不通过常规传输方式传送给用户以便及时处理的某一类信息,如UNIX系统的中断键、终端流控制符,称为带外数据)和密码登录(Passkey Entry,通过密码验证的方式登录)。
进一步地,当所述智能终端确定与所述蓝牙设备的绑定方式后(上述四种绑定方式的一种,例如对于蓝牙设备是无输入输出能力的蓝牙音箱,则绑定方式选择Just Works,即无需蓝牙音箱进行确认),所述智能设备生成密钥(密钥是一种参数,它是在明文转换为密文或将密文转换为明文的算法中输入的参数)并发送给所述蓝牙设备,之后,所述智能终端发送SDP(Service Discovery Protocol,服务发现协议)服务发现请求给所述蓝牙设备,用于获取所述蓝牙设备所支持的服务,因为所述智能终端知道所述蓝牙设备所支持的服务有哪些之后,就可以选择需要连接的服务。
步骤S20、获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务。
具体过程请参阅图3,其为本申请提供的蓝牙连接方法中步骤S20的流程图。
如图3所示,所述步骤S20包括:
S21、获取所述蓝牙设备的设备子类型;
S22、如果所述设备子类型为蓝牙音箱,则主动发送服务请求至所述蓝牙音箱,并接收所述蓝牙音箱发送的服务请求响应;
S23、解析所述服务请求响应,获取身份标识值并存储在单链表中;
S24、遍历所述单链表中的所述身份标识值,在所述蓝牙设备所支持的服务中选择需要进行连接的服务。
具体地,所述智能终端获取所述蓝牙设备的设备子类型(Device Class),蓝牙设备通过major device class区分大类,通过minor device class区分小类,比如音箱major为audio,minor为speaker;所述智能终端判断所述设备子类型是否为蓝牙音箱(0x0400,即判断时如果字节为0x0400则表示所述蓝牙设备为蓝牙音箱),如果所述设备子类型为蓝牙音箱(0x0400),则主动发送服务请求(SDP_ServiceSearchAttributeRequest)至所述蓝牙音箱,所述蓝牙音箱收到所述服务请求后进行响应,所述智能终端并接收所述蓝牙音箱发送的服务请求响应(SDP_ServiceSearchAttributeResponse),然后所述智能终端解析所述服务请求响应(即解析SDP Packet里面的字段Service Record Attributes的值),并存储在单链表中,所述智能终端通过遍历单链表中UUID值(UniversalUniqueIdentifier,身份标识,目的是让分布式系统中的所有元素,都能有唯一的辨识信息,而不需要通过中央控制端来做辨识信息的指定),从而可以根据身份标识值(不同的身份标识值对应不同的服务)在所述蓝牙设备所支持的服务中选择需要优先进行连接的服务。例如,优先选择需要进行连接的服务。更具体的,优先连接蓝牙音箱Audio Sink(音频输入端),该策略可解决支持多服务音箱冲突连接失败问题。另外,如果所述设备子类型不为蓝牙音箱,则获取其他服务请求,例如获取蓝牙设备的电量服务、获取蓝牙设备的运动数据、获取蓝牙设备的天气数据等。
其中,单链表是一种链式存取的数据结构,用一组地址任意的存储单元存放线性表中的数据元素;链表中的数据是以结点来表示的,每个结点的构成:元素(数据元素的映象) +指针(指示后继元素存储位置),元素就是存储数据的存储单元,指针就是连接每个结点的地址数据。
进一步地,如图4所示,所述智能终端主动发送服务请求(即SDP服务发现请求)给所述蓝牙设备,判断所述蓝牙设备的设备子类型是否为蓝牙音箱,如果所述设备子类型为蓝牙音箱,则主动发送服务请求至所述蓝牙音箱,并接收所述蓝牙音箱发送的服务请求响应,解析所述服务请求响应,获取身份标识值并存储在单链表中,遍历所述单链表中的所述身份标识值,在所述蓝牙设备所支持的服务中选择需要进行连接的服务;如果所述设备子类型不为蓝牙音箱,则获取其他服务请求。
步骤S30、发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备。
具体过程请参阅图5,其为本申请提供的蓝牙连接方法中步骤S30的流程图。
如图5所示,所述步骤S30包括:
S31、发送音频输入服务请求到所述蓝牙设备,接收并解析所述蓝牙设备对所述音频输入服务请求的响应;
S32、若接收到所述蓝牙设备发送的音频输出服务请求,判断所述音频接收端服务连接是否开启;
S33、若开启,则获取音频输出记录并增加对应的身份标识值,生成响应数据包发送给所述蓝牙设备。
具体地,所述智能终端发送音频输入(AudioSink)服务请求给所述蓝牙设备,所述蓝牙设备接收到音频输入服务请求后进行响应,所述智能终端接收所述蓝牙设备对所述音频输入服务请求的响应,并解析所述蓝牙设备对所述音频输入服务请求的响应;由于不同蓝牙设备支持服务情况不一样,部分蓝牙设备又会主动发起音频输出(AudioSource)服务请求确认,所述智能终端收到AudioSource服务请求后,判断音频接收端(sink)服务连接是否开启,如果音频接收端服务连接开启,所述智能终端填充AudioSource(音频输出)记录和增加对应的UUID值(身份标识值),组装好响应packet包(即响应数据包)之后,发送回复给所述蓝牙设备。另外,如果音频接收端服务连接未开启,则发给所述蓝牙设备的响应回复的内容为空。
例如,所述蓝牙设备为蓝牙音箱,即蓝牙音箱为source,智能终端(TV)为sink,那么TV需要判断sink是否开启,才会发送packet(数据包)给蓝牙音箱。
进一步地,如图6所示,所述智能终端发送音频输入服务请求(AudioSink)到所述蓝牙设备,有些蓝牙设备为了进一步确认连接,会主动发起音频输出(Audio Source)服务发现请求给所述智能终端,当所述智能终端收到该音频输出(Audio Source)服务发现请求,会把响应数据字段填充并响应回复所述蓝牙设备,但是部分蓝牙音箱不会发起音频输出(Audio Source)服务发现请求,那么所述智能终端回复的信息为NULL(空),即所述智能终端发给所述蓝牙设备的响应回复的内容为空。
步骤S40、发送加密指令给所述蓝牙设备,加密完成后启动连接所述蓝牙设备的音频接收端服务,连接成功后启动音频传输。
具体地,在所述智能终端和所述蓝牙设备双方服务发送完成后,所述智能终端启动加密,将加密指令发送给所述蓝牙设备,当所述蓝牙设备接收到加密指令后进行加密,例如,所述智能终端会发送加密命令HCI_Set_Connection_Encryption给所述蓝牙设备,当双方都同意加密后,双方都会接收event:sHCI_Encryption_Change (on),完成加密,加密完成后所述智能终端气动连接发起对所述蓝牙设备的音频接收端(sink)服务,连接成功后最后启动音频传输。
进一步地,如图7所示,本申请中智能终端和蓝牙设备进行蓝牙连接方法的整个过程如下:
所述智能终端(例如TV)和所述蓝牙设备建立绑定连接,成功建立链路连接(HCI_Create_Connection)后,所述智能终端获取所述蓝牙设备反馈的输入输出能力,所述智能终端确定与所述蓝牙设备的绑定方式后,生成密钥并发送给所述蓝牙设备,所述智能终端发送SDP服务发现请求给所述蓝牙设备,判断所述蓝牙设备的设备子类型,如果所述设备子类型不为蓝牙音箱,则获取其他服务请求,根据解析回应进行其他服务连接(智能终端决定服务连接),如果所述设备子类型为蓝牙音箱,则所述智能终端主动发送AudioSink服务请求至所述蓝牙音箱,并接收和解析所述蓝牙音箱发送的服务请求响应,启动定时器(Timer)等待,判断所述智能终端是否接收到所述蓝牙设备(此时为蓝牙音箱)发出的Audio Source服务请求,如果没有则所述蓝牙设备不发送服务请求,如果所述智能终端接收到所述蓝牙设备发出的Audio Source服务请求,则所述蓝牙设备回应所述智能终端profile(协议)信息,所述智能终端启动加密,开启音频接收端(sink)服务连接。
本申请通过改善和优化智能终端与蓝牙设备的连接流程,通过智能终端主动发起获取蓝牙设备服务,智能终端决定选择服务连接,智能终端增加收到蓝牙设备服务请求,做相应响应处理,最大限度的提高蓝牙的兼容性和通用性,不仅可以提升与蓝牙设备的绑定连接速度,而且可以解决兼容性问题,同时给用户带来良好的产品体验,提高产品的核心竞争力。
进一步地,如图8所示,基于上述蓝牙连接方法,本申请还相应提供了一种智能终端,所述智能终端包括处理器10、存储器20及显示器30。图8仅示出了智能终端的部分组件,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。
所述存储器20在一些实施例中可以是所述智能终端的内部存储单元,例如智能终端的硬盘或内存。所述存储器20在另一些实施例中也可以是所述智能终端的外部存储设备,例如所述智能终端上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器20还可以既包括所述智能终端的内部存储单元也包括外部存储设备。所述存储器20用于存储安装于所述智能终端的应用软件及各类数据,例如所述安装智能终端的程序代码等。所述存储器20还可以用于暂时地存储已经输出或者将要输出的数据。在一实施例中,存储器20上存储有蓝牙连接程序40,该蓝牙连接程序40可被处理器10所执行,从而实现本申请中蓝牙连接方法。
所述处理器10在一些实施例中可以是一中央处理器(Central Processing Unit,CPU),微处理器或其他数据处理芯片,用于运行所述存储器20中存储的程序代码或处理数据,例如执行所述蓝牙连接方法等。
所述显示器30在一些实施例中可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。所述显示器30用于显示在所述智能终端的信息以及用于显示可视化的用户界面。所述智能终端的部件10-30通过系统总线相互通信。
在一实施例中,当处理器10执行所述存储器20中蓝牙连接程序40时实现以下步骤:
与蓝牙设备建立连接和绑定,获取所述蓝牙设备所支持的服务;
获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务;
发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备;
发送加密指令给所述蓝牙设备,加密完成后启动连接所述蓝牙设备的音频接收端服务,连接成功后启动音频传输。
其中,所述与蓝牙设备建立连接和绑定,获取蓝牙设备所支持的服务,具体包括:
与所述蓝牙设备建立链路连接;
发送获取所述蓝牙设备的输入输出能力的请求到所述蓝牙设备,接收所述蓝牙设备根据所述请求反馈的输入输出能力,并根据所述输入输出能力选择与所述蓝牙设备的绑定方式;
确定与所述蓝牙设备的绑定方式后,生成密钥并发送给所述蓝牙设备;
发送SDP服务发现请求给所述蓝牙设备,以获取所述蓝牙设备所支持的服务。
其中,所述获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务,具体包括:
获取所述蓝牙设备的设备子类型;
如果所述设备子类型为蓝牙音箱,则主动发送服务请求至所述蓝牙音箱,并接收所述蓝牙音箱发送的服务请求响应;
解析所述服务请求响应,获取身份标识值并存储在单链表中;
遍历所述单链表中的所述身份标识值,在所述蓝牙设备所支持的服务中选择需要进行连接的服务。
其中,所述发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备,具体包括:
发送音频输入服务请求到所述蓝牙设备,接收并解析所述蓝牙设备对所述音频输入服务请求的响应;
若接收到所述蓝牙设备发送的音频输出服务请求,判断所述音频接收端服务连接是否开启;
若开启,则获取音频输出记录并增加对应的身份标识值,生成响应数据包发送给所述蓝牙设备。
其中,所述判断音频接收端服务连接是否开启的步骤之后,还包括:
若未开启,则发给所述蓝牙设备的响应回复的内容为空。
其中,所述获取所述蓝牙设备的设备子类型的步骤之后,还包括:
如果所述设备子类型不为蓝牙音箱,则获取其他服务请求。
其中,所述绑定方式包括:数值比较、只是工作方式、带外和密码登录的至少之一。
进一步地,如图4或者如图6所示,本申请还一种蓝牙连接系统,所述系统智能终端和蓝牙设备;所述智能终端和所述蓝牙设备建立连接和绑定;其中,所述智能终端用于获取所述蓝牙设备所支持的服务;所述智能终端还用于获取所述蓝牙设备的设备子类型,并根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务;所述智能终端还用于发送音频输入服务请求到所述蓝牙设备并接收响应;所述蓝牙设备用于发送音频输出服务请求给所述智能终端,所述智能终端生成响应数据包发送给所述蓝牙设备;所述智能终端还用于发送加密指令给所述蓝牙设备,加密完成后启动连接所述蓝牙设备的音频接收端服务,连接成功后启动音频传输。
进一步地,本申请还提供一种计算机存储介质,其中,所述计算机存储介质存储有蓝牙连接程序,所述蓝牙连接程序被处理器执行时实现如上所述的蓝牙连接方法的步骤。
综上所述,本申请提供一种蓝牙连接方法、系统、智能终端及计算机存储介质,所述方法包括:与蓝牙设备建立连接和绑定,获取蓝牙设备所支持的服务;获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务;发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备;发送加密指令给所述蓝牙设备,加密完成后启动连接所述蓝牙设备的音频接收端服务,连接成功后启动音频传输。本申请通过优化和蓝牙设备的连接过程,主动获取和选择蓝牙设备的服务,并对蓝牙设备的的服务请求及时进行响应处理,不仅可以提升与蓝牙设备的绑定连接速度,还可以提高蓝牙设备的兼容性和通用性。
当然,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关硬件(如处理器,控制器等)来完成,所述的程序可存储于一计算机可读取的计算机存储介质中,所述程序在执行时可包括如上述各方法实施例的流程。其中所述的计算机存储介质可为存储器、磁碟、光盘等。
应当理解的是,本申请的应用不限于上述的举例,对本领域普通技术人员来说,可以根据上述说明加以改进或变换,所有这些改进和变换都应属于本申请所附权利要求的保护范围。

Claims (20)

  1. 一种蓝牙连接方法,应用于智能终端,其中,所述蓝牙连接方法包括:
    与蓝牙设备建立连接和绑定,获取所述蓝牙设备所支持的服务;
    获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务;
    发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备;
    发送加密指令给所述蓝牙设备,加密完成后启动连接所述蓝牙设备的音频接收端服务,连接成功后启动音频传输。
  2. 根据权利要求1所述的蓝牙连接方法,其中,所述与蓝牙设备建立连接和绑定,获取蓝牙设备所支持的服务,具体包括:
    与所述蓝牙设备建立链路连接;
    发送获取所述蓝牙设备的输入输出能力的请求到所述蓝牙设备,接收所述蓝牙设备根据所述请求反馈的输入输出能力,并根据所述输入输出能力选择与所述蓝牙设备的绑定方式;
    确定与所述蓝牙设备的绑定方式后,生成密钥并发送给所述蓝牙设备;
    发送SDP服务发现请求给所述蓝牙设备,以获取所述蓝牙设备所支持的服务。
  3. 根据权利要求2所述的蓝牙连接方法,其中,所述获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务,具体包括:
    获取所述蓝牙设备的设备子类型;
    若所述设备子类型为蓝牙音箱,则主动发送服务请求至所述蓝牙音箱,并接收所述蓝牙音箱发送的服务请求响应;
    解析所述服务请求响应,获取身份标识值并存储在单链表中;
    遍历所述单链表中的所述身份标识值,在所述蓝牙设备所支持的服务中选择需要进行连接的服务。
  4. 根据权利要求3所述的蓝牙连接方法,其中,所述发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备,具体包括:
    发送音频输入服务请求到所述蓝牙设备,接收并解析所述蓝牙设备对所述音频输入服务请求的响应;
    若接收到所述蓝牙设备发送的音频输出服务请求,判断所述音频接收端服务连接是否开启;
    若开启,则获取音频输出记录并增加对应的身份标识值,生成所述响应数据包发送给所述蓝牙设备。
  5. 根据权利要求4所述的蓝牙连接方法,其中,所述判断所述音频接收端服务连接是否开启的步骤之后,还包括:
    若未开启,则发给所述蓝牙设备的响应回复的内容为空。
  6. 根据权利要求3所述的蓝牙连接方法,其中,所述获取所述蓝牙设备的设备子类型的步骤之后,还包括:
    若所述设备子类型不为蓝牙音箱,则获取其他服务请求。
  7. 根据权利要求2所述的蓝牙连接方法,其中,所述绑定方式包括:数值比较、只是工作方式、带外和密码登录的至少之一。
  8. 一种蓝牙连接方法,应用于蓝牙设备,其中,所述蓝牙连接方法包括:
    与智能终端建立连接和绑定,以使得所述智能终端获取所述蓝牙设备所支持的服务,以及使得所述智能终端获取所述蓝牙设备的设备子类型并根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务;
    接收所述智能终端发送的音频输入服务请求并进行响应,向所述智能终端发送音频输出服务请求,以触发所述智能终端生成响应数据包并返回;
    响应于接收到所述智能终端发送的加密指令进行加密,以在加密完成后由所述智能终端启动连接所述蓝牙设备的音频接收端服务并在连接成功后启动音频传输。
  9. 根据权利要求8所述的蓝牙连接方法,其中,所述与智能终端建立连接和绑定,以使得所述智能终端获取所述蓝牙设备所支持的服务,具体包括:
    与所述智能终端建立链路连接;
    接收所述智能终端发送的获取所述蓝牙设备的输入输出能力的请求;
    根据所述请求向所述智能终端反馈输入输出能力,以使得所述智能终端根据所述输入输出能力选择与所述蓝牙设备的绑定方式,并在确定绑定方式后,生成密钥并返回;
    当接收到所述智能终端发送的SDP服务发现请求,向所述智能终端发送所述蓝牙设备所支持的服务。
  10. 根据权利要求9所述的蓝牙连接方法,其中,所述接收所述智能终端发送的音频输入服务请求并进行响应,向所述智能终端发送音频输出服务请求,以触发所述智能终端生成响应数据包并返回,具体包括:
    接收所述智能终端发送的音频输入服务请求;
    响应所述音频输入服务请求,向所述智能终端发送所述蓝牙设备对所述音频输入服务请求的响应,其中,所述智能终端接收并解析所述蓝牙设备对所述音频输入服务请求的响应,在确定接收到所述蓝牙设备发送的音频输出服务请求时,判断所述音频接收端服务连接是否开启,并在开启时,获取音频输出记录并增加对应的身份标识值生成所述响应数据包并返回。
  11. 根据权利要求9所述的蓝牙连接方法,其中,所述绑定方式包括:数值比较、只是工作方式、带外和密码登录的至少之一。
  12. 一种智能终端,其中,所述智能终端包括:
    存储器、处理器及存储在所述存储器上并可在所述处理器上运行的蓝牙连接程序,所述蓝牙连接程序被所述处理器执行时,所述处理器执行:
    与蓝牙设备建立连接和绑定,获取所述蓝牙设备所支持的服务;
    获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务;
    发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备;
    发送加密指令给所述蓝牙设备,加密完成后启动连接所述蓝牙设备的音频接收端服务,连接成功后启动音频传输。
  13. 根据权利要求12所述的智能终端,其中,所述与蓝牙设备建立连接和绑定,获取蓝牙设备所支持的服务时,所述处理器执行:
    与所述蓝牙设备建立链路连接;
    发送获取所述蓝牙设备的输入输出能力的请求到所述蓝牙设备,接收所述蓝牙设备根据所述请求反馈的输入输出能力,并根据所述输入输出能力选择与所述蓝牙设备的绑定方式;
    确定与所述蓝牙设备的绑定方式后,生成密钥并发送给所述蓝牙设备;
    发送SDP服务发现请求给所述蓝牙设备,以获取所述蓝牙设备所支持的服务。
  14. 根据权利要求13所述的智能终端,其中,所述获取所述蓝牙设备的设备子类型,根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务时,所述处理器执行:
    获取所述蓝牙设备的设备子类型;
    若所述设备子类型为蓝牙音箱,则主动发送服务请求至所述蓝牙音箱,并接收所述蓝牙音箱发送的服务请求响应;
    解析所述服务请求响应,获取身份标识值并存储在单链表中;
    遍历所述单链表中的所述身份标识值,在所述蓝牙设备所支持的服务中选择需要进行连接的服务。
  15. 根据权利要求14所述的智能终端,其中,所述发送音频输入服务请求到所述蓝牙设备并接收响应,接收所述蓝牙设备发送的音频输出服务请求,生成响应数据包发送给所述蓝牙设备时,所述处理器执行:
    发送音频输入服务请求到所述蓝牙设备,接收并解析所述蓝牙设备对所述音频输入服务请求的响应;
    若接收到所述蓝牙设备发送的音频输出服务请求,判断所述音频接收端服务连接是否开启;
    若开启,则获取音频输出记录并增加对应的身份标识值,生成所述响应数据包发送给所述蓝牙设备。
  16. 根据权利要求15所述的智能终端,其中,所述判断所述音频接收端服务连接是否开启的步骤之后,所述处理器执行:
    若未开启,则发给所述蓝牙设备的响应回复的内容为空。
  17. 根据权利要求14所述的智能终端,其中,所述获取所述蓝牙设备的设备子类型的步骤之后,所述处理器执行:
    若所述设备子类型不为蓝牙音箱,则获取其他服务请求。
  18. 根据权利要求13所述的智能终端,其中,所述绑定方式包括:数值比较、只是工作方式、带外和密码登录的至少之一。
  19. 一种蓝牙连接系统,其中,所述系统包括:
    蓝牙设备;
    如权利要求12至18任一项所述的智能终端,所述智能终端和所述蓝牙设备建立连接和绑定;
    其中,所述智能终端用于获取所述蓝牙设备所支持的服务;
    所述智能终端还用于获取所述蓝牙设备的设备子类型,并根据所述设备子类型在所述蓝牙设备所支持的服务中选择需要进行连接的服务;
    所述智能终端还用于发送音频输入服务请求到所述蓝牙设备并接收响应;
    所述蓝牙设备用于发送音频输出服务请求给所述智能终端,所述智能终端生成响应数据包发送给所述蓝牙设备;
    所述智能终端还用于发送加密指令给所述蓝牙设备,加密完成后启动连接所述蓝牙设备的音频接收端服务,连接成功后启动音频传输。
  20. 一种计算机存储介质,其中,所述计算机存储介质存储有蓝牙连接程序,所述蓝牙连接程序被处理器执行时,所述处理器执行如权利要求1-7、8-11任一项所述的蓝牙连接方法的步骤。
PCT/CN2021/113861 2020-12-14 2021-08-20 蓝牙连接方法、系统、智能终端及计算机存储介质 WO2022127171A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US18/257,299 US20240048990A1 (en) 2020-12-14 2021-08-20 Bluetooth connection method and system, intelligent terminal, and computer storage medium
GB2310146.2A GB2617297A (en) 2020-12-14 2021-08-20 Bluetooth connection method and system, intelligent terminal and computer storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011465205.9A CN114630303A (zh) 2020-12-14 2020-12-14 一种蓝牙连接方法、系统、智能终端及计算机存储介质
CN202011465205.9 2020-12-14

Publications (1)

Publication Number Publication Date
WO2022127171A1 true WO2022127171A1 (zh) 2022-06-23

Family

ID=81896639

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/113861 WO2022127171A1 (zh) 2020-12-14 2021-08-20 蓝牙连接方法、系统、智能终端及计算机存储介质

Country Status (4)

Country Link
US (1) US20240048990A1 (zh)
CN (1) CN114630303A (zh)
GB (1) GB2617297A (zh)
WO (1) WO2022127171A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103475775A (zh) * 2013-08-15 2013-12-25 宇龙计算机通信科技(深圳)有限公司 通信终端及其连接方法
US20170006415A1 (en) * 2015-07-01 2017-01-05 Lg Electronics Inc. Method and apparatus for controlling device in wireless communication system
CN111132098A (zh) * 2018-10-31 2020-05-08 阿尔卑斯通信器件技术(上海)有限公司 通信器、中央通信装置以及蓝牙通信系统
CN111556439A (zh) * 2020-04-23 2020-08-18 深圳传音控股股份有限公司 一种终端的连接控制方法、终端及计算机存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103475775A (zh) * 2013-08-15 2013-12-25 宇龙计算机通信科技(深圳)有限公司 通信终端及其连接方法
US20170006415A1 (en) * 2015-07-01 2017-01-05 Lg Electronics Inc. Method and apparatus for controlling device in wireless communication system
CN111132098A (zh) * 2018-10-31 2020-05-08 阿尔卑斯通信器件技术(上海)有限公司 通信器、中央通信装置以及蓝牙通信系统
CN111556439A (zh) * 2020-04-23 2020-08-18 深圳传音控股股份有限公司 一种终端的连接控制方法、终端及计算机存储介质

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
QING QING WIND: "Bluetooth Connection Process", 6 January 2014 (2014-01-06), CN, pages 1 - 1, XP009538515, Retrieved from the Internet <URL:http://blog.sina.com.cn/s/blog_4b475f4b0101iwua.html> *
RAFFAELE BRUNO, MARCO CONTI, ENRICO GREGORI: "Bluetooth: Architecture, Protocols and Scheduling Algorithms", CLUSTER COMPUTING, 1 April 2002 (2002-04-01), Boston , pages 117 - 131, XP055600798, DOI: 10.1023/A:1013989524865 *

Also Published As

Publication number Publication date
GB202310146D0 (en) 2023-08-16
CN114630303A (zh) 2022-06-14
US20240048990A1 (en) 2024-02-08
GB2617297A (en) 2023-10-04

Similar Documents

Publication Publication Date Title
US10278058B2 (en) Wireless communication device information processing device, and communication method
WO2021036513A1 (zh) 一种智能设备的配网方法、系统以及可读介质
US8634771B2 (en) Simple peer-to-peer network formation
US7848768B2 (en) Network system and communication device
KR100754431B1 (ko) Dlna 시스템에서 dmr의 처리용량에 따른 컨텐츠변환방법
EP2314059B1 (en) Method and system for providing input in home network using upnp
US20120158839A1 (en) Wireless network interface with infrastructure and direct modes
US11800337B2 (en) Method and apparatus for establishing Bluetooth data channel
KR101898492B1 (ko) 전자 장치 및 전자 장치의 제어 방법
EP3114821B1 (en) Method and devices for establishing a connection between a seeker device and a target device
KR102121358B1 (ko) 데이터 전송 방법 및 디바이스
JP5982402B2 (ja) ホームネットワークを用いた通話方法及び装置
WO2017143743A1 (zh) 一种异构协议互通方法及控制器
TW201438498A (zh) 無線網路系統及其連線方法
JP2021190862A (ja) 端末装置のためのコンピュータプログラムと通信装置
WO2014015743A1 (zh) 下载应用程序的方法、用户设备和应用服务器
KR101868153B1 (ko) 와이파이 다이렉트 기반 서비스 제공 방법 및 장치
WO2022127171A1 (zh) 蓝牙连接方法、系统、智能终端及计算机存储介质
CN114466230B (zh) 显示设备功能拓展方法、装置、投屏器及存储介质
CN115883572A (zh) 外设共享方法及装置
CN114785914A (zh) 显示设备、控制装置以及设备配置方法
CN112333062A (zh) 家居设备的控制方法、控制装置及计算机可读存储介质
WO2019015039A1 (zh) 一种基于物联网中继器的选择加密方法及装置
WO2022142496A1 (zh) 显示设备、外接设备、外接设备工作模式的切换方法及远场语音控制方法
CN115087132A (zh) 基于Miracast投屏方法、电子设备及系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21905104

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 18257299

Country of ref document: US

ENP Entry into the national phase

Ref document number: 202310146

Country of ref document: GB

Kind code of ref document: A

Free format text: PCT FILING DATE = 20210820

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21905104

Country of ref document: EP

Kind code of ref document: A1