Bluetooth communication method and unlocking system
Patent Information
- Application Number
- CN202410910345.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2044-07-08
AI Technical Summary
[0003]本申请的实施例提供了一种蓝牙通信方法及开锁系统,主要目的在于解决目前存在由于进行蓝牙通信的两个设备常常会存在通信处理或运行时间不同的情况,导致蓝牙通信速度变慢,造成通信超时,使得数据传输失败的问题
Smart Images

Figure CN118736710B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of lock technology, and in particular to a Bluetooth communication method and unlocking system. Background Technology
[0002] With the development of smart locks, passive electronic locks have emerged. Passive electronic locks are often used in security control scenarios. Since the use of public networks or wireless LANs is prohibited in security control scenarios, Bluetooth technology, as a short-range wireless communication technology, can be used for localized communication in such situations. For example, in factories equipped with servers involved in the operation of the power grid system, where the server is crucial to the safe operation of the power grid system and only authorized personnel can enter, passive electronic locks are often installed on the entrance doors to further enhance security. Corresponding to passive electronic locks are electronic keys. Electronic keys need to first establish a Bluetooth connection with a terminal and receive a work order from the terminal. This work order typically includes information such as the address, name, access type, and access time of the passive electronic lock. Based on this work order, power and communication are provided to the passive electronic lock. Then, lock / unlock commands can be sent to the passive smart lock; if authorized, the lock will respond to the lock / unlock command. However, in practical applications, the two devices communicating via Bluetooth often have different communication processing or running times, leading to slower Bluetooth communication speeds, communication timeouts, and data transmission failures. Summary of the Invention
[0003] The embodiments of this application provide a Bluetooth communication method and an unlocking system, the main purpose of which is to solve the problem that the Bluetooth communication speed is slowed down and communication timeouts are caused by the fact that the two devices communicating via Bluetooth often have different communication processing or running times, resulting in data transmission failure.
[0004] According to a first aspect of this application, a Bluetooth communication method is provided, applied to a Bluetooth communication module of an electronic key, comprising:
[0005] A Bluetooth connection is established with the terminal. During the process of continuously receiving Bluetooth data about lock access information transmitted by the terminal, the received Bluetooth data is continuously written into the buffer of the electronic key. The Bluetooth data includes frame data length, frame start character and frame data.
[0006] The buffer is subjected to frame start character detection. When the frame start character is detected in the buffer, the time when the frame start character is detected is determined as the frame reception start time.
[0007] The continuously written Bluetooth data is queried from the buffer at preset time intervals, and the corresponding query time is determined. Based on the frame reception start time, the query time, and the continuously written Bluetooth data, the actual frame reception duration is determined.
[0008] If it is determined that the actual frame reception duration corresponding to the current query time exceeds the preset frame reception duration, then the updated preset frame reception duration is obtained, and the preset frame reception duration is replaced by the updated preset frame reception duration, so as to receive all Bluetooth data about lock permission information within the updated preset frame reception duration. The time interval between the current query time and the frame reception start time is an integer multiple of the preset time interval.
[0009] Optionally, determining the actual frame reception duration based on the frame reception start time, the query time, and the continuously written Bluetooth data includes:
[0010] Extract the current frame data and the frame data length from the continuously written Bluetooth data;
[0011] The length of the current frame data is determined based on the current frame data, and the difference between the current frame data length and the frame data length is calculated to obtain the length of the frame data to be received.
[0012] Calculate the time interval between the query time and the frame reception start time, and calculate the ratio of the current frame data length to the time interval to obtain the reception rate;
[0013] Calculate the ratio between the length of the frame data to be received and the reception rate to obtain the remaining frame reception duration. Calculate the sum of the remaining frame reception duration and the time interval to obtain the actual frame reception duration.
[0014] Optionally, before obtaining the updated preset frame reception duration if it is determined that the actual frame reception duration corresponding to the current query time exceeds the preset frame reception duration, the method further includes:
[0015] Obtain the adjacent continuously written Bluetooth data corresponding to the previous adjacent query time, extract adjacent frame data from the adjacent continuously written Bluetooth data, and count the first byte of the adjacent frame data, wherein the time interval between the current query time and the previous adjacent query time is the preset time interval;
[0016] Determine the Bluetooth data that is currently being continuously written corresponding to the current query time, extract the current frame data from the Bluetooth data that is currently being continuously written, and count the number of the second bytes of the current data;
[0017] Calculate the difference between the second number of bytes and the first number of bytes, and calculate the ratio of the difference to the preset time interval to obtain the byte transfer rate, wherein the second number of bytes is greater than the first number of bytes;
[0018] If the byte transmission rate does not reach the transmission rate threshold, the target update preset frame reception duration is obtained, and the preset frame reception duration is replaced with the target update preset frame reception duration so as to receive all Bluetooth data about lock authorization information within the target update preset frame reception duration.
[0019] If the byte transmission rate reaches the transmission rate threshold, the actual frame reception duration corresponding to the current query time is compared with the preset frame reception duration.
[0020] Optionally, before calculating the difference between the second byte count and the first byte count, the method further includes:
[0021] When the number of the second byte is detected to be equal to the number of the first byte, it is determined that the Bluetooth connection with the terminal is interrupted, and a notification signal for indicating the Bluetooth connection interruption is generated. The notification signal is then sent to the control module of the electronic key, so that the control module controls the warning module of the electronic key to give an audible warning when it receives the notification signal.
[0022] Optionally, after replacing the preset frame reception duration with the updated preset frame reception duration, so as to receive all Bluetooth data about lock access information within the updated preset frame reception duration, the method further includes:
[0023] When it is determined that all Bluetooth data about lock access information has been received within the preset frame reception time, the final frame data is extracted from all the Bluetooth data about lock access information, and all bytes in the final frame data are summed to obtain the current check value;
[0024] A target verification value is determined. If the current verification value is inconsistent with the target verification value, it is determined that the received Bluetooth data is abnormal, and a warning signal is generated to indicate the data abnormality. The warning signal is then sent to the control module of the electronic key so that the control module controls the warning module of the electronic key to issue an audible warning when it receives the warning signal.
[0025] If the current verification value matches the target verification value, then all Bluetooth data related to lock access information is decoded to obtain lock access information in the target format.
[0026] According to a second aspect of this application, an unlocking system is provided, comprising: an electronic key with an electronic tag, a radio frequency identification device, and a terminal, wherein the electronic key includes a Bluetooth communication module and a processing module;
[0027] The radio frequency identification device is set at a preset position around the passive electronic lock. When a person holding the electronic key enters the target area, the device identifies the electronic tag of the electronic key, determines the key information of the electronic key, and obtains the electronic lock information of the passive electronic lock. The device then transmits the key information and the electronic lock information to the terminal via Bluetooth communication.
[0028] The terminal is configured to, upon receiving the key information and the electronic lock information, obtain the lock access information corresponding to the electronic lock information, convert the lock access information corresponding to the electronic lock information into Bluetooth data about the lock access information, and send the Bluetooth data to the electronic key indicated by the key information;
[0029] The Bluetooth communication module of the electronic key is used to execute the Bluetooth communication method described in any one of the first aspects when receiving the Bluetooth data, and to send the obtained lock access information in the target format to the processing module;
[0030] The processing module of the electronic key is used to generate an unlocking command based on the lock access information in the target format, and send the unlocking command to the passive electronic lock through the Bluetooth communication module, so that when the passive electronic lock receives the unlocking command, it extracts the key access information from the unlocking command and determines whether to unlock based on the key access information.
[0031] Optionally, the electronic key further includes a power supply module and a control module, wherein the control module is connected to the power supply module;
[0032] The control module is used to control the power supply module to connect and supply power to the passive electronic lock when a power supply signal is received.
[0033] Optionally, the electronic key further includes an early warning module;
[0034] The warning module is used to respond to the unlocking result, generate voice information to indicate the unlocking result, and broadcast the voice information. The unlocking result is generated and returned by the passive electronic lock when it determines that the unlocking was successful or failed.
[0035] Optionally, it may also include an identity verification device;
[0036] The identification device is located at a target position around the passive electronic lock and is used to identify the person entering the target area. When the identification result indicates that the person's identity is abnormal, a target warning signal is generated to indicate the abnormality. The target warning signal is then sent to the electronic key via Bluetooth communication so that the warning module of the electronic key can issue an audible warning based on the target warning signal.
[0037] By employing the above technical solution, this application provides a Bluetooth communication method and an unlocking system. This application enables the Bluetooth communication module to simultaneously receive Bluetooth data and write the received Bluetooth data into a buffer. This prevents blocking and data loss caused by previously received data being overwritten by later received data. Simultaneously, by querying the continuously written Bluetooth data from the buffer at preset time intervals, the actual frame reception duration for each query can be determined. Comparing this actual frame reception duration with a pre-set preset frame reception duration determines whether the preset frame reception duration needs to be reset. If so, the updated preset frame reception duration is used to replace the original preset frame reception duration. This ensures that all Bluetooth data related to lock access information is received, avoiding transmission failures. Attached Figure Description
[0038] Figure 1 A flowchart of a Bluetooth communication method provided in an embodiment of this application is shown;
[0039] Figure 2 A flowchart of another Bluetooth communication method provided in an embodiment of this application is shown;
[0040] Figure 3 This paper shows a schematic diagram of the structure of an unlocking system provided in an embodiment of the present application;
[0041] Figure 4 A schematic diagram of the structure of an electronic key for an unlocking system provided in an embodiment of this application is shown. Detailed Implementation
[0042] Various embodiments and features of this application are described herein with reference to the accompanying drawings.
[0043] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.
[0044] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0045] These and other features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.
[0046] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application.
[0047] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.
[0048] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.
[0049] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in other embodiments,” all of which may refer to one or more of the same or different embodiments according to this application.
[0050] This application provides a Bluetooth communication method applied to the Bluetooth communication module of an electronic key, such as... Figure 1 As shown, it includes:
[0051] 101. Establish a Bluetooth connection with the terminal and continuously write the received Bluetooth data about lock access information transmitted by the terminal into the buffer of the electronic key.
[0052] In this embodiment, to enable the electronic key to unlock the passive electronic lock, the electronic key needs to obtain lock access information. Specifically, the executing entity of this application is the Bluetooth communication module of the electronic key. This Bluetooth communication module can execute the Bluetooth communication method of this application. To achieve Bluetooth connection, the terminal also needs to be configured with a Bluetooth communication module. The terminal establishes a connection with the Bluetooth communication module of the electronic key through its own Bluetooth communication module, i.e., successful pairing. At this time, the terminal can transmit Bluetooth data about lock access information to the Bluetooth communication module of the electronic key. This Bluetooth data includes frame data length, frame start character, and frame data. It is important to understand that Bluetooth data transmission requires transmission time and is a continuous process. Therefore, the Bluetooth communication module's reception of Bluetooth data is also continuous. During this reception process, the received Bluetooth data is continuously written into the buffer of the electronic key. In other words, the Bluetooth communication module receives Bluetooth data while simultaneously writing the received Bluetooth data into the buffer. The purpose of temporarily storing the data in the buffer is to allow Bluetooth data to be received via interrupt, freeing the CPU or microcontroller in the Bluetooth communication module to process other programs and preventing blocking. At the same time, writing the data into the buffer also prevents previously received data from being overwritten by later received data, thus preventing data loss.
[0053] It should be noted that the Bluetooth communication module is an existing technology, which is usually composed of a Bluetooth chip, a crystal oscillator, an RF amplifier, a filter and other circuits. The Bluetooth chip is the core component of the Bluetooth communication module, mainly used to realize the wireless data transmission function. The Bluetooth chip includes a microcontroller, which can control the wireless connection of the Bluetooth chip and implement some communication protocols and related functions.
[0054] 102. Detect the start of frame character in the buffer. When the start of frame character is detected in the buffer, determine the time when the start of frame character is detected as the frame reception start time.
[0055] In this embodiment of the application, after the Bluetooth communication module writes the received Bluetooth data into the buffer, it can perform frame start character detection on the buffer. When the frame start character is detected from the buffer, it indicates that the Bluetooth data has been successfully written into the buffer. The time when the frame start character is detected can be used as the frame reception start time.
[0056] 103. At preset time intervals, query the continuously written Bluetooth data from the buffer and determine the corresponding query time. Based on the frame reception start time, query time, and continuously written Bluetooth data, determine the actual frame reception duration.
[0057] In this embodiment, since Bluetooth data is continuously transmitted, the Bluetooth communication module receives Bluetooth data while simultaneously writing it into a buffer. Therefore, the buffer can be queried at preset time intervals, for example, every 1 second to retrieve the continuously written Bluetooth data from the buffer. The time of each query can also be determined, such as 8:00:01, 8:00:02, and 8:00:03. For each query, the actual frame reception duration can be determined based on the frame reception start time, the query time, and the continuously written Bluetooth data. In other words, each query yields the corresponding actual frame reception duration.
[0058] 104. If it is determined that the actual frame reception duration corresponding to the current query time exceeds the preset frame reception duration, then obtain the updated preset frame reception duration and replace the preset frame reception duration with the updated preset frame reception duration, so as to receive all Bluetooth data about lock access information within the updated preset frame reception duration.
[0059] In this embodiment, for each query, the actual frame reception duration is compared with a preset frame reception duration, which is pre-set in the Bluetooth communication module. If the actual frame reception duration at a given query time (i.e., the current query time) exceeds the preset frame reception duration, an updated preset frame reception duration is obtained and used to replace the original preset frame reception duration. In other words, the Bluetooth communication module can reset the preset frame reception duration. This ensures that all Bluetooth data related to lock access information can be received within the updated preset frame reception duration. It should also be noted that the time interval between the current query time and the frame reception start time is an integer multiple of the preset time interval.
[0060] Furthermore, the aforementioned updated preset frame reception duration can be determined based on the frame reception start time, query time, and continuously written Bluetooth data. That is, frame data and frame data length are extracted from the continuously written Bluetooth data. Based on the frame data (including many bytes with time order), the current frame length can be determined. The time interval between the query time and the frame reception start time is calculated. The ratio of the current frame length to this time interval is calculated to obtain a transmission rate. Then, the ratio of the frame data length to the transmission rate is calculated to obtain a duration. This duration is added to a preset time interval (which can be summarized based on experience and written into the relevant program in the Bluetooth communication module) as the updated preset frame reception duration.
[0061] It should be noted that if the preset frame reception duration is reset at the current query time, it is still necessary to query the continuously written Bluetooth data from the buffer every preset time interval. Subsequently, situations may arise where the actual frame reception duration exceeds the preset frame reception duration. In this case, a new preset frame reception duration is obtained and replaced with the previously updated preset frame reception duration. This query operation is repeated until all Bluetooth data is received. In other words, by continuously querying and encountering situations where the actual frame reception duration exceeds the preset frame reception duration, resetting the preset frame reception duration can extend the data reception time of the Bluetooth communication module. This avoids the problem of slow Bluetooth communication speed causing communication timeouts and data transmission failures, as seen in existing technologies. In other words, even if the communication speed slows down, this application can ensure that all Bluetooth data is transmitted by extending the reception duration.
[0062] The method provided in this application embodiment enables the Bluetooth communication module to simultaneously receive Bluetooth data and write the received Bluetooth data into a buffer. This prevents blocking and data loss caused by previously received data being overwritten by later received data. Simultaneously, by querying the continuously written Bluetooth data from the buffer at preset time intervals, the actual frame reception duration for each query can be determined. Comparing this actual frame reception duration with a pre-set preset frame reception duration determines whether the preset frame reception duration needs to be reset. If so, the updated preset frame reception duration is used to replace the original preset frame reception duration. This ensures that all Bluetooth data related to lock access information is received, avoiding transmission failures.
[0063] Furthermore, as a refinement and extension of the specific implementation methods of the above embodiments, and to fully illustrate the specific implementation methods of this embodiment, this application provides another Bluetooth communication method, such as... Figure 2 As shown, it includes:
[0064] 201. Establish a Bluetooth connection with the terminal and continuously write the received Bluetooth data about lock access information transmitted by the terminal into the buffer of the electronic key.
[0065] 202. Detect the start of frame character in the buffer. When the start of frame character is detected in the buffer, determine the time when the start of frame character is detected as the frame reception start time.
[0066] 203. At preset time intervals, query the continuously written Bluetooth data from the buffer and determine the corresponding query time. Based on the frame reception start time, query time, and continuously written Bluetooth data, determine the actual frame reception duration.
[0067] In this embodiment, the specific method for determining the actual frame reception duration based on the frame reception start time, query time, and continuously written Bluetooth data is as follows: First, extract the current frame data and frame data length from the continuously written Bluetooth data; then, determine the current frame data length based on the current frame data, and calculate the difference between the current frame data length and the frame data length to obtain the length of the frame data to be received; subsequently, calculate the time interval between the query time and the frame reception start time, and calculate the ratio of the current frame data length to the time interval to obtain the reception rate; finally, calculate the ratio between the length of the frame data to be received and the reception rate to obtain the remaining frame reception duration, and calculate the sum of the remaining frame reception duration and the time interval to obtain the actual frame reception duration.
[0068] 204. Perform byte detection on continuously written Bluetooth data.
[0069] In this embodiment, before determining whether a timeout has occurred, the adjacent continuously written Bluetooth data corresponding to the previous adjacent query time can be obtained first. Adjacent frame data is extracted from the adjacent continuously written Bluetooth data, and the first byte count of the adjacent frame data is counted. It should be noted that the time interval between the current query time and the previous adjacent query time is a preset time interval. Then, the currently continuously written Bluetooth data corresponding to the current query time is determined, and the current frame data is extracted from the currently continuously written Bluetooth data. The second byte count of the current data is counted. Next, the difference between the second byte count and the first byte count is calculated, and the ratio of the difference to the preset time interval is calculated to obtain the byte transmission rate. It should be noted that the second byte count is greater than the first byte count. If the byte transmission rate does not reach the transmission rate threshold, the target update preset frame reception duration is obtained, and the preset frame reception duration is replaced with the target update preset frame reception duration to receive all Bluetooth data related to lock authorization information within the target update preset frame reception duration. If the byte transmission rate reaches the transmission rate threshold, the actual frame reception duration corresponding to the current query time is compared with the preset frame reception duration.
[0070] Furthermore, before calculating the difference between the second byte count and the first byte count, it can be determined whether the second byte count and the first byte count are equal. For example, at 8:00:01, the first byte count is 20, and at 8:00:02, the second byte count is still 20. When the second byte count is detected to be equal to the first byte count, it indicates that Bluetooth data has not arrived. In practical applications, Bluetooth data is transmitted in the form of Bluetooth packets. At this time, it can be determined that the Bluetooth connection with the terminal is interrupted, and a notification signal to indicate the Bluetooth connection interruption is generated. The notification signal is sent to the control module of the electronic key so that when the control module receives the notification signal, it controls the warning module of the electronic key to issue an audible warning, such as broadcasting a message that the Bluetooth connection is interrupted and troubleshooting is required.
[0071] 205. If it is determined that the actual frame reception duration corresponding to the current query time exceeds the preset frame reception duration, then obtain the updated preset frame reception duration and replace the preset frame reception duration with the updated preset frame reception duration, so as to receive all Bluetooth data about lock access information within the updated preset frame reception duration.
[0072] 206. Verify all received Bluetooth data regarding lock access information.
[0073] In this embodiment, when it is determined that all Bluetooth data concerning lock access information has been received within the preset frame reception time, the final frame data can be extracted from all the Bluetooth data concerning lock access information. All bytes in the final frame data are summed to obtain the current verification value. Then, a target verification value is determined. If the current verification value is inconsistent with the target verification value, it is determined that the received Bluetooth data is abnormal, and a warning signal indicating the data abnormality is generated and sent to the control module of the electronic key. Upon receiving the warning signal, the control module controls the warning module of the electronic key to issue an audible warning. If the current verification value is consistent with the target verification value, all Bluetooth data concerning lock access information is decoded to obtain the lock access information in the target format.
[0074] It should be noted that a checksum byte can be added to the end of the data frame. This means the terminal calculates the target checksum value for the entire frame's data field using a pre-defined checksum algorithm, obtains the checksum byte information based on the target checksum, and adds this checksum byte information to the end of the data frame. In other words, the Bluetooth data sent by the terminal will carry a checksum byte information about the target checksum at the end of the data frame. The Bluetooth communication module can extract the target checksum from this after receiving all the Bluetooth data. In practical applications, algorithms such as CRC checksum can also be used to determine the target checksum. It should be noted that the Bluetooth communication module should use the same algorithm as the terminal.
[0075] The method provided in this application embodiment enables the Bluetooth communication module to simultaneously receive Bluetooth data and write the received Bluetooth data into a buffer. This prevents blocking and data loss caused by previously received data being overwritten by later received data. Simultaneously, by querying the continuously written Bluetooth data from the buffer at preset time intervals, the actual frame reception duration for each query can be determined. Comparing this actual frame reception duration with a pre-set preset frame reception duration determines whether the preset frame reception duration needs to be reset. If so, the updated preset frame reception duration is used to replace the original preset frame reception duration. This ensures that all Bluetooth data related to lock access information is received, avoiding transmission failures.
[0076] Furthermore, the locking process is the same as described above, and will not be elaborated on here.
[0077] Furthermore, embodiments of this application provide a locking system, such as... Figure 3 As shown, it includes: an electronic key with an electronic tag, a radio frequency identification device, and a terminal, wherein the electronic key includes a Bluetooth communication module and a processing module;
[0078] The radio frequency identification device is set at a preset position around the passive electronic lock. When a person holding an electronic key enters the target area, the device identifies the electronic tag of the electronic key, determines the key information of the electronic key, and obtains the electronic lock information of the passive electronic lock. The key information and electronic lock information are then transmitted to the terminal via Bluetooth communication.
[0079] The terminal is used to obtain the lock access information corresponding to the electronic lock information when it receives key information and electronic lock information, convert the lock access information corresponding to the electronic lock information into Bluetooth data about the lock access information, and send the Bluetooth data to the electronic key indicated by the key information;
[0080] The Bluetooth communication module of the electronic key is used to execute the Bluetooth communication method upon receiving Bluetooth data and send the obtained lock access information in the target format to the processing module.
[0081] The electronic key processing module is used to generate an unlocking command based on the lock access information in the target format, and send the unlocking command to the passive electronic lock via the Bluetooth communication module. When the passive electronic lock receives the unlocking command, it extracts the key access information from the unlocking command and determines whether to unlock based on the key access information.
[0082] It should be noted that the unlocking command is encrypted. After receiving the unlocking command, the passive smart lock first decrypts the command information and checks whether there is operation permission. If there is permission, the lock drives the movement mechanism to open the lock; otherwise, it does not perform the operation and returns a failure signal.
[0083] It should also be noted that an RFID device consists of a reader and a data management system. This can be understood as the electronic tag, reader, and data management system together forming an RFID system. The reader, also called a reader, is mainly used to read information from the electronic tag or write the required information to the tag. The data management system's main function is to process and parse the electronic tag data transmitted from the reader, while also fulfilling the functions required by the user. The electronic tag is mainly used to store certain data information, and it also receives signals from the reader and sends the requested data back to the reader. Electronic tags are generally affixed or fixedly installed on items.
[0084] Specifically, such as Figure 4As shown, the electronic key includes a Bluetooth communication module, a processing module, a control module, a power supply module, and an early warning module, in addition to these. The control module can connect to the power supply module. When the control module receives a power supply signal, it controls the power supply module to supply power to the passive electronic lock. The early warning module can respond to the unlocking result, generate voice information indicating the unlocking result, and broadcast the voice information. It should be noted that the unlocking result is generated and returned by the passive electronic lock when it determines whether unlocking was successful or failed, and is directly returned to the Bluetooth communication module. The Bluetooth communication module then sends the unlocking result to the early warning module. This power supply signal can be generated when the user triggers the power switch of the electronic key, or it can be generated when the Bluetooth communication module finishes receiving Bluetooth data.
[0085] It should be noted that the passive electronic lock is normally in a passive and inactive state. It includes a wireless carrier power supply communication unit. When the power supply module included in the electronic key interacts wirelessly with the wireless carrier power supply communication unit, the wireless carrier power supply communication unit can use the power supply module to supply power to the passive electronic lock, thereby enabling the passive electronic lock to start working. This kind of power supply between the electronic key and the passive electronic lock is existing technology. At the same time, passive electronic locks, such as electrical coding locks, are also existing technology and can be easily obtained by those skilled in the art, so they will not be described in detail here.
[0086] Specifically, such as Figure 3 As shown, the unlocking system also includes an identity recognition device, which is positioned at a target location around the passive electronic lock. This device identifies individuals entering the target area and determines their identity. If the identification result indicates an abnormal identity, a target warning signal is generated and sent to the electronic key via Bluetooth. The electronic key's Bluetooth communication module then transmits this warning signal to its own warning module. Based on the warning signal, the warning module generates and broadcasts a voice message, thus informing the person holding the electronic key that they are not authorized to unlock the lock. It should be noted that a Bluetooth communication module is required within the identity recognition device for Bluetooth communication; both sending and receiving data must be done through this module. In other words, the identity recognition device can determine whether individuals entering the target area are on a whitelist. For those not on the whitelist, a timely announcement is made, further enhancing unlocking security.
[0087] It should be noted that the identity recognition device is preferably a face recognition device. The facial images of people on the whitelist are pre-collected. To avoid network access and increase security, the relevant information can be directly stored in the storage module of the face recognition device. The image acquisition module of the face recognition device can capture facial images, and then the image recognition module performs image recognition to identify identity information. Then, the processing module can determine the recognition result based on the whitelist. It should be noted that the image recognition algorithm in the image recognition module is a pre-trained optimal algorithm that can be used directly.
[0088] The system provided in this application embodiment can automatically identify the electronic tag on the electronic key through a radio frequency identification (RFID) device, thereby obtaining the key information of the electronic key. Simultaneously, since each RFID device corresponds to a passive electronic lock, the electronic lock information of the passive electronic lock is pre-set in the RFID device. Therefore, the electronic lock information of the passive electronic lock can be directly obtained, and the key information and electronic lock information are sent to the terminal via Bluetooth communication. The terminal can obtain the lock access information corresponding to the electronic lock information and send it directly to the electronic key indicated by the key information via Bluetooth communication without communication failure. Ultimately, the target format lock access information is obtained. The electronic key supplies power to the passive electronic lock, and then generates an unlocking command based on the target format lock access information, sending it to the passive electronic lock via Bluetooth communication. When the passive electronic lock receives the unlocking command, it extracts the key access information from the unlocking command and determines whether to unlock based on the key access information. This unlocking process is completed automatically, greatly improving unlocking efficiency.
[0089] The serial numbers in this application are for descriptive purposes only and do not represent the superiority or inferiority of the implementation scenario.
[0090] The above embodiments are merely exemplary embodiments of this application and are not intended to limit this application. The scope of protection of this application is defined by the claims. Those skilled in the art can make various modifications or equivalent substitutions to this application within its substance and scope of protection, and such modifications or equivalent substitutions should also be considered to fall within the scope of protection of this application.
Claims
1. A Bluetooth communication method, applied to the Bluetooth communication module of an electronic key, characterized in that, include: A Bluetooth connection is established with the terminal. During the process of continuously receiving Bluetooth data about lock access information transmitted by the terminal, the received Bluetooth data is continuously written into the buffer of the electronic key. The Bluetooth data includes frame data length, frame start character and frame data. The buffer is subjected to frame start character detection. When the frame start character is detected in the buffer, the time when the frame start character is detected is determined as the frame reception start time. The continuously written Bluetooth data is queried from the buffer at preset time intervals, and the corresponding query time is determined. Based on the frame reception start time, the query time, and the continuously written Bluetooth data, the actual frame reception duration is determined. If it is determined that the actual frame reception duration corresponding to the current query time exceeds the preset frame reception duration, then the updated preset frame reception duration is obtained, and the preset frame reception duration is replaced by the updated preset frame reception duration, so as to receive all Bluetooth data about lock permission information within the updated preset frame reception duration. The time interval between the current query time and the frame reception start time is an integer multiple of the preset time interval.
2. The Bluetooth communication method according to claim 1, characterized in that, The determination of the actual frame reception duration based on the frame reception start time, the query time, and the continuously written Bluetooth data includes: Extract the current frame data and the frame data length from the continuously written Bluetooth data; The length of the current frame data is determined based on the current frame data, and the difference between the current frame data length and the frame data length is calculated to obtain the length of the frame data to be received. Calculate the time interval between the query time and the frame reception start time, and calculate the ratio of the current frame data length to the time interval to obtain the reception rate; Calculate the ratio between the length of the frame data to be received and the reception rate to obtain the remaining frame reception duration. Calculate the sum of the remaining frame reception duration and the time interval to obtain the actual frame reception duration.
3. The Bluetooth communication method according to claim 1, characterized in that, If it is determined that the actual frame reception duration corresponding to the current query time exceeds the preset frame reception duration, before obtaining the updated preset frame reception duration, the process further includes: Obtain the adjacent continuously written Bluetooth data corresponding to the previous adjacent query time, extract adjacent frame data from the adjacent continuously written Bluetooth data, and count the first byte of the adjacent frame data, wherein the time interval between the current query time and the previous adjacent query time is the preset time interval; Determine the Bluetooth data that is currently being continuously written corresponding to the current query time, extract the current frame data from the Bluetooth data that is currently being continuously written, and count the number of the second bytes of the current frame data; Calculate the difference between the second number of bytes and the first number of bytes, and calculate the ratio of the difference to the preset time interval to obtain the byte transfer rate, wherein the second number of bytes is greater than the first number of bytes; If the byte transmission rate does not reach the transmission rate threshold, the target update preset frame reception duration is obtained, and the preset frame reception duration is replaced with the target update preset frame reception duration so as to receive all Bluetooth data about lock authorization information within the target update preset frame reception duration. If the byte transmission rate reaches the transmission rate threshold, the actual frame reception duration corresponding to the current query time is compared with the preset frame reception duration.
4. The Bluetooth communication method according to claim 3, characterized in that, Before calculating the difference between the second byte count and the first byte count, the method further includes: When the number of the second byte is detected to be equal to the number of the first byte, it is determined that the Bluetooth connection with the terminal is interrupted, and a notification signal for indicating the Bluetooth connection interruption is generated. The notification signal is then sent to the control module of the electronic key, so that the control module controls the warning module of the electronic key to give an audible warning when it receives the notification signal.
5. The Bluetooth communication method according to claim 1, characterized in that, The step of replacing the preset frame reception duration with the updated preset frame reception duration, so as to receive all Bluetooth data about lock access information within the updated preset frame reception duration, further includes: When it is determined that all Bluetooth data about lock access information has been received within the preset frame reception time, the final frame data is extracted from all the Bluetooth data about lock access information, and all bytes in the final frame data are summed to obtain the current check value; A target verification value is determined. If the current verification value is inconsistent with the target verification value, it is determined that the received Bluetooth data is abnormal, and a warning signal is generated to indicate the data abnormality. The warning signal is then sent to the control module of the electronic key so that the control module controls the warning module of the electronic key to issue an audible warning when it receives the warning signal. If the current verification value matches the target verification value, then all Bluetooth data related to lock access information is decoded to obtain lock access information in the target format.
6. A locking system, characterized in that, include: An electronic key, a radio frequency identification device, and a terminal equipped with an electronic tag, wherein the electronic key includes a Bluetooth communication module and a processing module; The radio frequency identification device is set at a preset position around the passive electronic lock. When a person holding the electronic key enters the target area, the device identifies the electronic tag of the electronic key, determines the key information of the electronic key, and obtains the electronic lock information of the passive electronic lock. The device then transmits the key information and the electronic lock information to the terminal via Bluetooth communication. The terminal is configured to, upon receiving the key information and the electronic lock information, obtain the lock access information corresponding to the electronic lock information, convert the lock access information corresponding to the electronic lock information into Bluetooth data about the lock access information, and send the Bluetooth data to the electronic key indicated by the key information; The Bluetooth communication module of the electronic key is used to execute the Bluetooth communication method according to any one of claims 1 to 5 when receiving the Bluetooth data, and send the obtained lock access information in the target format to the processing module; The processing module of the electronic key is used to generate an unlocking command based on the lock access information in the target format, and send the unlocking command to the passive electronic lock through the Bluetooth communication module, so that when the passive electronic lock receives the unlocking command, it extracts the key access information from the unlocking command and determines whether to unlock based on the key access information.
7. The unlocking system according to claim 6, characterized in that, The electronic key also includes a power supply module and a control module, with the control module connected to the power supply module; The control module is used to control the power supply module to connect and supply power to the passive electronic lock when a power supply signal is received.
8. The unlocking system according to claim 6, characterized in that, The electronic key also includes an early warning module; The warning module is used to respond to the unlocking result, generate voice information to indicate the unlocking result, and broadcast the voice information. The unlocking result is generated and returned by the passive electronic lock when it determines that the unlocking was successful or failed.
9. The unlocking system according to claim 8, characterized in that, It also includes an identity verification device; The identification device is located at a target position around the passive electronic lock and is used to identify the person entering the target area. When the identification result indicates that the person's identity is abnormal, a target warning signal is generated to indicate the abnormality. The target warning signal is then sent to the electronic key via Bluetooth communication so that the warning module of the electronic key can issue an audible warning based on the target warning signal.
Citation Information
Patent Citations
Remote-authorization unlocking method of passive labeled electronic lock
CN104112306A
Passive intelligent lock cylinder system and implementation method thereof
CN106296922A