




技术领域technical field
本发明属于蓝牙技术领域,尤其涉及蓝牙耳机的主从机设置系统、方法、装置及蓝牙耳机。The invention belongs to the technical field of bluetooth, and in particular relates to a master-slave setting system, method and device of a bluetooth earphone and a bluetooth earphone.
背景技术Background technique
随着蓝牙技术的发展,使得蓝牙耳机得到了广泛的应用,蓝牙耳机通常有一对,可以单个使用,也可双个一起使用。如果两个蓝牙耳机能够分别连接不同的设备,那么这两个蓝牙耳机可接收所连接设备发送的音频数据包,使得这两个蓝牙耳机中播放的音频不相同。这种情况下,用户如果想使用两个蓝牙耳机一起收听同一个音频,就会造成两个蓝牙耳机中的音频播放不同步,即产生了音频冲突,从而给用户带来不好的体验。With the development of bluetooth technology, bluetooth earphones have been widely used. There are usually a pair of bluetooth earphones, which can be used alone or in combination. If the two Bluetooth headsets can be connected to different devices respectively, then the two Bluetooth headsets can receive audio data packets sent by the connected devices, so that the audio played in the two Bluetooth headsets is different. In this case, if a user wants to use two Bluetooth headsets to listen to the same audio together, it will cause the audio playback in the two Bluetooth headsets to be out of synchronization, that is, an audio conflict occurs, thereby bringing a bad experience to the user.
发明内容SUMMARY OF THE INVENTION
有鉴于此,本发明实施例提供了一种蓝牙耳机的主从机设置系统、方法、装置及蓝牙耳机,以解决现有技术中两个蓝牙耳机分别接收不同设备的音频数据包而导致的音频播放不同步的问题。In view of this, the embodiments of the present invention provide a master-slave setting system, method, device and Bluetooth headset for a Bluetooth headset, so as to solve the problem of audio caused by two Bluetooth headsets receiving audio data packets from different devices in the prior art. Playing out of sync problem.
本发明实施例的第一方面提供了一种蓝牙耳机的主从机设置系统,所述系统包括第一蓝牙耳机和第二蓝牙耳机,其中:A first aspect of the embodiments of the present invention provides a master-slave setting system for a Bluetooth headset, the system includes a first Bluetooth headset and a second Bluetooth headset, wherein:
所述第一蓝牙耳机获取所述第一蓝牙耳机以及所述第二蓝牙耳机的设备连接状态,并根据二者的设备连接状态确定主机和从机,以及对所述第一蓝牙耳机进行主机或从机的设置,再将第一设置信息发送至所述第二蓝牙耳机;The first Bluetooth headset obtains the device connection status of the first Bluetooth headset and the second Bluetooth headset, and determines the master and slave according to the device connection status of the two, and performs the master or slave operation on the first Bluetooth headset. Setting of the slave, and then sending the first setting information to the second Bluetooth headset;
所述第二蓝牙耳机接收所述第一设置信息,并根据所述第一设置信息对所述第二蓝牙耳机进行主机或从机的设置;其中,设置的从机获取音频数据包,对音频数据包的来源进行判断,并只接收来源为主机的音频数据包。The second Bluetooth headset receives the first setting information, and sets the second Bluetooth headset as a host or a slave according to the first setting information; The source of the data packet is judged, and only the audio data packet whose source is the host is received.
本发明实施例的第二方面提供了一种蓝牙耳机的主从机设置方法,所述方法应用于第一蓝牙耳机或第二蓝牙耳机,包括:A second aspect of the embodiments of the present invention provides a method for setting a master-slave device of a Bluetooth headset. The method is applied to a first Bluetooth headset or a second Bluetooth headset, including:
获取本机以及另一个蓝牙耳机的设备连接状态;Get the device connection status of this unit and another Bluetooth headset;
根据本机以及另一个蓝牙耳机的设备连接状态确定主机和从机;Determine the master and slave according to the device connection status of this machine and another Bluetooth headset;
根据确定结果对本机进行主机或从机的设置,并将第一设置信息发送至另一个蓝牙耳机,以指示另一个蓝牙耳机完成主机或从机的设置。According to the determination result, the host or the slave is set to the local machine, and the first setting information is sent to another bluetooth headset to instruct the other bluetooth headset to complete the setting of the host or the slave.
本发明实施例的第三方面提供了一种蓝牙耳机的主从机设置装置,包括:A third aspect of the embodiments of the present invention provides a device for setting a master-slave device of a Bluetooth headset, including:
获取模块,用于获取本机以及另一个蓝牙耳机的设备连接状态;The acquisition module is used to acquire the device connection status of the machine and another Bluetooth headset;
主从机确定模块,用于根据本机以及另一个蓝牙耳机的设备连接状态确定主机和从机;The master-slave determination module is used to determine the master and the slave according to the device connection status of the local machine and another Bluetooth headset;
主从机设置模块,用于根据确定结果对本机进行主机或从机的设置,并将第一设置信息发送至另一个蓝牙耳机,以指示另一个蓝牙耳机完成主机或从机的设置。The master-slave setting module is used to set the host or the slave according to the determination result, and send the first setting information to another bluetooth headset to instruct the other bluetooth headset to complete the setting of the master or the slave.
本发明实施例的第四方面提供了一种蓝牙耳机,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上述第二方面所述方法的步骤。A fourth aspect of the embodiments of the present invention provides a Bluetooth headset, including a memory, a processor, and a computer program stored in the memory and executable on the processor, when the processor executes the computer program The steps of the method as described in the second aspect above are implemented.
本发明实施例的第五方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如上述第二方面所述方法的步骤。A fifth aspect of the embodiments of the present invention provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, implements the steps of the method described in the second aspect above .
本发明实施例中,通过根据第一蓝牙耳机和第二蓝牙耳机的设备连接状态确定主机和从机,并对两个蓝牙耳机进行主机以及从机的设置,以及限制设置好的从机只接收来源为主机的音频数据包,这就使得从机不会再接收除主机之外的任何设备所发送的音频数据包,进而避免了音频冲突的产生。In the embodiment of the present invention, the host and the slave are determined according to the device connection state of the first Bluetooth headset and the second Bluetooth headset, the host and the slave are set for the two Bluetooth headsets, and the set slave is limited to receive only The source is the audio data packet of the master, which makes the slave no longer receive the audio data packet sent by any device other than the master, thereby avoiding the occurrence of audio conflicts.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only for the present invention. In some embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1是本发明实施例提供的一种蓝牙耳机的主从机设置系统的交互示意图;1 is an interactive schematic diagram of a master-slave setting system of a Bluetooth headset provided by an embodiment of the present invention;
图2是本发明实施例提供的一种蓝牙耳机的主从机设置方法的流程示意图;2 is a schematic flowchart of a method for setting a master-slave device of a Bluetooth headset according to an embodiment of the present invention;
图3是本发明实施例提供的另一种蓝牙耳机的主从机设置方法的流程示意图;3 is a schematic flowchart of another method for setting a master-slave device of a Bluetooth headset according to an embodiment of the present invention;
图4是本发明实施例提供的一种蓝牙耳机的主从机设置装置的示意图;4 is a schematic diagram of a device for setting a master-slave device of a Bluetooth headset according to an embodiment of the present invention;
图5是本发明实施例提供的一种蓝牙耳机的示意图。FIG. 5 is a schematic diagram of a Bluetooth headset according to an embodiment of the present invention.
具体实施方式Detailed ways
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本发明实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本发明。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本发明的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as specific system structures and technologies are set forth in order to provide a thorough understanding of the embodiments of the present invention. However, it will be apparent to those skilled in the art that the present invention may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
为了说明本发明所述的技术方案,下面通过具体实施例来进行说明。In order to illustrate the technical solutions of the present invention, the following specific embodiments are used for description.
图1是本发明实施例提供的一种蓝牙耳机的主从机设置系统的交互示意图,所述系统包括第一蓝牙耳机11和第二蓝牙耳机12,其中:1 is an interactive schematic diagram of a master-slave setting system of a Bluetooth headset provided by an embodiment of the present invention, the system includes a first Bluetooth
所述第一蓝牙耳机获取所述第一蓝牙耳机以及所述第二蓝牙耳机的设备连接状态,并根据二者的设备连接状态确定主机和从机,以及对所述第一蓝牙耳机进行主机或从机的设置,再将第一设置信息发送至所述第二蓝牙耳机。The first Bluetooth headset obtains the device connection status of the first Bluetooth headset and the second Bluetooth headset, and determines the master and slave according to the device connection status of the two, and performs the master or slave operation on the first Bluetooth headset. Set the slave device, and then send the first setting information to the second Bluetooth headset.
具体地,所述第一蓝牙耳机通过蓝牙通讯协议与第二蓝牙耳机建立连接,二者能够相互发送蓝牙数据包进行信息交互,便于主从机的确定和设置。其中,所述蓝牙数据包包含了设备地址、设备连接状态、电量等信息。Specifically, the first Bluetooth headset establishes a connection with the second Bluetooth headset through a Bluetooth communication protocol, and the two can send Bluetooth data packets to each other for information exchange, which is convenient for the determination and setting of the master and slave devices. Wherein, the bluetooth data packet includes information such as device address, device connection status, power level, and the like.
所述设备连接状态包括两种状态:连接和未连接。The device connection state includes two states: connected and not connected.
所述第一设置信息包括了第一蓝牙耳机的主机或从机角色的设置信息。The first setting information includes the setting information of the role of the host or the slave of the first Bluetooth headset.
所述第二蓝牙耳机接收所述第一设置信息,并根据所述第一设置信息对所述第二蓝牙耳机进行主机或从机的设置;其中,设置的从机获取音频数据包,对音频数据包的来源进行判断,并只接收来源为主机的音频数据包。The second Bluetooth headset receives the first setting information, and sets the second Bluetooth headset as a host or a slave according to the first setting information; The source of the data packet is judged, and only the audio data packet whose source is the host is received.
如果所述第一设置信息为第一蓝牙耳机为主机,那么相应地就将第二蓝牙耳机设置为从机;如果所述第一设置信息为第一蓝牙耳机为从机,那么相应地就将第二蓝牙耳机设置为主机。需要说明的是,两个蓝牙耳机中,主机和从机分别只有一个,因此如果一个蓝牙耳机设为主机,那么另一个蓝牙耳机必定要设为从机。If the first setting information is that the first Bluetooth headset is the master, then the second Bluetooth headset is correspondingly set as the slave; if the first setting information is that the first Bluetooth headset is the slave, then the corresponding The second Bluetooth headset is set as the host. It should be noted that in the two Bluetooth headsets, there is only one master and one slave, so if one Bluetooth headset is set as the master, the other Bluetooth headset must be set as the slave.
其中,设置的从机获取空气中的音频数据包,由于空气中的音频数据包既有主机发送的、也有移动终端等其它非主机设备发送的,因此需要判断所述音频数据包的来源,有选择性的接收音频数据包,再将解析到的音频数据进行播放。Among them, the set slave acquires the audio data packets in the air. Since the audio data packets in the air are both sent by the host and other non-host devices such as mobile terminals, it is necessary to determine the source of the audio data packets. Selectively receive audio data packets, and then play the parsed audio data.
进一步地,判断音频数据包的来源的具体方式可以是:解析音频数据包,获取到其携带的设备地址,通过判断获取到的设备地址是属于主机还是移动终端等其他非主机的设备,即可判断该音频数据包的来源。Further, the specific method of judging the source of the audio data packet may be: parsing the audio data packet, obtaining the device address carried by it, and judging whether the obtained device address belongs to the host or other non-host devices such as a mobile terminal. Determine the source of the audio packet.
而设置好的主机也需要获取空气中的音频数据包,这是因为空气中的音频数据包可能来源于主机所连接的移动终端,也可能来源于其它设备,因此需进一步解析音频数据包获取其携带的设备地址,以确认是否为主机所需接收的音频数据包。The set host also needs to obtain the audio data packets in the air. This is because the audio data packets in the air may originate from the mobile terminal connected to the host or other devices. Therefore, it is necessary to further analyze the audio data packets to obtain their The device address carried to confirm whether it is the audio data packet that the host needs to receive.
由于主从机与移动终端的交互方式是:主机连接移动终端,主机接收移动终端发送的音频数据,并将该音频数据发送给从机;而从机与主机连接,并只接收主机所发送的音频数据,而不会接收移动终端所发送的音频数据,且从机不会主动发送音频数据,这就使得主机和从机一起使用时,可达到音频同步的播放效果,不会音频冲突。因此在本发明实施例中,通过根据设备连接状态确定主机和从机,并对第一蓝牙耳机和第二蓝牙耳机进行主机以及从机的设置,并限制设置好的从机只接收来源为主机的音频数据包,这就使得从机不会再接收除主机之外的任何设备所发送的音频数据包,进而避免了音频冲突的产生。Because the interaction between the master and the slave is as follows: the master is connected to the mobile terminal, the master receives the audio data sent by the mobile terminal, and sends the audio data to the slave; while the slave is connected to the master, and only receives the audio data sent by the master. Audio data, but will not receive audio data sent by the mobile terminal, and the slave will not actively send audio data, so that when the host and the slave are used together, the playback effect of audio synchronization can be achieved, and there will be no audio conflict. Therefore, in the embodiment of the present invention, the host and the slave are determined according to the connection state of the device, the host and the slave are set for the first Bluetooth headset and the second Bluetooth headset, and the set slave is limited to only receive the source as the host. Therefore, the slave will no longer receive the audio data packets sent by any device other than the master, thereby avoiding the occurrence of audio conflicts.
图2是本发明实施例提供的一种蓝牙耳机的主从机设置方法的流程示意图,该蓝牙耳机的主从机设置方法应用于第一蓝牙耳机或第二蓝牙耳机。详述如下:2 is a schematic flowchart of a master-slave setting method of a Bluetooth headset provided by an embodiment of the present invention, where the master-slave setting method of a Bluetooth headset is applied to a first Bluetooth headset or a second Bluetooth headset. Details are as follows:
S201:获取本机以及另一个蓝牙耳机的设备连接状态。S201: Obtain the device connection status of the local machine and another Bluetooth headset.
其中,所述设备连接状态包括两种:连接和未连接,可根据两个蓝牙耳机的设备连接状态确定主机和从机。Wherein, the device connection state includes two types: connected and unconnected, and the master and the slave can be determined according to the device connection state of the two Bluetooth headsets.
需要说明的是,本发明实施例的目的是避免这两个蓝牙耳机出现同时连接到不同音频输出设备的情况,杜绝音频冲突的产生,因此会有两种情况:第一种是两个蓝牙耳机均未连接任何设备,第二种是只有一个蓝牙耳机连接到移动终端。It should be noted that the purpose of the embodiment of the present invention is to prevent the two Bluetooth headsets from being connected to different audio output devices at the same time, and to prevent the occurrence of audio conflicts, so there are two situations: the first is two Bluetooth headsets Neither is connected to any device, the second is that only one Bluetooth headset is connected to the mobile terminal.
因此可根据上述两种不同的情况,确定主机和从机,并相应地进行主机或从机的设置。Therefore, the master and the slave can be determined according to the above two different situations, and the setting of the master or the slave can be performed accordingly.
S202:根据本机以及另一个蓝牙耳机的设备连接状态确定主机和从机。S202: Determine the master and the slave according to the device connection state of the local machine and another Bluetooth headset.
获取到另一个蓝牙耳机的设备连接状态后,结合本机的音频播放状态,确定主机和从机。After obtaining the device connection status of another Bluetooth headset, determine the master and slave according to the audio playback status of the machine.
作为本发明实施例中的一种可选实施方式,所述根据本机以及另一个蓝牙耳机的设备连接状态确定主机和从机,包括:As an optional implementation manner in the embodiment of the present invention, the determining of the master and the slave according to the device connection state of the local machine and another Bluetooth headset includes:
如果本机以及另一个蓝牙耳机的设备连接状态均为未连接,则获取另一个蓝牙耳机的设备地址,并将另一个蓝牙耳机的设备地址与本机的设备地址进行比较,根据比较结果确定主机和从机。If the device connection status of this machine and another Bluetooth headset is not connected, obtain the device address of the other Bluetooth headset, and compare the device address of the other Bluetooth headset with the device address of the machine, and determine the host according to the comparison result. and slave.
如果两个蓝牙耳机的设备连接状态均为未连接,则可获取本机及另一个蓝牙耳机的设备地址,并根据二者的设备地址确定主从机。其中,设备地址是蓝牙耳机的唯一标识,其具体是由生产厂商进行定义,例如本发明实施例中的蓝牙耳机设备地址为12位十六进制的数字,这12位数字中,前六位为生产厂商的编号,而后六位则为蓝牙耳机的设备地址,通过比较两个蓝牙耳机的设备地址可确定主从机。实际应用中,可选取设备地址较大的蓝牙耳机作为主机、设备地址较小的蓝牙耳机作为从机,当然也可以反过来,即选取设备地址较小的蓝牙耳机作为主机、设备地址较大的蓝牙耳机作为从机。此种情况是在两个蓝牙耳机均未连接其它设备时,设置了主从机,从机只接收主机发送的音频数据包,这就不会出现两个蓝牙耳机可同时连接不同设备的情况,从而避免了音频冲突的产生。If the device connection status of the two Bluetooth headsets is not connected, the device addresses of the machine and the other Bluetooth headset can be obtained, and the master and slave devices can be determined according to the device addresses of the two. The device address is the unique identifier of the Bluetooth headset, which is specifically defined by the manufacturer. For example, the device address of the Bluetooth headset in the embodiment of the present invention is a 12-digit hexadecimal number. Among the 12-digit numbers, the first six digits It is the serial number of the manufacturer, and the last six digits are the device address of the Bluetooth headset. The master and slave devices can be determined by comparing the device addresses of the two Bluetooth headsets. In practical applications, the Bluetooth headset with a larger device address can be selected as the host, and the Bluetooth headset with a smaller device address can be selected as the slave. Bluetooth headset as slave. In this case, when the two Bluetooth headsets are not connected to other devices, the master and slave machines are set, and the slave machines only receive audio data packets sent by the host machine, so there will be no situation where two Bluetooth headsets can be connected to different devices at the same time. Thereby avoiding the generation of audio conflicts.
作为本发明实施例中的另一种可选实施方式,所述根据本机以及另一个蓝牙耳机的设备连接状态确定主机和从机,包括:As another optional implementation in the embodiment of the present invention, the determining of the host and the slave according to the device connection state of the local machine and another Bluetooth headset includes:
如果本机的设备连接状态为连接、且另一个蓝牙耳机的设备连接状态为未连接,则确定将本机作为主机;If the device connection status of the machine is connected, and the device connection status of another Bluetooth headset is not connected, it is determined to use the machine as the host;
如果本机的设备连接状态为未连接、且另一个蓝牙耳机的设备连接状态为连接,则确定将本机作为从机。If the device connection status of this unit is not connected, and the device connection status of another Bluetooth headset is connected, it is determined to use this unit as a slave.
当只有一个蓝牙耳机连接了移动终端等设备时,可将连接了移动终端的蓝牙耳机作为主机,另一个蓝牙耳机作为从机。此种情况是在两个蓝牙耳机中仅有一个蓝牙耳机连接了其它设备时,设置了主从机,从机只接收主机发送的音频数据包,这就不会出现两个蓝牙耳机可同时连接不同设备的情况,从而避免了音频冲突的产生。When only one Bluetooth headset is connected to the mobile terminal and other devices, the Bluetooth headset connected to the mobile terminal can be used as the host, and the other Bluetooth headset can be used as the slave. In this case, when only one of the two Bluetooth headsets is connected to other devices, the master-slave device is set, and the slave device only receives the audio data packets sent by the host, so there will be no two Bluetooth headsets that can be connected at the same time. Different devices, thus avoiding the generation of audio conflicts.
S203:根据确定结果对本机进行主机或从机的设置,并将第一设置信息发送至另一个蓝牙耳机,以指示另一个蓝牙耳机完成主机或从机的设置。S203: Set the host or the slave according to the determination result, and send the first setting information to another Bluetooth headset to instruct the other Bluetooth headset to complete the setting of the host or the slave.
在确定主从机之后,根据确定的结果对本机进行设置,例如将本机设置为主机,并将第一设置信息发送至另一个蓝牙耳机,通知另一个蓝牙耳机将其设置为从机。After the master and slave devices are determined, the device is set according to the determined result, for example, the device is set as the master device, and the first setting information is sent to another Bluetooth headset to notify the other Bluetooth headset to set it as a slave device.
在将本机设置为主机或从机之后,将获取空气中的音频数据包。需要说明的是,只有主机和移动终端或者其它设备会发送音频数据包,从机是不会发送音频数据包的。After the unit is set as master or slave, the audio packets in the air will be acquired. It should be noted that only the host and the mobile terminal or other devices will send audio data packets, and the slave will not send audio data packets.
如果本机为主机,那么另一个蓝牙耳机必定为从机,由于从机不会发送音频数据包,那么此时空气中的音频数据包是由主机所连接的移动终端或者其它设备所发送的,因此可通过判断音频数据包的来源是否为移动终端,确定主机是否需要接收该音频数据包。If the machine is the host, then the other Bluetooth headset must be the slave. Since the slave will not send audio data packets, the audio data packets in the air at this time are sent by the mobile terminal or other device connected to the host. Therefore, it can be determined whether the host needs to receive the audio data packet by judging whether the source of the audio data packet is a mobile terminal.
如果本机为从机,那么另一个蓝牙耳机必定为主机。从机获取空气中的音频数据包,并解析音频数据包获取到齐携带的设备地址,判断该设备地址是否为主机的设备地址,进而确定是否要接收该音频数据包。由于限制了从机只接收使得主机发送的音频数据包,使得从机不会再接收除主机之外的任何设备所发送的音频数据包,进而避免了音频冲突的产生。If the machine is the slave machine, then the other Bluetooth headset must be the master machine. The slave acquires the audio data packet in the air, and parses the audio data packet to obtain the device address carried by Qi, determines whether the device address is the device address of the host computer, and then determines whether to receive the audio data packet. Since the slave is restricted to only receive the audio data packets sent by the master, the slave will not receive the audio data packets sent by any device other than the master, thereby avoiding the occurrence of audio conflicts.
图3为本发明实施例提供的另一种蓝牙耳机的主从机设置方法的流程示意图,与上一实施例不同的是,本实施例侧重于在当本机为主机、另一个蓝牙耳机为从机的情况下,在某些特定的情况下如本机的电量不足、用户把本机摘下等,需要将两个蓝牙耳机的角色进行切换,即将本机切换为从机、而另一个蓝牙耳机切换为主机。3 is a schematic flowchart of another method for setting a master and slave device of a Bluetooth headset according to an embodiment of the present invention. Different from the previous embodiment, this embodiment focuses on when the local device is the master and the other Bluetooth headset is In the case of a slave machine, in some specific situations such as the power of the machine is insufficient, the user takes the machine off, etc., it is necessary to switch the roles of the two Bluetooth headsets, that is, switch the machine to the slave machine, and the other The Bluetooth headset is switched to the host.
S301:获取本机以及另一个蓝牙耳机的设备连接状态。S301: Obtain the device connection status of the device and another Bluetooth headset.
S302:根据本机以及另一个蓝牙耳机的设备连接状态确定主机和从机。S302: Determine the master and the slave according to the device connection state of the local machine and another Bluetooth headset.
S303:根据确定结果对本机进行主机或从机的设置,并将第一设置信息发送至另一个蓝牙耳机,以指示另一个蓝牙耳机完成主机或从机的设置。S303: Set the host or the slave according to the determination result, and send the first setting information to another Bluetooth headset to instruct the other Bluetooth headset to complete the setting of the host or the slave.
本实施例中S301-S303与上一实施例中的S201-S203相同,具体请参阅上一实施例中S201-S203的相关描述,此处不赘述。S301-S303 in this embodiment are the same as S201-S203 in the previous embodiment. For details, please refer to the relevant descriptions of S201-S203 in the previous embodiment, which will not be repeated here.
在执行了步骤S303之后,还可执行以下步骤:After step S303 is performed, the following steps may also be performed:
S304:获取本机的电量以及另一个蓝牙耳机的电量。S304: Get the power of this unit and the power of another Bluetooth headset.
本机通过接收另一个蓝牙耳机发送的蓝牙数据包,可获得另一个蓝牙耳机的电量。This unit can obtain the power of another bluetooth headset by receiving the bluetooth data packet sent by another bluetooth headset.
S305:如果本机的电量小于另一个蓝牙耳机的电量、且二者的电量的差值不在预设范围之内,则将本机设置为从机,并将第二设置信息发送至另一个蓝牙耳机,以指示另一个蓝牙耳机进行主机的设置。S305: If the power of the local device is less than the power of the other Bluetooth headset, and the difference between the two powers is not within the preset range, set the local device as a slave device, and send the second setting information to the other Bluetooth headset headset to instruct another Bluetooth headset to set up the host.
其中,第二设置信息是指本机由主机切换为从机的设置信息,。Wherein, the second setting information refers to the setting information of the local machine being switched from the host machine to the slave machine.
通常来说,由于主机不仅需要跟移动终端进行通信、接收移动终端发送的音频数据包,还需要跟从机进行通信、给从机发送音频数据包,而从机只需要跟主机进行通信,因此作为主机的蓝牙耳机耗电量会更大,电量消耗速度也会更快。在检测到本机的电量降低时,可选择电量更充足的另一个耳机作为主机。Generally speaking, since the host not only needs to communicate with the mobile terminal and receive audio packets sent by the mobile terminal, but also needs to communicate with the slave and send audio packets to the slave, and the slave only needs to communicate with the host, so as a The host's Bluetooth headset will consume more power, and the power consumption will be faster. When it is detected that the power of this unit is low, another headset with more sufficient power can be selected as the host.
将本机的电量与获取到的另一个蓝牙耳机的电量进行比较,如果发现本机的电量小于另一个蓝牙耳机的电量、且二者的电量的差值超出预设范围,则可以将本机切换为从机,由电量相对更充足的另一个蓝牙耳机来作为主机。例如,如果检测到本机的电量为30%,获取到另一个蓝牙耳机的电量为40%,设定的预设范围为5%,二者的电量差值为10%,那么需要将本机从主机切换为从机。Compare the power of this unit with the acquired power of another Bluetooth headset. If it is found that the power of this unit is less than that of the other Bluetooth headset, and the difference between the two is beyond the preset range, you can set the power of this unit. Switch to slave, and use another Bluetooth headset with relatively more power as the master. For example, if it is detected that the power of the device is 30%, the power of another Bluetooth headset is 40%, the preset range is set to 5%, and the difference between the two is 10%, then the device needs to be Switch from master to slave.
当然,在检测到本机的电量小于阈值时,还可通过语音提示或闪光灯方式提醒用户对本机进行充电。Of course, when it is detected that the power of the machine is less than the threshold, the user can also be reminded to charge the machine through voice prompts or flashing lights.
通过将作为主机的本机在电量减少的情况下切换为从机,而将另一个蓝牙耳机由从机切换为主机,使得将电量充足的蓝牙耳机作为主机,能够给用户提供更好的体验。By switching the host as the host to the slave when the power is reduced, and switching the other Bluetooth headset from the slave to the host, using the Bluetooth headset with sufficient power as the host can provide users with a better experience.
可选地,在执行步骤S303之后,还可执行以下步骤:Optionally, after step S303 is performed, the following steps may also be performed:
如果检测到用户取下本机,则将本机设置为从机,并将第二设置信息发送至另一个蓝牙耳机,以指示另一个蓝牙耳机进行主机的设置。If it is detected that the user has removed the device, the device is set as a slave device, and the second setting information is sent to another Bluetooth headset to instruct the other Bluetooth headset to perform the setting of the host.
通过本机上的传感器可检测到用户是否做出取下本机的动作,如果检测到用户取下本机,则可将本机切换为从机,并将第二设置信息发送至另一个蓝牙耳机,以便于第二蓝牙耳机由从机切换为主机。The sensor on the device can detect whether the user has taken off the device. If it is detected that the user has taken off the device, the device can be switched to a slave device and the second setting information can be sent to another Bluetooth headset, so that the second Bluetooth headset can be switched from the slave to the master.
考虑到用户在摘下本机之后,由于本机仍然作为主机,会大幅度地消耗掉本机的电量,因此在检测到用户取下本机的动作时,将本机由主机切换为从机,这就能节省本机的电量。Considering that after the user takes off the device, since the device is still used as the host, the power of the device will be greatly consumed, so when the user's action of taking off the device is detected, the device will be switched from the host to the slave. , which saves the power of the unit.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本发明实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
图4是本发明一实施例提供的一种蓝牙耳机的主从机设置装置的示意图,该装置包括:获取模块41、主从机确定模块42、主从机设置模块43。其中:4 is a schematic diagram of a device for setting master and slave devices of a Bluetooth headset according to an embodiment of the present invention. The device includes: an
获取模块41,用于获取本机以及另一个蓝牙耳机的设备连接状态。The acquiring
主从机确定模块42,用于根据本机以及另一个蓝牙耳机的设备连接状态确定主机和从机。The master-
进一步地,所述主从机确定模块42可用于:如果本机以及另一个蓝牙耳机的设备连接状态均为未连接,则获取另一个蓝牙耳机的设备地址,并将另一个蓝牙耳机的设备地址与本机的设备地址进行比较,根据比较结果确定主机和从机。Further, the master-
所述主从机确定模块42还可用于:如果本机的设备连接状态为连接、且另一个蓝牙耳机的设备连接状态为未连接,则确定将本机作为主机;如果本机的设备连接状态为未连接、且另一个蓝牙耳机的设备连接状态为连接,则确定将本机作为从机。The master-
主从机设置模块43,用于根据确定结果对本机进行主机或从机的设置,并将第一设置信息发送至另一个蓝牙耳机,以指示另一个蓝牙耳机完成主机或从机的设置。The master-
可选地,所述装置还包括:电量获取模块44以及第一从机设置模块45,其中:Optionally, the device further includes: a power acquisition module 44 and a first slave setting module 45, wherein:
电量获取模块44,用于获取本机的电量以及另一个蓝牙耳机的电量;The power acquisition module 44 is used to acquire the power of the machine and the power of another Bluetooth headset;
第一从机设置模块45,用于如果本机的电量小于另一个蓝牙耳机的电量、且二者的电量的差值不在预设范围之内,则将本机设置为从机,并将第二设置信息发送至另一个蓝牙耳机,以指示另一个蓝牙耳机进行主机的设置。The first slave setting module 45 is used to set the local machine as the slave machine if the power of the local machine is less than the power of the other Bluetooth headset and the difference between the power levels of the two is not within the preset range. 2. The setting information is sent to another Bluetooth headset to instruct the other Bluetooth headset to set the host.
可选地,所述装置还包括第二从机设置模块46,用于如果检测到用户取下本机,则将本机设置为从机,并将第二设置信息发送至另一个蓝牙耳机,以指示另一个蓝牙耳机进行主机的设置。Optionally, the device further includes a second slave setting module 46 for setting the local machine as a slave machine if it is detected that the user has removed the machine, and sending the second setting information to another Bluetooth headset, to instruct another Bluetooth headset to set up the host.
图5是本发明一实施例提供的一种蓝牙耳机的示意图。如图5所示,该实施例的蓝牙耳机5包括:处理器50、存储器51以及存储在所述存储器51中并可在所述处理器50上运行的计算机程序52,例如蓝牙耳机的主从机设置程序。所述处理器50执行所述计算机程序52时实现上述各个蓝牙耳机的主从机设置的方法实施例中的步骤,例如图2所示的步骤S201至S203。或者,所述处理器50执行所述计算机程序52时实现上述各装置实施例中各模块/单元的功能,例如图4所示模块41至43的功能。FIG. 5 is a schematic diagram of a Bluetooth headset according to an embodiment of the present invention. As shown in FIG. 5, the
示例性的,所述计算机程序52可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器51中,并由所述处理器50执行,以完成本发明。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序52在所述蓝牙耳机5中的执行过程。例如,所述计算机程序52可以被分割成获取模块、主从机确定模块以及主从机设置模块,各模块具体功能如下:Exemplarily, the
获取模块,用于获取本机以及另一个蓝牙耳机的设备连接状态;The acquisition module is used to acquire the device connection status of the machine and another Bluetooth headset;
主从机确定模块,用于根据本机以及另一个蓝牙耳机的设备连接状态确定主机和从机;The master-slave determination module is used to determine the master and the slave according to the device connection status of the local machine and another Bluetooth headset;
主从机设置模块,用于根据确定结果对本机进行主机或从机的设置,并将第一设置信息发送至另一个蓝牙耳机,以指示另一个蓝牙耳机完成主机或从机的设置。The master-slave setting module is used to set the host or the slave according to the determination result, and send the first setting information to another bluetooth headset to instruct the other bluetooth headset to complete the setting of the master or the slave.
所称处理器50可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called
所述存储器51可以是所述蓝牙耳机5的内部存储单元,例如蓝牙耳机5的内存。所述存储器51用于存储所述计算机程序以及所述蓝牙耳机所需的其他程序和数据。所述存储器51还可以用于暂时地存储已经输出或者将要输出的数据。The
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the foregoing embodiments, the description of each embodiment has its own emphasis. For parts that are not described or described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
以上所述实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围,均应包含在本发明的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present invention, but not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still be used for the foregoing implementations. The technical solutions described in the examples are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the within the protection scope of the present invention.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910343805.9ACN111866822B (en) | 2019-04-26 | 2019-04-26 | Master-slave machine setting system, method and device of Bluetooth headset and Bluetooth headset |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910343805.9ACN111866822B (en) | 2019-04-26 | 2019-04-26 | Master-slave machine setting system, method and device of Bluetooth headset and Bluetooth headset |
| Publication Number | Publication Date |
|---|---|
| CN111866822Atrue CN111866822A (en) | 2020-10-30 |
| CN111866822B CN111866822B (en) | 2023-11-10 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910343805.9AActiveCN111866822B (en) | 2019-04-26 | 2019-04-26 | Master-slave machine setting system, method and device of Bluetooth headset and Bluetooth headset |
| Country | Link |
|---|---|
| CN (1) | CN111866822B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114466343A (en)* | 2022-02-10 | 2022-05-10 | 深圳海翼智新科技有限公司 | Device connection method, device, computer storage medium, and electronic device |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107708014A (en)* | 2017-11-08 | 2018-02-16 | 深圳市沃特沃德股份有限公司 | Method and device for automatically switching master-slave relation of wireless earphone and wireless earphone |
| CN109348334A (en)* | 2018-10-26 | 2019-02-15 | 歌尔科技有限公司 | A kind of wireless headset and its ambience listening method and apparatus |
| CN109660975A (en)* | 2019-01-28 | 2019-04-19 | 上海与德通讯技术有限公司 | The switching method of principal and subordinate's earphone, main earphone, from earphone and bluetooth headset network |
| CN109660906A (en)* | 2019-03-12 | 2019-04-19 | 恒玄科技(上海)有限公司 | Wireless Bluetooth headsets, wireless Bluetooth headsets master-slave swap optimization method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107708014A (en)* | 2017-11-08 | 2018-02-16 | 深圳市沃特沃德股份有限公司 | Method and device for automatically switching master-slave relation of wireless earphone and wireless earphone |
| CN109348334A (en)* | 2018-10-26 | 2019-02-15 | 歌尔科技有限公司 | A kind of wireless headset and its ambience listening method and apparatus |
| CN109660975A (en)* | 2019-01-28 | 2019-04-19 | 上海与德通讯技术有限公司 | The switching method of principal and subordinate's earphone, main earphone, from earphone and bluetooth headset network |
| CN109660906A (en)* | 2019-03-12 | 2019-04-19 | 恒玄科技(上海)有限公司 | Wireless Bluetooth headsets, wireless Bluetooth headsets master-slave swap optimization method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114466343A (en)* | 2022-02-10 | 2022-05-10 | 深圳海翼智新科技有限公司 | Device connection method, device, computer storage medium, and electronic device |
| Publication number | Publication date |
|---|---|
| CN111866822B (en) | 2023-11-10 |
| Publication | Publication Date | Title |
|---|---|---|
| JP6742465B2 (en) | Method, device and bluetooth speaker for continuous wakeup delay reduction in bluetooth speaker | |
| US11425520B2 (en) | Method for detecting blocking of microphone and related products | |
| CN111698668B (en) | Wireless communication link establishment method and electronic device supporting the method | |
| CN112534830A (en) | Two-stage role switching | |
| KR20190016802A (en) | Electronic device and method for receiving audio signal using communication configuration information of external electronic device | |
| CN108509176A (en) | Method and device for playing audio data, storage medium and intelligent terminal | |
| CN109104684B (en) | Microphone plugging detection method and related products | |
| WO2017181708A1 (en) | Audio switching method and device for terminal, and electronic device | |
| KR20200106742A (en) | Electronic device for transmitting response message in bluetooth network environment and method thereof | |
| WO2017166603A1 (en) | Sound quality adjustment method, terminal, electronic device, and non-volatile computer storage medium | |
| CN108563468B (en) | Bluetooth sound box data processing method and device and Bluetooth sound box | |
| KR20200106743A (en) | Electronic device for transmitting response message in bluetooth network environment and method thereof | |
| WO2020082387A1 (en) | Method for changing audio channel, and related device | |
| CN112732616A (en) | BMC starting method, device and equipment based on SPI controller | |
| CN104660818B (en) | Mobile terminal based audio parameter configuration method and system | |
| CN109151669B (en) | Headphone control method, device, electronic device, and storage medium | |
| CN111510902B (en) | Bluetooth device and Bluetooth state switching method and device thereof | |
| CN105679350A (en) | Audio playing method and device | |
| CN111866822B (en) | Master-slave machine setting system, method and device of Bluetooth headset and Bluetooth headset | |
| CN110213789A (en) | Bluetooth connection method, terminal device, Bluetooth device and computer storage medium | |
| CN107451067B (en) | Download test processing methods and related products | |
| CN107577567B (en) | Mainboard test circuit and related products | |
| KR20200106744A (en) | Method for sharing channel information and electronic device therefor | |
| CN106161044B (en) | Information transmission method and device | |
| CN113556830A (en) | Device connection method, device and wireless earphone |
| 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 |