Equipment configuration method and device based on Bluetooth communication, storage medium and electronic terminal
By combining a Bluetooth mini-program with a configuration server, automated configuration and security of Bluetooth devices are achieved, solving the problem of low efficiency caused by frequent user operations in existing technologies and improving the efficiency and security of device configuration.
Patent Information
- Application Number
- CN202511273656.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2025-11-07
AI Technical Summary
The configuration process for existing Bluetooth devices involves frequent user operations, resulting in low efficiency and a lack of security.
By working with a configuration server via a Bluetooth mini-program, the device can automatically scan, authenticate, and compare configuration information, thereby achieving automation and security assurance in device configuration.
Simplify user operations, improve device configuration efficiency, and ensure data transmission security and processing speed.
Smart Images

Figure CN120916147A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of device configuration, and in particular to a device configuration method and device based on Bluetooth communication, a storage medium and an electronic terminal. BACKGROUND
[0002] Bluetooth communication has the advantages of low power consumption, high compatibility, etc., and is widely used in scenarios such as smart home, industrial Internet of Things, etc., to realize device configuration functions such as parameter configuration, firmware update, software upgrade, etc. At present, some solutions propose a solution to realize device configuration through a Bluetooth applet running on an electronic terminal. As shown in Figure 1 In the prior art, first, a user can initialize the Bluetooth applet and click a search button in the applet page after initialization is completed to instruct the electronic terminal to scan for Bluetooth devices in the vicinity and display Bluetooth device information obtained by scanning in the applet page. Then, the user can find a Bluetooth device to be connected in the applet page and click a connection button in the page to trigger the electronic terminal to establish a Bluetooth connection with the selected Bluetooth device. After the Bluetooth connection is established, the user can manually find and subscribe to Bluetooth services / Bluetooth service characteristics that can be provided by the Bluetooth device in the applet page to send data through, for example, a service characteristic such as data writing and receive data through, for example, a service characteristic such as data notification, thereby realizing data transmission between the electronic terminal and the Bluetooth device. After data transmission is completed, the user can disconnect the connection between the electronic terminal and the Bluetooth device through the applet page.
[0003] However, as can be seen from the above process, the prior art requires the user to frequently perform manual operations, which has the problem of low operation efficiency and is difficult to efficiently perform device configuration. SUMMARY
[0004] The present application aims to at least solve one of the above technical defects, in particular, the technical defect of low operation efficiency and difficulty in efficiently performing device configuration in the prior art.
[0005] In a first aspect, an embodiment of the present application provides a device configuration method based on Bluetooth communication, applied to a Bluetooth applet, the method comprising:
[0006] In response to a device configuration instruction, a data transmission channel is established with at least one Bluetooth slave device based on Bluetooth communication under the condition that a preset rule is met;
[0007] According to the device identifier of the target slave device, a first query request is sent to a configuration server; wherein the target slave device is any one of the at least one Bluetooth slave device;
[0008] if the first configuration information is received, a second query request is sent to the target slave device;
[0009] if the second configuration information is received, it is determined whether the first configuration information matches the second configuration information;
[0010] if the first configuration information does not match the second configuration information, target to-be-configured data is pushed to the target slave device according to the first configuration information, so as to instruct the target slave device to perform device configuration according to the target to-be-configured data.
[0011] In some embodiments, the first configuration information includes latest firmware information, and the second configuration information includes current firmware information.
[0012] if the first configuration information does not match the second configuration information, target to-be-configured data is pushed to the target slave device according to the first configuration information, so as to instruct the target slave device to perform device configuration according to the target to-be-configured data.
[0013] if the latest firmware information does not match the current firmware information, a target firmware download request is sent to the configuration server according to the latest firmware information;
[0014] if the target firmware is received, a firmware update instruction is pushed to the target slave device in response to the target firmware download request returned by the configuration server;
[0015] if the firmware package information is received in response to the firmware update instruction returned by the target slave device, the target firmware is packaged according to the firmware package information to obtain each firmware package, and each firmware package is used as the target to-be-configured data;
[0016] the target to-be-configured data is pushed to the target slave device.
[0017] In some embodiments, if the first configuration information does not match the second configuration information, target to-be-configured data is pushed to the target slave device according to the first configuration information, and the method further includes:
[0018] if the target firmware is not received within a preset firmware receiving time length, the connection between the Bluetooth applet and the target slave device is disconnected, and firmware download failure information is displayed.
[0019] In some embodiments, the first configuration information includes latest configuration parameters, and the second configuration information includes current configuration parameters.
[0020] if the first configuration information does not match the second configuration information, issuing target to-be-configured data according to the first configuration information to the target slave device, including:
[0021] if the latest configuration parameter does not match the current configuration parameter, taking the latest configuration parameter as the target to-be-configured data, and issuing the target to-be-configured data to the target slave device; wherein the target to-be-configured data is used to instruct the target slave device to change the local configuration parameter and return an acknowledgement message;
[0022] if the acknowledgement message is not received within a preset acknowledgement receiving duration, determining whether a first retransmission number is greater than a preset number threshold; wherein the first retransmission number is used to record a number of times of sending the latest configuration parameter;
[0023] if the first retransmission number is less than or equal to the preset number threshold, re-sending the target to-be-configured data to the configuration server, and updating the first retransmission number;
[0024] if the first retransmission number is greater than the preset number threshold, disconnecting the connection between the Bluetooth applet and the target slave device, and displaying a parameter configuration failure message.
[0025] In some embodiments, the determining step of the preset rule comprises:
[0026] obtaining user information of a user logged in the applet;
[0027] sending a permission query request to the configuration server according to the user information;
[0028] receiving a user use permission returned by the configuration server in response to the permission query request;
[0029] determining whether the user logged in the applet has configuration permission according to the user use permission;
[0030] if yes, it is determined that the preset rule is met, otherwise, it is determined that the preset rule is not met.
[0031] In some embodiments, the establishing of the data transmission channel with the at least one Bluetooth slave device based on Bluetooth communication comprises:
[0032] slave scanning based on Bluetooth communication to obtain device names of each candidate slave device;
[0033] device screening according to the device names of each candidate slave device to obtain a to-be-authenticated device; wherein the to-be-authenticated device is a candidate slave device whose device name includes a preset field;
[0034] establish a connection between the Bluetooth applet and the to-be-authenticated device based on Bluetooth communication according to a device address of the to-be-authenticated device;
[0035] write a preset authentication key in the to-be-authenticated device based on a preset Bluetooth feature identifier; wherein the authentication key is used to instruct the to-be-authenticated device to perform authentication based on the written authentication key, and return a success message and establish the data transmission channel in a case where the authentication is passed.
[0036] In some embodiments, the establishing the data transmission channel between the Bluetooth communication and the at least one Bluetooth slave device further includes:
[0037] storing and displaying a device name of the to-be-authenticated device and a device address of the to-be-authenticated device.
[0038] In a second aspect, the embodiments of the present application provide a device configuration apparatus based on Bluetooth communication, applied to a Bluetooth applet, and the apparatus includes:
[0039] a channel establishing module, configured to, in response to a device configuration instruction, establish a data transmission channel between Bluetooth communication and at least one Bluetooth slave device in a case where a preset rule is met;
[0040] a first query module, configured to send a first query request to a configuration server according to a device identifier of a target slave device; wherein the target slave device is any one of the at least one Bluetooth slave device;
[0041] a second query module, configured to, if the first configuration information returned by the configuration server in response to the first query request is received, send a second query request to the target slave device;
[0042] a matching judgment module, configured to, if the second configuration information returned by the target slave device in response to the second query request is received, judge whether the first configuration information and the second configuration information match;
[0043] a configuration module, configured to, if the first configuration information and the second configuration information do not match, issue target to-be-configured data to the target slave device according to the first configuration information, to instruct the target slave device to perform device configuration according to the target to-be-configured data.
[0044] In a third aspect, the embodiments of the present application provide a storage medium, which stores computer readable instructions, and the computer readable instructions are executed by one or more processors to make the one or more processors execute the steps of the device configuration method based on Bluetooth communication in any of the above embodiments.
[0045] In a fourth aspect, an electronic terminal is provided, which includes one or more processors and a memory.
[0046] The memory stores computer readable instructions which, when executed by the one or more processors, perform the steps of the device configuration method based on Bluetooth communication according to any of the embodiments described above.
[0047] In the device configuration method, device, storage medium and electronic terminal provided by some embodiments of the present application, the Bluetooth applet can establish a data transmission channel with at least one Bluetooth slave device. For each Bluetooth slave device for which a data transmission channel has been established, the Bluetooth applet can automatically query the configuration server for configuration information corresponding to the slave device (i.e., first configuration information) based on the device identifier of the slave device, and automatically query the local configuration information of the slave device (i.e., second configuration information). If the configuration information corresponding to the configuration server does not match the local configuration information of the Bluetooth slave device, the Bluetooth applet can automatically issue target configuration data to the slave device to make the slave device perform a device configuration operation. In this way, after receiving a device configuration instruction, the Bluetooth applet can automatically perform configuration information comparison and configuration update without the need for frequent user operation, thereby improving device configuration efficiency and achieving efficient configuration. BRIEF DESCRIPTION OF DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.
[0049] Figure 1 Device configuration interaction schematic diagram for the prior art;
[0050] Figure 2 Flowchart of the device configuration method based on Bluetooth communication in some embodiments of the present application;
[0051] Figure 3 Flowchart of the device configuration method based on Bluetooth communication in some embodiments of the present application;
[0052] Figure 4 Flowchart of the device configuration method based on Bluetooth communication in some embodiments of the present application;
[0053] Figure 5 Structure schematic diagram of the device configuration apparatus based on Bluetooth communication in some embodiments of the present application;
[0054] Figure 6 For some embodiments of the present application, the internal structure diagram of the electronic terminal. DETAILED DESCRIPTION
[0055] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0056] The technical terms involved in the present application are explained as follows:
[0057] UUID: Universally Unique Identifier, Universal Unique Identifier.
[0058] Service UUID (SERVICE UUID): used to identify a specific service provided by a Bluetooth device.
[0059] Characteristic: a Bluetooth service includes one or more characteristics. The essence of a characteristic is a data point in a service, and the read, write or notification permission can be configured. Each characteristic has a unique UUID.
[0060] Notify characteristic UUID (NOTIFY_UUID): the UUID corresponding to the notification characteristic. The notification can be enabled or disabled through the notify characteristic UUID. After the applet side subscribes to the notification characteristic, it can be determined to enable the notification, and the server can actively push data updates to the applet side.
[0061] Write characteristic UUID (WRITE_UUID): the UUID corresponding to the write characteristic. Data can be written to the service-providing device through the write characteristic UUID.
[0062] Applet: an application form that can be used without downloading and installing.
[0063] Bluetooth applet: an applet that can realize device configuration based on Bluetooth communication.
[0064] In the prior art, in addition to the technical problem of low operation efficiency mentioned in the background, there are the following defects:
[0065] (1) In the prior art, the user needs to manually click to search for a Bluetooth device, manually connect to a specific Bluetooth device, manually click to query a specific service for data transmission, manually find a subscription service for data subscription, and manually write data transmission content. As can be seen, the user's operation content in the prior art is too much, different operators have operation differences, and the quality of device configuration is affected by the state of the operator.
[0066] (2) The security of the connection between the Bluetooth applet and the Bluetooth device cannot be guaranteed, and unauthorized users can connect to the Bluetooth device through other Bluetooth applets and configure them.
[0067] To solve the above problems, the present application provides a device configuration method, device, storage device and electronic terminal based on Bluetooth communication, which combines a configuration server (i.e. platform side) and an automatic applet (i.e. applet side) to realize device configuration.
[0068] In some embodiments, the present application can obtain the login user's authority from the login user information of the Bluetooth applet, and only the login user with configuration authority can perform device configuration, thereby ensuring the security of device configuration.
[0069] In some embodiments, the present application can automatically scan, filter and connect to Bluetooth slave devices, and can automatically complete authentication, thereby establishing authenticated communication with the Bluetooth slave devices through an automatic mechanism.
[0070] In some embodiments, the present application can query the device and data of the Bluetooth slave device through a unique communication method.
[0071] In some embodiments, the present application can automatically obtain configuration information and version information from the configuration server, compare the configuration information and version information of the Bluetooth slave device with the self-configuration information and self-version information of the device, and perform automatic configuration or automatic update. The present application can perform the same automatic configuration and automatic update on multiple Bluetooth slave devices.
[0072] As can be seen, the present application not only simplifies the user's operation steps, but also improves the processing speed, data transmission security and reliability.
[0073] The device configuration method based on Bluetooth communication involved in the present application will be described in detail below.
[0074] In some embodiments, the present application provides a device configuration method based on Bluetooth communication, which can be applied to a Bluetooth applet. It can be understood that the configuration method provided by the present application can be executed by an electronic terminal capable of running a Bluetooth applet, and the electronic terminal can be, but is not limited to, various personal computers, notebook computers, laptop computers, tablet computers, smart phones and portable wearable devices, etc.
[0075] AsFigure 2 and Figure 3 As shown in FIG. 16, the device configuration method based on Bluetooth communication provided by the present application comprises the following steps:
[0076] S202: In response to the device configuration instruction, a data transmission channel is established with at least one Bluetooth slave device based on Bluetooth communication if a preset rule is met.
[0077] The device configuration instruction is an instruction for instructing the Bluetooth applet to perform a device configuration operation, which can be set according to actual conditions, and the present application does not make a specific limitation in this regard. For example, the device configuration instruction can be a successful login instruction, that is, the Bluetooth applet performs steps S202-S210 to configure the Bluetooth slave device when the successful login instruction is received. For another example, the device configuration instruction can be an instruction generated in response to a user triggering operation, for example, when it is detected that the user clicks the "configuration" button in the applet interface, the Bluetooth applet performs steps S202-S210.
[0078] The preset rule is a rule for judging whether to establish a data transmission channel with the Bluetooth slave device, and the specific rule content can be set according to actual conditions, and the present application does not make a specific limitation in this regard. The Bluetooth slave device can be a to-be-configured device set to a Bluetooth slave mode. The Bluetooth slave device can be any device, and the present application does not make a specific limitation in this regard, as long as it can support Bluetooth communication and can be configured to a Bluetooth slave mode.
[0079] In this step, if the preset rule is met when the Bluetooth applet receives the device configuration instruction, a data transmission channel can be established with at least one Bluetooth slave device based on Bluetooth communication, so that the Bluetooth applet and the Bluetooth slave device can interact with each other based on Bluetooth communication.
[0080] It can be understood that the Bluetooth applet can establish a data transmission channel with any number of Bluetooth slave devices, for example, 1, 2, 5, 8, etc., and the present application does not make a specific limitation in this regard. In some examples, if the Bluetooth applet fails to establish a data transmission channel with at least one Bluetooth slave device, a link failure message can be generated and the subsequent steps are not performed.
[0081] S204: A first query request is sent to a configuration server according to a device identifier of a target slave device; wherein the target slave device is any one of the at least one Bluetooth slave device.
[0082] The configuration server is a platform server for storing the latest configuration information corresponding to each to-be-configured device. The device identifier of the target slave device is used to uniquely identify the Bluetooth slave device, for example, it can be a device ID number.
[0083] In this step, for each Bluetooth slave device that has established a data transmission channel, the Bluetooth applet can perform device configuration according to steps S204-S310. In the process of performing device configuration, the Bluetooth applet can send a first query request to the configuration server according to the device identifier of the Bluetooth slave device, to query the latest configuration information corresponding to the Bluetooth slave device.
[0084] It can be understood that the Bluetooth applet can send the first query request by using any protocol, which is not limited in the present application. Exemplarily, the configuration server can be an HTTP (HyperText Transfer Protocol) server, and the Bluetooth applet can send the first query request to the HTTP server by using the device identifier of the target slave device.
[0085] S206: If the first configuration information returned by the configuration server in response to the first query request is received, a second query request is sent to the target slave device.
[0086] In this step, the configuration server can return the latest configuration information corresponding to the target slave device to the Bluetooth applet upon receiving the first query request, and the latest configuration information is the first configuration information described in the present application. If the Bluetooth applet receives the first configuration information returned by the configuration server, the Bluetooth applet can send a second query request to the target slave device to query the current configuration information of the target slave device.
[0087] In some examples, if the Bluetooth applet fails to receive the first configuration information returned by the configuration server within a preset time period, it can be determined that the acquisition of the latest configuration information of the target slave device fails. In this case, the Bluetooth applet can disconnect the Bluetooth connection between the Bluetooth applet and the target slave device according to the device identifier of the target slave device, and clear the slave device information stored locally by the Bluetooth applet. Further, the Bluetooth applet can also display prompt information such as “current network cannot obtain device information” and “current server has no device information” in the applet page.
[0088] It should be noted that in the case where the Bluetooth applet establishes data transmission channels with multiple Bluetooth slave devices, the Bluetooth slave devices do not affect each other. For example, in the case where the Bluetooth applet establishes data transmission channels with a first Bluetooth slave device and a second Bluetooth slave device, if the Bluetooth applet receives the first configuration information for the first Bluetooth slave device and does not receive the first configuration information for the second Bluetooth slave device, the Bluetooth applet can maintain the connection with the first Bluetooth slave device and perform subsequent steps on the first Bluetooth slave device. Moreover, the Bluetooth applet can disconnect the connection with the second Bluetooth slave device.
[0089] S208: If the second configuration information returned by the target slave device in response to the second query request is received, it is determined whether the first configuration information matches the second configuration information.
[0090] In this step, the target slave device can return the current configuration information corresponding to the target slave device to the Bluetooth applet upon receiving the second query request. The current configuration information is the second configuration information described in the present application. If the Bluetooth applet receives the second configuration information returned by the target slave device, it can compare the first configuration information corresponding to the target slave device with the second configuration information corresponding to the target slave device to determine whether the local configuration of the target slave device is consistent with the latest configuration stored in the configuration server.
[0091] In some examples, after sending the second query request, if the second configuration information returned by the target slave device is not received within a preset configuration information receiving period, the Bluetooth applet can resend the second query request to the target slave device and record the number of resending. If the number of resending of the second query request corresponding to the same target slave device exceeds a preset number threshold, for example, more than 3 times, the Bluetooth applet can actively disconnect the connection with the target slave device and display messages such as "query device parameter failed", "query device firmware information failed" and the like in the applet page.
[0092] S210: If the first configuration information does not match the second configuration information, target configuration data is issued to the target slave device according to the first configuration information to instruct the target slave device to configure the device according to the target configuration data.
[0093] In this step, if the first configuration information of the target slave device does not match the second configuration information, it indicates that the local configuration of the target slave device is not the latest configuration. In this case, the Bluetooth applet can issue target configuration data to the target slave device according to the first configuration information issued by the configuration server for the target slave device to instruct the target slave device to update the local configuration to the latest configuration.
[0094] In this way, the Bluetooth applet can automatically perform configuration information comparison and configuration update after receiving the device configuration instruction without frequent user operation, thereby improving the device configuration efficiency and realizing efficient configuration.
[0095] In some embodiments, the first configuration information includes the latest firmware information, and the second configuration information includes the current firmware information, and the current firmware information is the firmware information of the firmware configured locally by the target slave device.
[0096] If the first configuration information does not match the second configuration information, target configuration data is issued to the target slave device according to the first configuration information, including:
[0097] Step A1: If the latest firmware information does not match the current firmware information, send a target firmware download request to the configuration server according to the latest firmware information.
[0098] In this step, the Bluetooth applet can determine whether the local configuration firmware of the target slave device is the latest firmware according to the latest firmware information and the current firmware information. If the latest firmware information matches the current firmware information, it indicates that the target slave device has been configured with the latest firmware. In this case, steps A3-A7 can not be performed.
[0099] If the latest firmware information does not match the current firmware information, it indicates that the target slave device has not been configured with the latest firmware. Therefore, the Bluetooth applet can send a target firmware download request to the configuration server to attempt to download the latest firmware corresponding to the target slave device.
[0100] Step A3: If the target firmware returned by the configuration server in response to the target firmware download request is received, issue a firmware update instruction to the target slave device.
[0101] In this step, the configuration server can return the target firmware to the Bluetooth applet upon receiving the target firmware download request. The Bluetooth applet, upon receiving the target firmware, indicates that the target firmware download request is successful, and can issue a firmware update instruction to the target slave device that needs to update the firmware.
[0102] In some examples, if the target firmware is not received within a preset firmware reception duration, the Bluetooth applet can disconnect the connection between the Bluetooth applet and the target slave device, and display firmware download failure information. In this way, the target slave device can re-enter the broadcast state to facilitate device configuration by other electronic terminals or other Bluetooth applets with configuration authority, improving the automation procedure.
[0103] Step A5: If the firmware package information returned by the target slave device in response to the firmware update instruction is received, perform package processing on the target firmware according to the firmware package information to obtain each firmware package, and use each firmware package as target data to be configured.
[0104] In this step, the target slave device, upon receiving the firmware update instruction, can return firmware package information. The firmware package information reflects the reception state and network state of the target slave device, and can include any one or any combination of package offset, package size, and other information. The Bluetooth applet can perform package processing on the target firmware according to the firmware package information to split the target firmware into multiple data packets.
[0105] In some examples, if the firmware package information is not received within the preset receiving duration of the package information, the Bluetooth applet can resend the firmware update instruction to the target slave device and record the number of retransmissions. If the number of retransmissions of the firmware update instruction corresponding to the same target slave device exceeds a preset number threshold, for example, is greater than 3, the Bluetooth applet can actively disconnect the connection with the target slave device and display a message such as “firmware information query failed” in the applet page.
[0106] Step A7: issuing target to-be-configured data to the target slave device.
[0107] In this step, the Bluetooth applet can return multiple data packets to the target slave device, so that the target slave device can complete firmware upgrade based on the received multiple data packets, thereby updating its local configuration firmware to the latest firmware.
[0108] In this embodiment, by comparing the current firmware information and the latest firmware information, automatic detection and automatic update of the firmware can be realized.
[0109] In some embodiments, the first configuration information includes the latest configuration parameter, and the second configuration information includes the current configuration parameter, and the current configuration parameter is the local configuration parameter of the target slave device.
[0110] If the first configuration information and the second configuration information do not match, the target to-be-configured data is issued to the target slave device according to the first configuration information, including:
[0111] Step B1: If the latest configuration parameter and the current configuration parameter do not match, the latest configuration parameter is taken as the target to-be-configured data, and the target to-be-configured data is issued to the target slave device; wherein the target to-be-configured data is used to instruct the target slave device to change the local configuration parameter and return an acknowledgement message.
[0112] In this step, the Bluetooth applet can determine whether the local configuration parameter of the target slave device is the latest parameter according to the latest configuration parameter and the current configuration parameter. In the case where the latest configuration parameter and the current configuration parameter match, it indicates that the target slave device has been configured with the latest configuration parameter. In this case, steps B3-B7 can not be performed.
[0113] In the case where the latest configuration parameter and the current configuration parameter do not match, it indicates that the target slave device has not been configured with the latest configuration parameter, and therefore the Bluetooth applet can issue the latest configuration parameter to the target slave device. After receiving the latest configuration parameter issued by the Bluetooth applet, the target slave device updates the local configuration parameter to the latest configuration parameter and stores the latest configuration parameter. In the case where the update is completed, the target slave device can return an acknowledgement message to the Bluetooth applet.
[0114] Step B3: If the response message is not received within the preset response receiving duration, it is determined whether the first retransmission number is greater than a preset number threshold; wherein the first retransmission number is used to record the number of sending of the latest configuration parameter.
[0115] In this step, if the response of the target slave device is not received within the preset response receiving duration, it indicates that the target slave device fails to update the local configuration parameter to the latest configuration parameter. In this case, the Bluetooth applet can determine whether the retransmission operation needs to be performed according to the number of sending of the latest configuration parameter. It should be noted that different Bluetooth slave devices can correspond to different first retransmission numbers, for example, the first retransmission number corresponding to the first Bluetooth slave device is 1, and the first retransmission number corresponding to the second Bluetooth slave device is 2.
[0116] Step B5: If the first retransmission number is less than or equal to the preset number threshold, the target to-be-configured data is re-sent to the configuration server, and the first retransmission number is updated.
[0117] In this step, if the first retransmission number corresponding to the target slave device is less than or equal to the preset number threshold, the retransmission operation can be performed on the target slave device. In this case, the Bluetooth applet can re-send the target to-be-configured data to the configuration server, and increase the first retransmission number by 1, so that the first retransmission number can accurately record the number of sending of the configuration parameter corresponding to the target slave device.
[0118] Step B7: If the first retransmission number is greater than the preset number threshold, the connection between the Bluetooth applet and the target slave device is disconnected, and a parameter configuration failure message is displayed.
[0119] In this step, if the first retransmission number corresponding to the target slave device is greater than the preset number threshold, the Bluetooth applet can actively disconnect the connection between the Bluetooth applet and the target slave device, and can display a parameter configuration failure message in the applet page.
[0120] In this embodiment, by comparing the current configuration parameter and the latest configuration parameter, automatic detection and automatic update of the configuration parameter can be realized.
[0121] In some embodiments, the judgment step of the preset rule comprises:
[0122] Obtaining user information of a user logged in the applet;
[0123] Sending a permission query request to the configuration server according to the user information;
[0124] Receiving a user use permission returned by the configuration server in response to the permission query request;
[0125] According to the user use permission, it is determined whether the user logged in the applet has configuration permission;
[0126] If yes, it is determined that the preset rule is met, otherwise, it is determined that the preset rule is not met.
[0127] In this embodiment, in response to the device configuration instruction, the Bluetooth applet can obtain the use permission of the user according to the user information of the applet login user. The Bluetooth applet can determine whether the user has the configuration permission based on the user use right item of the applet login user. In the case where it is determined that the user has the configuration permission, the Bluetooth applet executes steps S202-S210 to perform device configuration on the Bluetooth slave device. If the user does not have the configuration permission, it is determined that the preset rule is not met, and in this case, the Bluetooth applet does not execute steps S202-S210. In this way, it can be prevented that others maliciously implement device configuration through the Bluetooth applet or other Bluetooth applets involved in the present application, thereby improving the security.
[0128] In some embodiments, establishing a data transmission channel with at least one Bluetooth slave device based on Bluetooth communication includes:
[0129] Performing slave scanning based on Bluetooth communication to obtain the device name of each candidate slave device;
[0130] Performing device screening according to the device name of each candidate slave device to obtain a to-be-authenticated device; wherein the to-be-authenticated device is a candidate slave device whose device name includes a preset field;
[0131] According to the device address of the to-be-authenticated device, establishing a connection between the Bluetooth applet and the to-be-authenticated device based on Bluetooth communication;
[0132] Based on the preset Bluetooth feature identifier, writing a preset authentication key in the to-be-authenticated device; wherein the authentication key is used to instruct the to-be-authenticated device to perform authentication based on the written authentication key, and return a success message and establish a data transmission channel if the authentication is passed.
[0133] In this embodiment, for the Bluetooth slave device that needs to perform automatic configuration, the device name thereof can include a preset field, so as to facilitate the Bluetooth applet to identify the to-be-configured device according to the device name. It can be understood that the field content of the preset field, the composition form of the device name, etc. can be determined according to actual conditions, and the present application does not make specific limitations thereon. In some examples, the preset field can be DWBQ, the prefix of the device name is DWBQ, and the suffix is the device identifier.
[0134] In the case where the preset rule is met, the Bluetooth applet can perform slave device scanning based on Bluetooth communication, and obtain the device name of each candidate slave device obtained by scanning. Then, the Bluetooth applet can filter and screen according to the device name of each candidate slave device, and take the candidate slave device whose device name meets the related requirements as the to-be-authenticated device.
[0135] For example, when the preset field is DWBQ, the Bluetooth applet can filter all the candidate slave devices with a device name prefix other than DWBQ, and leave each candidate slave device with a device name prefix of DWBQ as a device to be authenticated.
[0136] In some examples, after determining the device to be authenticated, the Bluetooth applet can store and display the device name of the device to be authenticated and the device address of the device to be authenticated. For example, the Bluetooth applet can store the device name prefix DWBQ and its corresponding MAC (Media Access Control) address in data, and display it on the applet page, so that the user can obtain relevant information and accurately control.
[0137] After determining the device to be authenticated, the Bluetooth applet can establish a Bluetooth connection according to the device address of the device to be authenticated and the device to be authenticated. If the connection is successful, the Bluetooth applet can write the preset authentication key in the device to be authenticated through the Bluetooth service feature based on the preset Bluetooth feature identifier. For example, the WRITE_UUID of the device to be configured is uniformly set as FFE2, and the Bluetooth applet can write the preset authentication key, such as "master2025", in the device to be authenticated through the feature with UUID FFE2.
[0138] After the device to be authenticated is written with the authentication key, the device to be authenticated can be authenticated based on the written authentication key. If the authentication is passed, the device to be authenticated can establish a data transmission channel and return a success message to the Bluetooth applet. In some examples, the Bluetooth applet can subscribe to the notification feature of the device to be authenticated to receive the message sent by the device to be authenticated through the notification feature.
[0139] In some examples, if the authentication is not passed, the device to be authenticated can automatically disconnect the connection between the electronic terminal (i.e. the Bluetooth applet). Or, after establishing the data transmission channel, the Bluetooth slave device can actively disconnect the connection with the Bluetooth applet if the Bluetooth slave device does not receive the instructions, requests or data issued by the Bluetooth applet within a preset period of time. After the Bluetooth slave device actively disconnects the connection, the Bluetooth applet can clear the currently stored device information and display a message that the device connection fails in the applet page.
[0140] In this embodiment, the Bluetooth applet can automatically perform scanning, filtering, connection and authentication, further simplifying the operation of the user, improving the processing speed and operation efficiency. And the security of device configuration can be taken into account.
[0141] In order to facilitate understanding of the scheme of the present application, a specific example is described below.
[0142] In this example, first, the Bluetooth slave device is configured as a Bluetooth slave mode, and the DWBQ is prefixed as the device name, and the device ID of the Bluetooth slave device is suffixed as the device name, as the device name of the Bluetooth slave device. And the Bluetooth slave device sets the SERVICE_UUID as FFE0, sets the NOTIFY_UUID as FFE1, sets the WRITE_UUID as FFE2, and starts the 500ms interval broadcast.
[0143] As shown in Figure 4 The device configuration method provided by the present example can include the following steps:
[0144] S402: The Bluetooth slave device is configured to broadcast every 500ms.
[0145] S404: The user logs in to the Bluetooth applet.
[0146] S406: The Bluetooth applet sends an HTTP request to the configuration server according to the user information of the applet login user. Specifically, after the user logs in to the Bluetooth applet and turns on the Bluetooth, the Bluetooth applet automatically performs an HTTP request through the user name login information to obtain the current user's use permission.
[0147] S408: The configuration server returns the user permission of the applet login user in response to the HTTP request.
[0148] S410: If the applet login user has configuration permission and has turned on the device Bluetooth, the Bluetooth applet performs 1 minute of Bluetooth slave scanning to obtain the device name of the candidate slave device.
[0149] S412: The Bluetooth applet filters the candidate slave device whose device name prefix does not contain the DWBQ field to obtain the to-be-authenticated device. Specifically, if the user has use permission and has turned on the Bluetooth function of the electronic terminal, perform 1 minute of Bluetooth slave device scanning, filter all Bluetooth devices whose Bluetooth name is not prefixed by DWBQ, and finally leave the device information with the DWBQ name prefix. The device DWBQ prefix name and its corresponding MAC address are stored and displayed on the applet page. If no Bluetooth is scanned, a refresh button is provided, and clicking the refresh button can perform 1 minute of Bluetooth slave device scanning again.
[0150] S414: The Bluetooth applet establishes a Bluetooth connection with the to-be-authenticated device.
[0151] S416: The Bluetooth slave device has been connected and is waiting for authentication. Further, if the connection fails, ④ clear the currently stored device information and display the device link failure on the interface.
[0152] S418: The Bluetooth applet writes the authentication key through the characteristic with UUID FFE2.
[0153] S420: The Bluetooth slave device authenticates through the written authentication key, if the authentication is passed, a data transmission channel is established, and a success message is returned.
[0154] S422: The Bluetooth applet receives the success message through subscribing the notification characteristic with UUID FFE1.
[0155] S424: The Bluetooth applet sends a first query request to the configuration server according to the device ID.
[0156] S426: The configuration server returns the latest firmware information and the latest configuration parameter.
[0157] S428: The Bluetooth applet sends a second query request to the Bluetooth slave device.
[0158] S430: The Bluetooth slave device returns the current firmware information and the current configuration parameter.
[0159] S432: The Bluetooth applet compares the current firmware information and the latest firmware information, and compares the current configuration parameter and the latest configuration parameter, and performs firmware update and parameter configuration. The specific implementation of this step can refer to the description of any of the above embodiments, which will not be repeated here.
[0160] In this example, the Bluetooth applet can automatically complete the scanning, filtering, linking and authentication of Bluetooth, so as to simplify the operation of the user, and further improve the processing speed. Moreover, the configuration information and the firmware information of the Bluetooth slave device can be obtained through the HTTP request server, and the configuration information and the firmware information of the device end are compared, so as to realize the automatic detection and automatic update of the configuration and the firmware. Finally, in order to prevent others from maliciously configuring the Bluetooth device end through the Bluetooth applet and other Bluetooth applets, the user authentication, the Bluetooth authentication, and the specific data transmission mode and communication protocol are established.
[0161] The device configuration apparatus based on Bluetooth communication provided by the embodiments of the present application is described below. The device configuration apparatus based on Bluetooth communication described below can be correspondingly referred to the device configuration method based on Bluetooth communication described above.
[0162] In some embodiments, the present application provides a device configuration apparatus 500 based on Bluetooth communication, applied to a Bluetooth applet. As shown in the figure, the apparatus 500 comprises: Figure 5
[0163] The channel establishing module 502 is configured to establish a data transmission channel with at least one Bluetooth slave device based on Bluetooth communication in response to a device configuration instruction, if a preset rule is met.
[0164] The first query module 504 is configured to send a first query request to a configuration server according to a device identifier of a target slave device, wherein the target slave device is any one of the at least one Bluetooth slave device.
[0165] The second query module 506 is configured to send a second query request to the target slave device, if first configuration information returned by the configuration server in response to the first query request is received.
[0166] The matching judgment module 508 is configured to judge whether the first configuration information and second configuration information are matched, if the second configuration information returned by the target slave device in response to the second query request is received.
[0167] The configuration module 510 is configured to issue target to-be-configured data to the target slave device according to the first configuration information, if the first configuration information and the second configuration information are not matched, so as to instruct the target slave device to perform device configuration according to the target to-be-configured data.
[0168] In some embodiments, the first configuration information includes latest firmware information, and the second configuration information includes current firmware information. The configuration module 510 includes:
[0169] The firmware download request sending unit is configured to send a target firmware download request to the configuration server according to the latest firmware information, if the latest firmware information and the current firmware information are not matched.
[0170] The firmware update instruction sending unit is configured to issue a firmware update instruction to the target slave device, if target firmware returned by the configuration server in response to the target firmware download request is received.
[0171] The packaging unit is configured to perform packaging processing on the target firmware according to firmware packaging information returned by the target slave device in response to the firmware update instruction, if the firmware packaging information is received, to obtain each firmware package, and take each firmware package as the target to-be-configured data.
[0172] The first data issuing unit is configured to issue the target to-be-configured data to the target slave device.
[0173] In some embodiments, the configuration module 510 further includes:
[0174] The first disconnecting unit is configured to disconnect the connection between the Bluetooth applet and the target slave device and display a firmware download failure information if the target firmware is not received within a preset firmware receiving duration.
[0175] In some embodiments, the first configuration information comprises a latest configuration parameter, and the second configuration information comprises a current configuration parameter. The configuration module 510 comprises:
[0176] The second data issuing unit is configured to issue the latest configuration parameter as the target data to be configured to the target slave device if the latest configuration parameter does not match the current configuration parameter; wherein the target data to be configured is used to instruct the target slave device to change the local configuration parameter and return an acknowledgement message.
[0177] The retransmission judging unit is configured to judge whether a first retransmission number is greater than a preset number threshold if the acknowledgement message is not received within a preset acknowledgement receiving duration; wherein the first retransmission number is used to record the number of times of sending the latest configuration parameter.
[0178] The parameter retransmission unit is configured to re-send the target data to be configured to the configuration server and update the first retransmission number if the first retransmission number is less than or equal to the preset number threshold.
[0179] The second disconnecting unit is configured to disconnect the connection between the Bluetooth applet and the target slave device and display a parameter configuration failure information if the first retransmission number is greater than the preset number threshold.
[0180] In some embodiments, the device configuration apparatus 500 based on Bluetooth communication comprises:
[0181] The information obtaining module is configured to obtain user information of a user logged in the applet;
[0182] The permission querying module is configured to send a permission query request to the configuration server according to the user information;
[0183] The permission receiving module is configured to receive a user usage permission returned by the configuration server in response to the permission query request;
[0184] The permission judging module is configured to judge whether the user logged in the applet has a configuration permission according to the user usage permission;
[0185] The rule judging module is configured to determine that the preset rule is met if the user has the configuration permission, and determine that the preset rule is not met if the user does not have the configuration permission.
[0186] In some embodiments, the channel establishing module 502 comprises:
[0187] a slave scanning unit, configured to perform slave scanning based on Bluetooth communication, to obtain a device name of each candidate slave device;
[0188] a slave screening unit, configured to perform device screening according to the device name of each candidate slave device, to obtain a to-be-authenticated device; wherein the to-be-authenticated device is a candidate slave device whose device name includes a preset field;
[0189] a connection establishing unit, configured to establish a connection between the Bluetooth applet and the to-be-authenticated device based on Bluetooth communication according to a device address of the to-be-authenticated device;
[0190] a key writing unit, configured to write a preset authentication key in the to-be-authenticated device based on a preset Bluetooth feature identifier; wherein the authentication key is used to instruct the to-be-authenticated device to perform authentication based on the written authentication key, and return a success message and establish the data transmission channel in the case of passing authentication.
[0191] In some embodiments, the channel establishing module 502 of the present application further includes:
[0192] an information storage unit, configured to store and display the device name of the to-be-authenticated device and the device address of the to-be-authenticated device.
[0193] In one embodiment, the present application further provides a storage medium, which stores computer readable instructions, and the computer readable instructions are executed by one or more processors to make the one or more processors perform the steps of the device configuration method based on Bluetooth communication in any embodiment.
[0194] In one embodiment, the present application further provides an electronic terminal, which stores computer readable instructions, and the computer readable instructions are executed by one or more processors to make the one or more processors perform the steps of the device configuration method based on Bluetooth communication in any embodiment.
[0195] Schematically, Figure 6 An internal structure schematic diagram of an electronic terminal provided by an embodiment of the present application is shown in the figure. In one example, the electronic terminal can be a server. Referring to Figure 6 , the electronic terminal 900 includes a processing component 902, which further includes one or more processors, and a memory resource represented by a memory 901, used to store instructions executable by the processing component 902, such as an application program. The application program stored in the memory 901 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 902 is configured to execute the instructions to perform the steps of the method described in any embodiment described above.
[0196] The electronic terminal 900 can further include a power supply component 903 configured to perform power management of the electronic terminal 900, a wired or wireless network interface 904 configured to connect the electronic terminal 900 to a network, and an input / output (I / O) interface 905. The electronic terminal 900 can operate based on an operating system stored in the memory 901, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or the like.
[0197] Those skilled in the art can understand that the internal structure of the electronic terminal shown in the present application is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the electronic terminal to which the scheme of the present application is applied. The specific electronic terminal can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0198] Finally, it should be noted that, in this document, the terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Also, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element. In this document, "a", "an", "said", "the" and "it" can also include plural forms, unless the context clearly indicates otherwise. A plurality means at least two, such as 2, 3, 5 or 8, etc. "And / or" includes any and all combinations of the related listed items.
[0199] The various embodiments in the specification are described in a progressive manner, each embodiment focusing on the differences from other embodiments, and the various embodiments can be combined as needed, and the same and similar parts refer to each other.
[0200] The foregoing description of the disclosed embodiments enables a person skilled in the art to make or use the application. Modifications of these embodiments will occur to persons of skill in the art, and that the generic principles defined herein can be applied to other embodiments without departing from the spirit or scope of the application. Therefore, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method of configuring a Bluetooth communication-based device, characterized by, The method is applied to a Bluetooth applet, and the method comprises: In response to a device configuration instruction, a data transmission channel is established with at least one Bluetooth slave device based on Bluetooth communication under the condition that a preset rule is met; A first query request is sent to a configuration server according to a device identifier of a target slave device, wherein the target slave device is any one of the at least one Bluetooth slave device; If first configuration information returned by the configuration server in response to the first query request is received, a second query request is sent to the target slave device; If second configuration information returned by the target slave device in response to the second query request is received, it is determined whether the first configuration information and the second configuration information match; If the first configuration information and the second configuration information do not match, target to-be-configured data is pushed to the target slave device according to the first configuration information, so as to instruct the target slave device to perform device configuration according to the target to-be-configured data.
2. The method of claim 1, wherein, The first configuration information comprises latest firmware information, and the second configuration information comprises current firmware information; If the first configuration information and the second configuration information do not match, target to-be-configured data is pushed to the target slave device according to the first configuration information, comprising: If the latest firmware information and the current firmware information do not match, a target firmware download request is sent to the configuration server according to the latest firmware information; If target firmware returned by the configuration server in response to the target firmware download request is received, a firmware update instruction is pushed to the target slave device; If firmware package information returned by the target slave device in response to the firmware update instruction is received, the target firmware is processed according to the firmware package information, to obtain each firmware package, and each firmware package is taken as the target to-be-configured data; The target to-be-configured data is pushed to the target slave device.
3. The method of claim 2, wherein, If the first configuration information and the second configuration information do not match, target to-be-configured data is pushed to the target slave device according to the first configuration information, further comprising: If the target firmware is not received within a preset firmware receiving time length, the connection between the Bluetooth applet and the target slave device is disconnected, and firmware download failure information is displayed.
4. The method of claim 1, wherein, The first configuration information comprises latest configuration parameters, and the second configuration information comprises current configuration parameters; If the first configuration information and the second configuration information do not match, target to-be-configured data is pushed to the target slave device according to the first configuration information, comprising: If the latest configuration parameters and the current configuration parameters do not match, the latest configuration parameters are taken as the target to-be-configured data, and the target to-be-configured data is pushed to the target slave device; wherein the target to-be-configured data is used to instruct the target slave device to change local configuration parameters and return a response message. If the response message is not received within the preset response receiving duration, it is determined whether a first retransmission number is greater than a preset number threshold; wherein the first retransmission number is used to record a sending number of the latest configuration parameter; If the first retransmission number is less than or equal to the preset number threshold, the target to-be-configured data is re-sent to the configuration server, and the first retransmission number is updated; If the first retransmission number is greater than the preset number threshold, the connection between the Bluetooth applet and the target slave device is disconnected, and a parameter configuration failure message is displayed.
5. The method according to any one of claims 1 to 4, characterized in that, The determination step of the preset rule comprises: Obtaining user information of a user logged in the applet; Sending an authority query request to the configuration server according to the user information; Receiving a user use authority returned by the configuration server in response to the authority query request; Determining whether the user logged in the applet has configuration authority according to the user use authority; If yes, it is determined that the preset rule is met, otherwise, it is determined that the preset rule is not met.
6. The method of claim 5, wherein, The data transmission channel is established between the Bluetooth communication and at least one Bluetooth slave device, comprising: Slave scanning based on Bluetooth communication to obtain device names of each candidate slave device; Device screening according to the device names of each candidate slave device to obtain a to-be-authenticated device; wherein the to-be-authenticated device is a candidate slave device whose device name includes a preset field; Based on Bluetooth communication, a connection between the Bluetooth applet and the to-be-authenticated device is established according to the device address of the to-be-authenticated device; Based on a preset Bluetooth feature identifier, a preset authentication key is written into the to-be-authenticated device; wherein the authentication key is used to instruct the to-be-authenticated device to perform authentication based on the written authentication key, and return a success message and establish the data transmission channel if the authentication is passed.
7. The method of claim 6, wherein, The data transmission channel is established between the Bluetooth communication and at least one Bluetooth slave device, further comprising: Storing and displaying the device name of the to-be-authenticated device and the device address of the to-be-authenticated device.
8. An apparatus for configuring a Bluetooth communication-based device, characterized by comprising: Applied to a Bluetooth applet, the device comprises: A channel establishment module for establishing a data transmission channel between Bluetooth communication and at least one Bluetooth slave device in response to a device configuration instruction if a preset rule is met; A first query module for sending a first query request to a configuration server according to a device identifier of a target slave device; wherein the target slave device is any one of the at least one Bluetooth slave device; A second query module for sending a second query request to the target slave device if first configuration information returned by the configuration server in response to the first query request is received; A matching determination module for determining whether the first configuration information and second configuration information are matched if the second configuration information returned by the target slave device in response to the second query request is received; The configuration module is configured to, if the first configuration information does not match the second configuration information, according to the first configuration information, issue target to-be-configured data to the target slave device to instruct the target slave device to perform device configuration according to the target to-be-configured data.
9. A storage medium, characterized by The storage medium has computer readable instructions stored therein, and the computer readable instructions, when executed by one or more processors, cause the one or more processors to perform the steps of the device configuration method based on Bluetooth communication according to any one of claims 1 to 7.
10. An electronic terminal, characterized in that Comprise: One or more processors, and a memory; The memory has computer readable instructions stored therein, and the computer readable instructions, when executed by the one or more processors, perform the steps of the device configuration method based on Bluetooth communication according to any one of claims 1 to 7.