Bluetooth device identification method, device, electronic device and storage medium
By analyzing and verifying multiple field data in Bluetooth broadcast signals, determining the attribute information of the device, solving the problem of quickly identifying and setting up Bluetooth devices in a multi-device environment, achieving rapid authentication and recognition, and improving efficiency and accuracy .
Patent Information
- Application Number
- CN202210200278.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-02
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2042-03-02
AI Technical Summary
When scanning multiple Bluetooth devices, how to quickly identify the set Bluetooth device is a technical challenge, and the existing technology is difficult to effectively solve this problem.
By acquiring the Bluetooth broadcast signal sent by the device, parsing and verifying the data of multiple fields to determine whether the signal is a valid Bluetooth broadcast signal, and determining the attribute information of the device based on the data, quickly authenticating and identifying the setting device.
It realizes rapid identification and authentication of the set equipment, improves efficiency, and ensures the accuracy and reliability of the identification, especially in multi-device environments.
Smart Images

Figure CN115474181B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a method, apparatus, electronic device and storage medium for identifying a Bluetooth device. Background Art
[0002] Bluetooth is a low-cost, short-range wireless communication technology. More and more devices are using Bluetooth for communication. When multiple Bluetooth devices are scanned and need to be identified and set, how to quickly identify the set Bluetooth device is a technical problem that needs to be solved. Summary of the invention
[0003] The present application proposes a Bluetooth device identification method, apparatus, electronic device and storage medium, which obtains the attribute information of the device based on the data of multiple fields in the Bluetooth broadcast signal when it is confirmed to be a valid Bluetooth broadcast signal, thereby realizing rapid authentication and identification setting of the device.
[0004] In one aspect, an embodiment of the present application provides a method for identifying a Bluetooth device, including:
[0005] Obtaining a first Bluetooth broadcast signal sent by a device;
[0006] Parsing the first Bluetooth broadcast signal to obtain data of multiple fields in the first Bluetooth broadcast signal;
[0007] Verifying the data of the plurality of fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal;
[0008] When it is determined to be a valid Bluetooth broadcast signal, attribute information of the device is determined according to the data of the plurality of fields.
[0009] In another aspect, the present application provides a Bluetooth device identification device, including:
[0010] An acquisition module, used for acquiring a first Bluetooth broadcast signal sent by a device;
[0011] A parsing module, configured to parse the first Bluetooth broadcast signal to obtain data of multiple fields in the first Bluetooth broadcast signal;
[0012] A first determination module, configured to verify the data of the plurality of fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal;
[0013] The second determination module is used to determine the attribute information of the device according to the data of the multiple fields when it is determined that the signal is a valid Bluetooth broadcast signal.
[0014] Another aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in the above aspect is implemented.
[0015] Another aspect of the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method described in the aforementioned aspect is implemented.
[0016] Another aspect of the present application provides a computer program product on which a computer program is stored. When the program is executed by a processor, the method described in the above aspect is implemented.
[0017] The Bluetooth device identification method, apparatus, electronic device and storage medium proposed in the present application obtain a first Bluetooth broadcast signal sent by a device, parse the first Bluetooth broadcast signal, obtain data of multiple fields in the first Bluetooth broadcast signal, and verify the data of the multiple fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal. If it is determined to be a valid Bluetooth broadcast signal, the attribute information of the device is determined according to the data of the multiple fields. Based on the data of the multiple fields in the Bluetooth broadcast signal, if it is confirmed to be a valid Bluetooth broadcast signal, the attribute information of the device is obtained, thereby realizing rapid authentication and identification setting of the device.
[0018] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0020] Figure 1 A schematic diagram of a flow chart of a Bluetooth device identification method provided in an embodiment of the present application;
[0021] Figure 2 A flowchart of another Bluetooth device identification method provided in an embodiment of the present application;
[0022] Figure 3 A flowchart of another Bluetooth device identification method provided in an embodiment of the present application;
[0023] Figure 4 A flowchart of another Bluetooth device identification method provided in an embodiment of the present application;
[0024] Figure 5 A schematic diagram of a Bluetooth broadcast signal format provided in an embodiment of the present application;
[0025] Figure 6 A schematic diagram of the structure of a Bluetooth device identification device provided in an embodiment of the present application;
[0026] Figure 7 A structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0028] The following describes the Bluetooth device identification method, apparatus, electronic device and storage medium according to the embodiments of the present application with reference to the accompanying drawings.
[0029] Figure 1 A flowchart of a Bluetooth device identification method provided in an embodiment of the present application.
[0030] The executor of the Bluetooth device identification method in the embodiment of the present application is a Bluetooth device identification device, which can be set in an electronic device. The electronic device can be a vehicle, a computer, a smart phone or a smart wearable device, etc., which is not limited in this embodiment.
[0031] like Figure 1 As shown, the method may include the following steps:
[0032] Step 101: Acquire a first Bluetooth broadcast signal sent by a device.
[0033] In the embodiment of the present application, the Bluetooth device identification method is described by taking the vehicle terminal in the vehicle as an example. The vehicle terminal generates a list of Bluetooth devices scanned by periodic Bluetooth broadcast signals, and the Bluetooth device list contains multiple Bluetooth devices, so that the first Bluetooth broadcast signal of each device in the Bluetooth device list can be obtained, and the processing method of the Bluetooth broadcast signal of each device is the same. Therefore, the present application takes the processing method of the Bluetooth broadcast signal of one device as an example for description. Among them, the first Bluetooth broadcast signal is the Bluetooth broadcast signal obtained by the current scan.
[0034] Among them, the first Bluetooth broadcast signal complies with the Bluetooth Special Interest Group (SIG) broadcast specification and organizes data in the AdvData format. In the embodiment of the present application, in order to save space, only AD Type=0xff is used to define the first Bluetooth broadcast signal LiBeacon for device broadcast.
[0035] Step 102: parse the first Bluetooth broadcast signal to obtain data of multiple fields in the first Bluetooth broadcast signal.
[0036] In an embodiment of the present application, the first Bluetooth broadcast signal is parsed to obtain data of multiple fields in the first Bluetooth broadcast signal, each field having a different function. The multiple fields include a field for verifying whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal, and a field for identifying attribute information of the Bluetooth device.
[0037] Step 103: verify the data of multiple fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal.
[0038] In the embodiment of the present application, by verifying the data of multiple fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal, it can be used to identify the set Bluetooth broadcast signal. For example, by determining whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal, it can be determined that the set Bluetooth broadcast signal belongs to a certain brand, that is, the Bluetooth device of the set brand can be quickly identified so that subsequent processing is only performed on the Bluetooth device of the set brand. Among them, determining whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal can be achieved by the following implementation method.
[0039] As a first possible implementation, the multiple fields include a broadcast identification field, and the identification data of the broadcast identification field is matched with the setting data. When the identification data and the setting data match, the first Bluetooth broadcast signal is determined to be a valid Bluetooth broadcast signal. For example, the setting data is a certain setting value used to indicate a certain brand or manufacturer, such as indicating the manufacturer "LX", the setting data is ox58 or ox4C, or the manufacturer's Bluetooth universal unique identifier (Universally Unique Identifier, UUID), and the setting data can occupy a set length byte, such as 2 bytes.
[0040] As a second possible implementation, multiple fields include a flag field, the value of the flag field is obtained, and the target character length is determined according to the value of the flag field. When the actual length occupied by the multiple fields matches the target character length, the first Bluetooth broadcast signal is determined to be a valid Bluetooth broadcast signal. For example, the value of the flag field indicates the target character length occupied by multiple fields of the Bluetooth broadcast signal. For example, to simplify the explanation, when the value of the flag field is 1000 and 1010, the corresponding target character length is different. Therefore, by identifying the value of the flag field, it can be determined whether the actual length occupied by the multiple fields matches the target character length to determine whether the Bluetooth signal is a valid Bluetooth signal. In this way, the set Bluetooth signal can be identified to identify a valid Bluetooth signal.
[0041] As a third implementation method, in order to improve the accuracy of Bluetooth signal recognition, verification can be performed based on multiple fields of the entire Bluetooth signal data to prevent malicious tampering or forgery of Bluetooth signals during transmission and improve the reliability of Bluetooth signal validity recognition. Among them, multiple fields include flag fields, and the flag fields include check flag fields. The value of the check flag field can be used to determine whether multiple fields contain check fields. For example, if the value of the check flag field is 1, it is determined that multiple fields contain check fields, that is, data verification is required; if the value of the check flag field is 0, it is determined that multiple fields do not contain check fields, that is, data verification is not required. Furthermore, when it is determined that multiple fields contain check fields, a first check value is generated based on the data of each field in the multiple fields except the check field, and a second check value of the check field is obtained. When the first check value and the second check value match, the Bluetooth broadcast signal is determined to be a valid Bluetooth broadcast signal. Among them, in the method for generating the check value, as an implementation method, the data in multiple fields except the check field can be calculated according to the message digest algorithm (Message-Digest Algorithm, MD5) to obtain the MD5 value, and the value of the set length in MD5, such as 0-1 bytes, is taken as the second check value, and the check field is stored, and after the vehicle terminal obtains the first Bluetooth broadcast signal, the same encryption algorithm is used to calculate the first check value. As a second implementation method, the data in multiple fields except the check field can be encrypted using the key preset in the device when leaving the factory, for example, the Cipher Block Chaining (CBC) mode in the encryption and decryption algorithm AES, or the asymmetric encryption RSA hash algorithm. The result of the encryption processing takes 0-1 bytes of data as the second check value, which is stored in the check field, and after the vehicle terminal obtains the first Bluetooth broadcast signal, the same encryption algorithm is used to calculate the first check value.
[0042] Step 104: When it is determined to be a valid Bluetooth broadcast signal, attribute information of the device is determined according to data in multiple fields.
[0043] In the embodiment of the present application, when it is determined that the Bluetooth broadcast signal broadcast by the device is a valid Bluetooth broadcast signal, the attribute information of the device can be determined according to the data of multiple fields, and then, based on the attribute information of the identified device, different controls are performed on the device. Among them, the attribute information includes the type of device, the identifier of the device, and the status of the device. The acquisition method of different attribute information will be described in detail for different embodiments, which will not be repeated here.
[0044] In the Bluetooth device identification method of the embodiment of the present application, a first Bluetooth broadcast signal sent by the device is acquired, the first Bluetooth broadcast signal is parsed, data of multiple fields in the first Bluetooth broadcast signal are obtained, and the data of the multiple fields are verified to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal. When it is determined to be a valid Bluetooth broadcast signal, attribute information of the device is determined based on the data of the multiple fields. Based on the data of the multiple fields in the Bluetooth broadcast signal, when it is confirmed to be a valid Bluetooth broadcast signal, the attribute information of the device is acquired, thereby achieving rapid authentication and identification setting of the device and improving efficiency.
[0045] Based on the above embodiments, Figure 2 A flowchart of another Bluetooth device identification method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the method comprises the following steps:
[0046] Step 201: Acquire a first Bluetooth broadcast signal sent by a device.
[0047] Step 202: parse the first Bluetooth broadcast signal to obtain data of multiple fields in the first Bluetooth broadcast signal.
[0048] The multiple fields include a device type field, which indicates the type of the device, for example, the device is a mobile phone, the device is a child seat, etc.
[0049] Step 203: verify the data of multiple fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal.
[0050] Among them, step 201 to step 203 can refer to the explanation in the above-mentioned embodiment, and the principles are the same, so they will not be repeated in this embodiment.
[0051] Step 204, matching the data in the device type field with identifiers of multiple candidate device types.
[0052] Step 205: Use the target device type matched among the multiple candidate device types as the device type of the device in the attribute information.
[0053] In the embodiment of the present application, when it is determined that the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal, the data of the device type field contained in the multiple fields is obtained, and the data in the device type field is matched with the identifiers of the multiple candidate device types to determine the target device type matched among the multiple candidate device types, and the target device type matched among the multiple candidate device types is used as the device type in the device attribute information. For example, the device type field can occupy 2 bytes and define up to 65535 device types. For example, in a vehicle, the device type can be a child seat, a mobile phone, etc., realizing the identification of multiple device types.
[0054] In the Bluetooth device identification method of the embodiment of the present application, a first Bluetooth broadcast signal sent by the device is obtained, the first Bluetooth broadcast signal is parsed, data of multiple fields in the first Bluetooth broadcast signal are obtained, and the data of the multiple fields are verified to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal. If it is determined to be a valid Bluetooth broadcast signal, the attribute information of the device is determined according to the data of the multiple fields. Based on the data of the multiple fields in the Bluetooth broadcast signal, if it is confirmed to be a valid Bluetooth broadcast signal, the device type in the attribute information of the device is obtained, thereby realizing rapid authentication and identification setting of the device.
[0055] Based on the above embodiments, Figure 3 A flowchart of another Bluetooth device identification method provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the method comprises the following steps:
[0056] Step 301: Acquire a first Bluetooth broadcast signal sent by a device.
[0057] Step 302: parse the first Bluetooth broadcast signal to obtain data of multiple fields in the first Bluetooth broadcast signal.
[0058] Among them, the multiple fields include a flag field, the flag field includes at least one sub-flag field, and at least one sub-flag field includes an identification flag field.
[0059] Step 303: verify the data of multiple fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal.
[0060] Among them, steps 301 to 303 can refer to the explanations in the aforementioned embodiments, and the principles are the same, so they will not be repeated in this embodiment.
[0061] Step 304: when the value of the identification flag field indicates that the identification field is included in the plurality of fields, obtain data of the identification field.
[0062] Step 305: Determine the device identification of the device in the attribute information according to the data in the identification field.
[0063] In an embodiment of the present application, the value of the identification flag field indicates whether the identification field is included in multiple fields. For example, if the value of the identification flag field is 1, the identification field is included in the multiple fields; if the value of the identification flag field is 0, the identification field is not included in the multiple fields. When it is determined that the identification field is included in multiple fields, the device identification in the attribute information of the device can be determined based on the data of the identification field, and the device identification is used to uniquely identify the device. For example, the data of the identification field can be the Bluetooth MAC address of the device, or the identification number of the device. Furthermore, after determining the device identification, the device can be uniquely identified. When there are multiple identical devices, when one of the multiple identical devices needs to be processed, the target device can be identified based on the device identification, thereby improving the efficiency of target device identification.
[0064] It should be understood that the device type field in the aforementioned embodiment is an inherent field among multiple fields, that is, the inherent field is set to exist, so that the device type can be obtained. Furthermore, when the value of the identification flag field contained in the flag field indicates that the identification field exists, after determining the device type, it is possible to further determine which specific device in the device type belongs to the device based on the device identification.
[0065] In the Bluetooth device identification method of the embodiment of the present application, a first Bluetooth broadcast signal sent by the device is obtained, the first Bluetooth broadcast signal is parsed, data of multiple fields in the first Bluetooth broadcast signal are obtained, and the data of the multiple fields are verified to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal. If it is determined to be a valid Bluetooth broadcast signal, attribute information of the device is determined according to the data of the multiple fields. Based on the data of the multiple fields in the Bluetooth broadcast signal, if it is confirmed to be a valid Bluetooth broadcast signal, device identification information in the attribute information of the device is obtained, thereby realizing rapid authentication and identification setting of the device.
[0066] Based on the above embodiments, the present application provides another method for identifying a Bluetooth device. Figure 4 A flowchart of another Bluetooth device identification method provided in an embodiment of the present application is shown as follows: Figure 4 As shown, the method comprises the following steps:
[0067] Step 401: Acquire a first Bluetooth broadcast signal sent by a device.
[0068] Step 402: parse the first Bluetooth broadcast signal to obtain data of multiple fields in the first Bluetooth broadcast signal.
[0069] Among them, the multiple fields included in the first Bluetooth broadcast signal include a first Bluetooth frame field and a status field. Among them, the first Bluetooth frame field is used to identify Bluetooth frame fields in different Bluetooth broadcast signals. The Bluetooth frame in the current first Bluetooth broadcast signal is called the first Bluetooth frame, and the Bluetooth frame in the second Bluetooth broadcast signal obtained before the first Bluetooth broadcast signal is called the second Bluetooth frame.
[0070] Step 403: verify the data of multiple fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal.
[0071] Among them, steps 401 to 403 can refer to the explanations in the aforementioned embodiments, and the principles are the same, so they will not be repeated in this embodiment.
[0072] Step 404: Acquire data of a first Bluetooth frame field in a first Bluetooth broadcast signal and data of a second Bluetooth frame field in a second Bluetooth broadcast signal preceding the first Bluetooth broadcast signal.
[0073] In an embodiment of the present application, the data in the first Bluetooth frame field will increase sequentially, for example, in a cyclic increase from 0 to 255. This is because the Bluetooth broadcast signal broadcast by the device may be repeated multiple times within a set duration. Therefore, the data in the first Bluetooth frame field is used to identify whether a new event has occurred, that is, whether there is a change in the device status.
[0074] Step 405: When the data in the first Bluetooth frame field and the data in the second Bluetooth frame field do not match, obtain the data in the status field.
[0075] Step 406: Determine the status information of the device in the attribute information according to the data in the status field.
[0076] In an embodiment of the present application, the data of the first Bluetooth frame field and the data of the second Bluetooth frame field are matched. If the data of the first Bluetooth frame field and the data of the second Bluetooth frame field match, it means that no new status event has occurred; if the data of the first Bluetooth frame field and the data of the second Bluetooth frame field do not match, it means that there is a new status event, so that the data of the status field of the first Bluetooth frame field can be obtained. As an implementation method, the data in the status field has a data format similar to structured data (Type-length-value, TLV), wherein the length of the T and L fields is often fixed, usually 1 to 4 bytes, the length of the V field is variable, the T field indicates the message type, the L field indicates the message length, and the V field is often used to store the content of the message. In one scenario, the data in the status field is indicated based on the data of the first Bluetooth frame field. In another scenario, in the status field, some fields are indicated based on the value in the status flag field contained in the flag field, and some fields are indicated based on the first Bluetooth frame field.
[0077] Furthermore, based on the data in the acquired status field, the status information in the device's attributes is determined. For example, if the device is a child seat and the connection status between the child seat and the vehicle has changed, the data in the first Bluetooth frame field indicates that the child seat connection status has changed. Thus, when it is determined that the Bluetooth seat status has changed, the status information can be warned on the vehicle side, or displayed on the display screen on the vehicle side to remind the user to take action.
[0078] In the Bluetooth device identification method of the embodiment of the present application, a first Bluetooth broadcast signal sent by the device is obtained, the first Bluetooth broadcast signal is parsed, data of multiple fields in the first Bluetooth broadcast signal are obtained, and the data of the multiple fields are verified to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal. When it is determined to be a valid Bluetooth broadcast signal, attribute information of the device is determined according to the data of the multiple fields. Based on the data of the multiple fields in the Bluetooth broadcast signal, when it is confirmed to be a valid Bluetooth broadcast signal, device status information in the attribute information of the device is obtained, thereby realizing rapid authentication and identification setting of the device.
[0079] Based on the above embodiments, the multiple fields parsed from the first Bluetooth broadcast signal in the embodiments of the present application may include the broadcast identification field, device type field, first Bluetooth frame field, flag field, identification field, status field and check field described in the above embodiments, so that the attribute information of the corresponding multiple devices can be obtained.
[0080] In the embodiment of the present application, a first Bluetooth broadcast signal is taken as an example for description. Figure 5 A schematic diagram of a Bluetooth broadcast signal format provided in an embodiment of the present application, such as Figure 5 As shown, the fields in the first Bluetooth broadcast signal are as follows:
[0081] Broadcast identification field: indentify, used for broadcast identification, fixed to a certain value, for example, the binary value of "LX": 0x58 0x4C, occupies 2 bytes, a required field, used to verify the validity of the Bluetooth broadcast signal;
[0082] Equipment type field: Product ID, product type id, up to 65535 products can be defined;
[0083] Flag field: flag, used to identify the format, system configuration and status information of the broadcast packet. For example, it can occupy 2 bytes. It is a required field. This field is divided into multiple subfields. The multiple subfields are as follows:
[0084] Version flag field: flag.version, used to identify the broadcast format version.
[0085] Status flag field: flag.obj, indicating whether the status information has changed.
[0086] Verification flag field: flag.enc, used to indicate whether the validity of the Bluetooth broadcast signal needs to be verified.
[0087] Identification flag field: flag.mac, whether to include the identification field;
[0088] Binding flag field: flag.reg, used to indicate whether the device has been bound;
[0089] Connection flag field: flag.gatt, used to indicate whether the device supports gatt connection;
[0090] Connection requirement flag field: flag.req_conn, used to indicate whether the device needs to be connected;
[0091] Authentication field: flag.auth, used to indicate the authentication method;
[0092] Reserved field: flag.reserve, used for extended reservation;
[0093] The first Bluetooth frame field: Seq, is the frame sequence number, which is used to indicate whether the Bluetooth broadcast signal is a repeated Bluetooth signal to achieve deduplication. The frame sequence number increases in a sequential cycle between 0-255. The Bluetooth broadcast signal of the device may be repeated multiple times within the set time. Therefore, the vehicle side needs to determine whether a new event has occurred based on the change of seq to determine whether it is a new online status report. If the seq in the current first Bluetooth broadcast signal is different from the previous one, a new process is required.
[0094] Device identification field: mac, the Bluetooth mac address of the device, used to identify a specific device, for example, occupies 6 bytes, a non-required field, and exists when the flag.mac value is 1;
[0095] Status field: object. The format of this part is similar to the tlv structure, where t occupies 2 bytes and l occupies 1 byte. Therefore, the maximum size of the vlaue part is 10 bytes. It can be expanded to 14 bytes according to the requirements of the broadcast mode. Among them, 0-10 bytes are not required fields and exist when the flag.obj value is 1.
[0096] Random number field: random: 2 bytes, non-required field, exists when flag.enc value is 1; 2-byte random number, used for anti-replay, the broadcast sender needs to recalculate the random field periodically.
[0097] Verification field: nonce, occupies 2 bytes, is a non-required field, exists when the flag.enc value is 1, and is an encrypted field used to verify the validity of the first Bluetooth broadcast signal to prevent counterfeiting.
[0098] In the embodiment of the present application, based on the first Bluetooth broadcast signal, it is also possible to identify whether the device is a connected device, a bound device, or an unbound device that needs to be bound. This enables rapid device identification, device type determination, device verification, etc. to be achieved simultaneously based on the set first Bluetooth broadcast signal, thereby meeting the needs of different application scenarios and improving the efficiency of information acquisition and processing.
[0099] In order to implement the above embodiment, the embodiment of the present application also proposes a Bluetooth device identification device.
[0100] Figure 6 A schematic diagram of the structure of a Bluetooth device identification device provided in an embodiment of the present application.
[0101] like Figure 6 As shown, the device may include:
[0102] The acquisition module 61 is used to acquire a first Bluetooth broadcast signal sent by a device.
[0103] The parsing module 62 is configured to parse the first Bluetooth broadcast signal to obtain data of multiple fields in the first Bluetooth broadcast signal.
[0104] The first determination module 63 is configured to verify the data of the plurality of fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal.
[0105] The second determination module 64 is configured to determine the attribute information of the device according to the data in the multiple fields when the signal is determined to be a valid Bluetooth broadcast signal.
[0106] Further, in an implementation of the embodiment of the present application, the multiple fields include a broadcast identification field, and the first determination module 63 is specifically configured to:
[0107] Matching the identification data and setting data of the broadcast identification field;
[0108] When the identification data and the setting data match, it is determined that the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal.
[0109] In an implementation manner of the embodiment of the present application, the multiple fields include a flag field, and the first determination module 63 is specifically configured to: obtain a value of the flag field;
[0110] Determine the target character length according to the value of the flag bit field;
[0111] In a case where the actual lengths occupied by the multiple fields match the target character length, it is determined that the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal.
[0112] In an implementation manner of the embodiment of the present application, the flag bit field includes an identification flag bit field, and the second determination module 64 is specifically configured to:
[0113] When the value of the identification flag field indicates that the multiple fields include an identification field, acquiring data of the identification field;
[0114] The device identification of the device in the attribute information is determined according to the data in the identification field.
[0115] In an implementation manner of the embodiment of the present application, the flag bit field includes a check flag bit field, and the first determination module 63 is specifically configured to:
[0116] Determining, according to a value of the check flag field, that the multiple fields include a check field;
[0117] Generate a first check value according to data of each field except the check field in the multiple fields;
[0118] Obtaining a second check value of the check field;
[0119] When the first check value matches the second check value, it is determined that the Bluetooth broadcast signal is a valid Bluetooth broadcast signal.
[0120] In an implementation of the embodiment of the present application, the second determining module 64 is specifically configured to:
[0121] Matching the data of the device type field with identifiers of multiple candidate device types;
[0122] The target device type matched among the multiple candidate device types is used as the device type of the device in the attribute information.
[0123] In an implementation manner of the embodiment of the present application, the multiple fields include a first Bluetooth frame field and a status field, and the second determination module 64 is specifically configured to:
[0124] Acquire data of a first Bluetooth frame field in the first Bluetooth broadcast signal, and data of a second Bluetooth frame field in a second Bluetooth broadcast signal before the first Bluetooth broadcast signal;
[0125] When the data of the first Bluetooth frame field does not match the data of the second Bluetooth frame field, acquiring the data of the status field;
[0126] The status information of the device in the attribute information is determined according to the data in the status field.
[0127] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment, and will not be repeated here.
[0128] In the Bluetooth device identification device of the embodiment of the present application, a first Bluetooth broadcast signal sent by the device is acquired, the first Bluetooth broadcast signal is parsed, data of multiple fields in the first Bluetooth broadcast signal are obtained, and the data of the multiple fields are verified to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal. When it is determined to be a valid Bluetooth broadcast signal, the attribute information of the device is determined according to the data of the multiple fields. Based on the data of the multiple fields in the Bluetooth broadcast signal, when it is confirmed to be a valid Bluetooth broadcast signal, the attribute information of the device is acquired, thereby realizing rapid authentication and identification setting of the device and improving efficiency.
[0129] In order to implement the above embodiments, the present application also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in the above method embodiments is implemented.
[0130] In order to implement the above embodiments, the present application also proposes a non-temporary computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in the above method embodiments is implemented.
[0131] In order to implement the above embodiments, the present application also proposes a computer program product on which a computer program is stored. When the computer program is executed by a processor, the method described in the above method embodiments is implemented.
[0132] Figure 7 A structural block diagram of an electronic device provided in an embodiment of the present application. Figure 7 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0133] like Figure 7 As shown, the electronic device 10 includes a processor 11, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 12 or a program loaded from a memory 16 to a random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 are also stored in the RAM 13. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0134] The following components are connected to the I / O interface 15: a memory 16 including a hard disk, etc.; and a communication part 17 including a network interface card such as a LAN (Local Area Network) card, a modem, etc., and the communication part 17 performs communication processing via a network such as the Internet; a drive 18 is also connected to the I / O interface 15 as needed.
[0135] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 17. When the computer program is executed by the processor 11, the above-mentioned functions defined in the method of the present application are executed.
[0136] In an exemplary embodiment, a storage medium including instructions is also provided, such as a memory 16 including instructions, and the instructions can be executed by the processor 11 of the electronic device 10 to complete the above method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0137] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0138] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0139] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0140] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0141] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0142] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0143] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0144] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A method for identifying a Bluetooth device, characterized in that: include: Obtaining a first Bluetooth broadcast signal sent by a device; Parsing the first Bluetooth broadcast signal to obtain data of multiple fields in the first Bluetooth broadcast signal; wherein the multiple fields include a flag field; Verifying the data of the multiple fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal, including: obtaining the value of the flag bit field, determining the target character length occupied by the multiple fields according to the value of the flag bit field, and determining that the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal when the actual lengths occupied by the multiple fields match the target character length; When it is determined to be a valid Bluetooth broadcast signal, attribute information of the device is determined according to the data of the plurality of fields.
2. The method according to claim 1, characterized in that The multiple fields include a broadcast identification field, and determining that the Bluetooth broadcast signal is a valid Bluetooth broadcast signal according to data in the multiple fields includes: Matching the identification data and setting data of the broadcast identification field; When the identification data and the setting data match, it is determined that the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal.
3. The method according to claim 1, characterized in that The flag bit field includes an identification flag bit field, and determining the attribute information of the device according to the data of the multiple fields includes: When the value of the identification flag field indicates that the multiple fields include an identification field, acquiring data of the identification field; The device identification of the device in the attribute information is determined according to the data in the identification field.
4. The method according to claim 1, characterized in that The flag bit field includes a check flag bit field, and determining that the Bluetooth broadcast signal is a valid Bluetooth broadcast signal according to the data of the multiple fields includes: Determining, according to a value of the check flag field, that the multiple fields include a check field; Generate a first check value according to data of each field except the check field in the multiple fields; Obtaining a second check value of the check field; When the first check value matches the second check value, it is determined that the Bluetooth broadcast signal is a valid Bluetooth broadcast signal.
5. The method according to any one of claims 1 to 4, characterized in that: The multiple fields include a device type field, and determining the attribute information of the device according to the data of the multiple fields includes: Matching the data of the device type field with identifiers of multiple candidate device types; The target device type matched among the multiple candidate device types is used as the device type of the device in the attribute information.
6. The method according to any one of claims 1 to 4, characterized in that: The multiple fields include a first Bluetooth frame field and a status field, and determining the attribute information of the device according to data of the multiple fields includes: Acquire data of a first Bluetooth frame field in the first Bluetooth broadcast signal, and data of a second Bluetooth frame field in a second Bluetooth broadcast signal before the first Bluetooth broadcast signal; When the data of the first Bluetooth frame field does not match the data of the second Bluetooth frame field, acquiring the data of the status field; The status information of the device in the attribute information is determined according to the data in the status field.
7. A Bluetooth device identification device, characterized in that: include: An acquisition module, used for acquiring a first Bluetooth broadcast signal sent by a device; A parsing module, configured to parse the first Bluetooth broadcast signal to obtain data of multiple fields in the first Bluetooth broadcast signal; wherein the multiple fields include a flag field; A first determination module is used to verify the data of the multiple fields to determine whether the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal, including: obtaining the value of the flag bit field, determining the target character length occupied by the multiple fields according to the value of the flag bit field, and determining that the first Bluetooth broadcast signal is a valid Bluetooth broadcast signal when the actual lengths occupied by the multiple fields match the target character length; The second determination module is used to determine the attribute information of the device according to the data of the multiple fields when it is determined that the signal is a valid Bluetooth broadcast signal.
8. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Apparatus and method for providing broadcast parameter message in a mobile communication system
CN101116266A
Message sending method, message receiving method and devices
CN105471478A
Bluetooth-based data communication method, storage medium and electronic equipment
CN110213758A
System, method and equipment for realizing network configuration of intelligent equipment
CN111935681A
Equipment discovery and Bluetooth broadcasting method and device, electronic equipment and storage medium
CN112105009A
