Functional safety communication method for Bluetooth scanner
By dynamically determining the working mode of the Bluetooth scanner and initializing the data transmission protocol, the problem that Bluetooth scanners in the prior art cannot flexibly respond to the configuration needs of diversified user equipment, and achieve efficient and secure data transmission and compatibility optimization.
Patent Information
- Application Number
- CN202510426707.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-06-24
AI Technical Summary
Existing Bluetooth scanners cannot respond flexibly when facing the needs of diversified user equipment configuration, and the security and stability of data transmission are difficult to ensure, resulting in limited communication efficiency.
Ensure the flexibility and security of the communication process by dynamically determining the operating mode of the scanner and initializing the data transmission protocol based on the operating mode. This method includes Bluetooth pairing, decoded data transmission and connection mode processing, and supports three working modes: HID, SPP and BLE.
It realizes efficient and secure data transmission, improves the adaptability and reliability of Bluetooth scanners, and meets the security and compatibility needs of different scenarios.
Smart Images

Figure CN120201400A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of communication control, and particularly to a functional safety communication method for a Bluetooth scanner. Background Art
[0002] With the development of the Internet of Things technology, as an efficient data acquisition device, the Bluetooth scanner is widely used in fields such as logistics, retail, and warehousing. The Bluetooth scanner pairs with the master device through Bluetooth and transmits data to achieve wireless operation.
[0003] Most of the existing Bluetooth scanners are based on fixed transmission protocols and communication modes, and cannot flexibly meet the diverse configuration requirements of user devices. In addition, the security and stability of data transmission are also difficult to be effectively guaranteed in complex application scenarios. The working mode of the Bluetooth scanner has a low matching degree with the actual configuration of the user's master device, resulting in limited communication efficiency, lack of flexibility in initializing the data transmission protocol, and difficulty in meeting the security and compatibility requirements of different scenarios. In the existing solutions, there is insufficient optimization for communication stability and data encapsulation during the data decoding and transmission process.
[0004] Therefore, the present invention provides a functional safety communication method for a Bluetooth scanner. Summary of the Invention
[0005] The present invention provides a functional safety communication method for a Bluetooth scanner, which is used to dynamically determine the working mode of the scanner according to user requirements, and initialize the data transmission protocol based on the working mode to ensure the flexibility and security of the communication process. By combining Bluetooth pairing, decoded data transmission, and connection mode processing, efficient and secure data transmission and compatibility optimization are achieved, and the adaptability and reliability of the Bluetooth scanner are improved.
[0006] The present invention provides a functional safety communication method for a Bluetooth scanner, including:
[0007] Step 1: Activate the scanner, enter the Bluetooth pairing mode to wait for pairing, and then perform Bluetooth pairing based on a preset method;
[0008] Step 2: Obtain user requirements and the configuration data of the user's master device, and then determine the working mode of the scanner;
[0009] Step 3: Initialize the corresponding data transmission protocol based on the working mode of the scanner;
[0010] Step 4: When the user presses the scan button to trigger a scanning action, the scanning head decodes the data, and transmits the decoded data to the main board through the serial port based on the initialized data transmission protocol;
[0011] Step 5: Obtain the connection mode of the scanner, and the main board processes and encapsulates data based on the connection mode of the scanner.
[0012] The present invention provides a functional safety communication method for a Bluetooth scanner. The connection modes of the scanner include: connected mode and unconnected mode.
[0013] The present invention provides a functional safety communication method for a Bluetooth scanner. The working modes of the scanner include: HID mode, SPP mode, and BLE mode.
[0014] The present invention provides a functional safety communication method for a Bluetooth scanner. Activate the scanner and enter the Bluetooth pairing mode to wait for pairing, and then perform Bluetooth pairing based on a preset method, including:
[0015] After the scanner is powered on, start the core module of the scanner, where the core module includes: a main board, a scanning head, a Bluetooth module, and a storage module;
[0016] Initialize the Bluetooth module based on a preset initialization method and enter the broadcast mode, and then send out Bluetooth signals to surrounding devices to wait for a Bluetooth pairing request from the user's master device;
[0017] Obtain the device information of the user's master device and analyze it, and then determine the preset pairing method of the user's master device;
[0018] Pair the user's master device and the scanner based on the preset pairing method. After the pairing is completed, generate a session key through a preset encryption method.
[0019] The present invention provides a functional safety communication method for a Bluetooth scanner. Obtain the user requirements and the configuration data of the user's master device, and then determine the working mode of the scanner, including:
[0020] Obtain the user requirements and analyze them to determine the relevant parameters of the user requirements;
[0021] Analyze the configuration data of the user's master device to determine the relevant parameters of the user's master device configuration;
[0022] Determine the working coefficient of the scanner based on the relevant parameters of the user requirements and the relevant parameters of the user's master device configuration:
[0023]
[0024] Where, W is the working coefficient of the scanner, U i is the demand value of the i-th user requirement, γ i is the preset adjustment coefficient of the i-th user requirement, w iis the weight of the i-th user requirement, n1 is the total number of user requirements, α1 is the weight of user requirements, α2 is the weight of user device configuration, M j is the value of the j-th user main device configuration item, w j is the weight of the j-th user main device configuration item, M k is the value of the k-th user main device configuration item, γ ij is the interaction coefficient between the j-th user main device configuration item and the k-th user main device configuration item, and j≠k, n2 is the number of user main device configuration items, α3 is the weight of the communication requirement of the user main device, where C is the communication requirement value of the user main device:
[0025]
[0026] r is the real-time requirement value of the user main device, β1 is the sensitivity coefficient of the preset real-time requirement, ∝r is the preset conversion coefficient of the real-time requirement value of the user main device, r0 is the preset reference value of the real-time requirement of the user main device, b is the bandwidth requirement value of the user main device, β2 is the sensitivity coefficient of the preset bandwidth requirement, ∝b is the preset conversion coefficient of the bandwidth requirement value of the user main device, d is the data integrity requirement value of the user main device, ∝d is the conversion coefficient of the data integrity requirement of the user main device, min() is the minimum value function;
[0027] Determine the working mode of the scanner based on the working coefficient of the scanner and the preset coefficient-mode data table.
[0028] The present invention provides a functional safety communication method for a Bluetooth scanner. When the user presses the scan button to trigger the scanning action, the scanning head decodes the data and transmits it to the main board through the serial port based on the initialized data transmission protocol, including:
[0029] After the user presses the scan button, the scanning head immediately enables the scanning function, scans the target code, and collects the original image data;
[0030] Process the collected image data based on the preset decoding algorithm in the scanning head to determine the encoding information of the target code;
[0031] Convert the encoding information of the target code into the first character data in the preset format based on the preset conversion method;
[0032] Perform preset formatting processing on the first character data to generate the second character data;
[0033] Obtain the data encapsulation format corresponding to the initialized communication protocol based on the initialized communication protocol and the preset protocol-format database;
[0034] Encapsulate the second character data based on the data encapsulation format corresponding to the initialized communication protocol, and then obtain the third character data;
[0035] Transmit the third character data through the preset serial port interface of the Bluetooth module based on the initialized communication protocol and send it to the main board.
[0036] The present invention provides a functional safety communication method for a Bluetooth scanner. Transmitting the third character data through the preset serial port interface of the Bluetooth module based on the initialized data transmission protocol includes:
[0037] Determine the segmentation size of the data packet based on the initialized data protocol, and then segment the third character data into several first data packets based on the preset segmentation method;
[0038] Encrypt and compress each data packet based on the initialized data protocol to obtain several second data packets;
[0039] Determine the transmission rules during the transmission process based on the initialized data protocol;
[0040] Store all unsent second data packets in a preset buffer;
[0041] Analyze all second data packets to determine the sending priority of each second data packet;
[0042] Determine the sending rules of the second data packets in the preset buffer based on the initialized data protocol;
[0043] Transmit all second data packets through the preset serial port interface of the Bluetooth module based on the transmission rules during the transmission process and the sending rules of the second data packets in the preset buffer.
[0044] The present invention provides a functional safety communication method for a Bluetooth scanner. Obtain the connection mode of the scanner, and the main board processes and encapsulates data based on the connection mode of the scanner, including:
[0045] The scanner obtains the current connection mode through the Bluetooth module;
[0046] Determine the data encryption method based on the current connection mode and the preset mode - method data table;
[0047] If in the connected mode, the scanner encrypts the data based on the corresponding encryption method and transmits it to the master device in real time;
[0048] If in the unconnected mode, the scanner encrypts the data based on the corresponding encryption method and stores it in the preset memory, and transmits it based on the preset transmission method after the Bluetooth connection is established.
[0049] Compared with the prior art, the beneficial effects of the present application are as follows:
[0050] By dynamically determining the scanner working mode according to user requirements and initializing the data transmission protocol based on the working mode, the flexibility and security of the communication process are ensured. Combining Bluetooth pairing, decoded data transmission, and connection mode processing, efficient and secure data transmission and compatibility optimization are achieved, enhancing the adaptability and reliability of the Bluetooth scanner. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0052] Figure 1 is a schematic flowchart of a functional safety communication method for a Bluetooth scanner provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0053] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the present invention in conjunction with the drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0054] Embodiment 1:
[0055] An embodiment of the present invention provides a functional safety communication method for a Bluetooth scanner, as Figure 1 shown, including:
[0056] Step 1: Activate the scanner and enter the Bluetooth pairing mode to wait for pairing, and then perform Bluetooth pairing based on a preset method;
[0057] Step 2: Obtain user requirements and user main device configuration data, and then determine the working mode of the scanner;
[0058] Step 3: Initialize the corresponding data transmission protocol based on the working mode of the scanner;
[0059] Step 4: The user presses the scan button to trigger a scanning action, the scanning head decodes the data, and transmits the decoded data to the main board through the serial port based on the initialized data transmission protocol;
[0060] Step 5: Obtain the connection mode of the scanner, and the main board processes and encapsulates data based on the connection mode of the scanner.
[0061] In this embodiment, the preset method refers to the Bluetooth pairing method set in advance according to different device requirements and usage scenarios during the design and development of the Bluetooth scanner. For example, the Bluetooth scanner can be connected through two modes: "automatic pairing" or "manual pairing": Automatic pairing: After activation, the scanner will automatically search for and connect to the nearest authorized Bluetooth device without user intervention. Automatic pairing is further divided into: NFC pairing and QR code pairing. Manual pairing: The user needs to enter the Bluetooth pairing code of the scanner on the main device to complete the connection operation. This method is usually used to enhance the security of pairing and prevent unauthorized devices from accessing. The preset method aims to improve the efficiency of Bluetooth pairing while meeting the requirements for pairing speed or security in different scenarios.
[0062] In this embodiment, user requirements refer to the specific requirements of the user for the functions, performance, and scenario adaptability of the Bluetooth scanner when using it. For example, Function requirements: The user may need the scanner to support the decoding ability of barcodes, QR codes, or other specific encoding formats. Performance requirements: The user's requirements for transmission speed, data security, and stability, such as maintaining low-latency data transmission in high-concurrency scenarios. Scenario requirements: Some users may need the scanner to support offline mode, storage mode, or real-time transmission mode to adapt to different working scenarios. By analyzing user requirements, the scanner can flexibly adjust its working mode to better meet the usage scenario.
[0063] In this embodiment, the user main device configuration data refers to the technical and functional parameters of the main device (such as mobile phone, computer, or industrial control terminal) paired with the Bluetooth scanner. These data usually include: Device type: such as Android or iOS devices, Windows or Linux operating systems, etc. Communication interface: The interface types supported by the main device (such as Bluetooth 4.0, Bluetooth 5.0, serial port protocol, etc.). Data format requirements: The data encapsulation format required by the main device (such as JSON, XML, or plain text). By reading the user main device configuration data, the scanner can select the most compatible communication mode and protocol to ensure smooth data transmission.
[0064] In this embodiment, the initialized data transfer protocol refers to the communication protocol that is dynamically selected and loaded according to user requirements and master device configuration data after the scanner determines its working mode. This protocol defines the rules for data interaction between the scanner and the master device, including: protocol type: such as serial port protocol (UART), Bluetooth SPP protocol (Serial Port Profile), or Bluetooth HID protocol (Human Interface Device); data transfer parameters: such as serial port configuration parameters like baud rate, data bits, parity bits, and stop bits; security measures: such as data encryption methods (AES, DES) or communication authentication methods (pairing code, PIN code, etc.). For example, in an industrial application scenario, the scanner can initialize the Bluetooth SPP protocol to achieve efficient data transfer; in a consumer electronics scenario, the HID protocol can be used to transfer data to a mobile device as keyboard input.
[0065] The beneficial effects of the above technical solution are as follows: By dynamically determining the working mode of the scanner according to user requirements and initializing the data transfer protocol based on the working mode, the flexibility and security of the communication process are ensured. Combining Bluetooth pairing, decoded data transfer, and connection mode processing, efficient and secure data transfer and compatibility optimization are achieved, improving the adaptability and reliability of the Bluetooth scanner.
[0066] Embodiment 2:
[0067] The embodiment of the present invention provides a functional safety communication method for a Bluetooth scanner. The connection modes of the scanner include: connected mode and unconnected mode.
[0068] In this embodiment, the connected mode means that the scanner has successfully completed Bluetooth pairing and connection with the master device (such as a computer, tablet, POS machine, etc.). For example, when the scanner is used in a retail cash register system, after successful pairing, the scanner will automatically enter the connected mode. When the user presses the scan button, the scanner immediately transmits the decoded product barcode information to the cash register system via Bluetooth;
[0069] In this embodiment, the unconnected mode means that the scanner has not completed Bluetooth pairing with the master device, or the current connection is disconnected. For example, during the setup process of a new device, the scanner is in the unconnected mode, waiting for the user to perform Bluetooth pairing with a new master device. Once the pairing is completed, the scanner will automatically switch to the connected mode.
[0070] The beneficial effects of the above technical solution are as follows: By setting the connected mode and unconnected mode, intelligent management of the Bluetooth scanner's status is achieved, improving the device connection efficiency, reducing unnecessary resource consumption, and ensuring the stability and security of communication, significantly enhancing the usage experience and functional safety of the scanner.
[0071] Embodiment 3:
[0072] An embodiment of the present invention provides a functional safety communication method for a Bluetooth scanner. The working modes of the scanner include: HID mode, SPP mode, and BLE mode.
[0073] In this embodiment, the HID mode simulates the scanner as a keyboard device, and the scanned data will be directly input into the text input box of the master device. For example, in a retail store, when the scanner uses the HID mode, after scanning the product barcode, the product number will be directly input into the software interface of the POS machine, similar to keyboard input, without the need for additional drivers, suitable for most devices, and the operation is simple and intuitive;
[0074] In this embodiment, the SPP mode simulates Bluetooth serial port communication, and the data is transmitted through a virtual serial port. For example, in industrial applications, the scanner is connected to an industrial control system through the SPP mode, and the scanned data is transmitted to the control system through the serial port protocol for processing, providing higher data transmission flexibility and being suitable for application scenarios that require customized data processing processes;
[0075] In this embodiment, the BLE mode uses low-power Bluetooth technology and is suitable for devices with high energy consumption requirements. For example, when using the scanner in a handheld mobile device or a wearable device, the BLE mode can significantly extend the battery life while maintaining stable communication, with low energy consumption, suitable for devices that need to be used continuously for a long time, especially widely used in mobile applications.
[0076] The beneficial effects of the above technical solutions are: by supporting three working modes of HID, SPP, and BLE, it flexibly adapts to different devices and application scenarios, meets diverse communication requirements, realizes efficient data transmission, low-power operation, and wide compatibility, and significantly improves the functionality and practicality of the Bluetooth scanner.
[0077] Example 4:
[0078] An embodiment of the present invention provides a functional safety communication method for a Bluetooth scanner. Activate the scanner and enter the Bluetooth pairing mode to wait for pairing, and then perform Bluetooth pairing based on a preset method, including:
[0079] After the scanner is powered on, start the core module of the scanner. Among them, the core module includes: a main board, a scanning head, a Bluetooth module, and a storage module;
[0080] Initialize the Bluetooth module based on a preset initialization method and enter the broadcast mode, and then send a Bluetooth signal to surrounding devices to wait for a Bluetooth pairing request from the user's master device;
[0081] Obtain the device information of the user's master device and analyze it, and then determine the preset pairing method of the user's master device;
[0082] Pair the user's main device and the scanner via a preset pairing method. After the pairing is completed, generate a session key through a preset encryption method.
[0083] In this embodiment, the core module of the scanner refers to the main hardware components that make up the Bluetooth scanner, including the main board, the scanning head, the Bluetooth module, and the storage module, including: Main board: Responsible for coordinating the work of each module, providing computing and communication capabilities. Scanning head: Used to collect bar code or QR code images and perform decoding processing. Bluetooth module: Responsible for wireless communication, connecting to the main device via Bluetooth. Storage module: Used to save device configurations, user data, and information related to communication protocols. Example: After the scanner is powered on, the main board activates the scanning head to perform a scanning operation, and at the same time starts the Bluetooth module to enter the broadcast mode, which combines with the configuration information read by the storage module to complete the Bluetooth pairing.
[0084] In this embodiment, the preset initialization method refers to the method by which the Bluetooth module is initialized according to a specified process when starting up to ensure communication stability and compatibility. Content: Clear the Bluetooth module cache to ensure that no old connection records affect new pairing. Set the Bluetooth working mode, such as BLE or classic Bluetooth mode. Determine the broadcast intensity and duration. Example: When the Bluetooth module is initialized, it is set to the BLE mode and the broadcast intensity is set to high power to ensure that the main device can receive signals stably.
[0085] In this embodiment, the broadcast mode refers to the state in which the Bluetooth module sends signals so that the surrounding main devices can discover and connect to the scanner. The scanner broadcasts its device name, UUID, etc. via the Bluetooth module. During this period, the scanner is in a discoverable state, waiting for the main device to initiate a pairing request. Example: After the scanner enters the broadcast mode, the device name "Scanner_001" appears in the Bluetooth search list of the user's mobile phone.
[0086] In this embodiment, the device information refers to the basic parameters of the main device obtained by the scanner, which are used to judge the type and pairing ability of the main device. Content: Main device type: Such as mobile phone, tablet, POS machine, etc. Supported Bluetooth version: Such as 4.0, 5.0. Pairing permission requirements: Such as PIN code input or automatic pairing support. Example: The device information obtained by the scanner shows "Device name: POS_2024, Bluetooth version: 5.0, Permission requirement: PIN code".
[0087] In this embodiment, the preset pairing method refers to the Bluetooth pairing process selected by the scanner based on the characteristics of the master device. Main methods: Automatic pairing: The device connects directly without user operation. PIN code pairing: The user enters the PIN code displayed by the scanner to complete the connection. Example: If the scanner detects that the master device is an industrial tablet, it automatically selects the PIN code pairing method, and the user needs to enter "123456" to complete the connection.
[0088] In this embodiment, the preset encryption method refers to the encryption algorithm used by the scanner to encrypt the communication content after pairing to ensure data security. Common encryption methods: Symmetric encryption: Such as AES-128. Asymmetric encryption: Such as RSA or ECC. Example: After the scanner and the master device complete pairing, the AES encryption algorithm is enabled to encrypt the transmitted data into "AB12CD34EF";
[0089] In this embodiment, the session key refers to the unique encryption key generated by the scanner and the master device after pairing, which is used to encrypt the communication between the two parties. It is dynamically generated, unique and time-sensitive, and is generated by the scanner and the master device through encryption negotiation. Example: After the Bluetooth pairing is completed, the scanner and the master device negotiate to generate the session key "X1Y2Z3A4" for the encrypted transmission of subsequent scanned data.
[0090] The beneficial effects of the above technical solutions are as follows: Through the preset initialization and pairing method of the Bluetooth module, it ensures the secure connection between the scanner and the user through the master device. By using the pre-encryption method of the Bluetooth module to generate the session key, it improves the initialization and broadcast mode of the device, realizes the security of Bluetooth pairing and the efficient device discovery and pairing, simplifies the pairing process, combines with the user, and also ensures the privacy of communication and the analysis of the master device information and the preset data protection, enhancing the functional security of the Bluetooth scanner. The pairing method ensures the flexibility and compatibility of the pairing process, and improves the communication security through the session key encryption, significantly enhancing the functional security and user experience of the Bluetooth scanner.
[0091] Embodiment 5:
[0092] The embodiment of the present invention provides a functional security communication method for a Bluetooth scanner, which obtains user requirements and user master device configuration data, and then determines the working mode of the scanner, including:
[0093] Obtain user requirements and analyze them to determine the relevant parameters of the user requirements;
[0094] Analyze the user master device configuration data to determine the relevant parameters of the user master device configuration;
[0095] Based on the relevant parameters of the user requirements and the relevant parameters of the user master device configuration, determine the working coefficient of the scanner:
[0096]
[0097] Among them, W is the working coefficient of the scanner, U i is the demand value of the i-th user demand, γ i is the preset adjustment coefficient of the i-th user demand, w i is the weight of the i-th user demand, n1 is the total number of user demands, α1 is the weight of user demands, α2 is the weight of user device configuration, M j is the value of the j-th user main device configuration item, w j is the weight of the j-th user main device configuration item, M k is the value of the k-th user main device configuration item, γ ij is the interaction coefficient between the j-th user main device configuration item and the k-th user main device configuration item, and j≠k, n2 is the number of user main device configuration items, α3 is the weight of the communication requirement of the user main device, where C is the communication requirement value of the user main device:
[0098]
[0099] r is the real-time requirement value of the user main device, β1 is the sensitivity coefficient of the preset real-time requirement, ∝r is the preset conversion coefficient of the real-time requirement value of the user main device, r0 is the preset reference value of the real-time requirement of the user main device, b is the bandwidth requirement value of the user main device, β2 is the sensitivity coefficient of the preset bandwidth requirement, ∝b is the preset conversion coefficient of the bandwidth requirement value of the user main device, d is the data integrity requirement value of the user main device, ∝d is the conversion coefficient of the data integrity requirement of the user main device, min() is the minimum value function;
[0100] Determine the working mode of the scanner based on the working coefficient of the scanner and the preset coefficient-mode data table.
[0101] In this embodiment, the user demand is the specific demand and priority of the user for the Bluetooth scanner function, such as the requirements for real-time, bandwidth, data integrity, etc., including: real-time demand value (rr): The user hopes that the data transmission delay is as low as possible. For example: The user hopes that the transmission delay of the scanner is less than 50ms. Data integrity demand value: The user's requirement for the reliability of data transmission, usually expressed by the transmission error rate or packet loss rate. For example: The required packet loss rate is less than 0.01%. Bandwidth demand value (BB): The Bluetooth transmission rate expected by the user. For example: The user demand is 500kbps.
[0102] In this embodiment, the relevant parameters configured by the user's main device are hardware or software capability parameters related to the user's main device (such as mobile phones, PDAs, etc.). These parameters affect the working mode of the scanner, including: Device Bluetooth version: The Bluetooth standard supported by the device (such as Bluetooth 4.0, 5.0). For example, if the main device supports Bluetooth 5.0, it can support the high-speed transmission mode. Processing capacity: The CPU or memory performance of the main device. For example, if the CPU frequency of the device is 1.8 GHz, it can handle high-load tasks. Battery status: The remaining battery power of the main device. For example, if the battery level is below 20%, the power consumption of the scanner needs to be reduced. Priority task type: Whether the main device is currently executing high-priority tasks (such as calls, navigation). For example, if the main device is in a call, the data transmission priority needs to be reduced.
[0103] In this embodiment, the working coefficient of the scanner is a comprehensive parameter used to quantify the working state of the scanner.
[0104] In this embodiment, the communication requirement value of the user's main device is the overall communication performance requirement of the user's main device for the Bluetooth connection, including bandwidth, real-time performance, and data integrity, etc. For example, the user hopes that the transmission rate reaches 1 Mbps, while the data transmission delay is less than 30 ms, and the packet loss rate is lower than 0.001%;
[0105] In this embodiment, the sensitivity coefficient of the preset bandwidth requirement is a weight that measures the impact of the bandwidth requirement on the working mode of the scanner, indicating the importance of the bandwidth requirement. Assuming the sensitivity coefficient is 0.8: The impact of the bandwidth requirement on the scanner is relatively large, and the scanner will give priority to meeting high-bandwidth requirements. Assuming the sensitivity coefficient is 0.2: The impact of the bandwidth requirement on the scanner is relatively small, and the scanner will give priority to considering other requirements (such as real-time performance);
[0106] In this embodiment, the sensitivity coefficient of the preset real-time requirement is a weight that measures the impact of the real-time requirement on the working mode of the scanner, indicating the importance of the latency requirement. Assuming the sensitivity coefficient is 0.9: The impact of the real-time requirement is relatively large, and the scanner will give priority to optimizing the latency performance. Assuming the sensitivity coefficient is 0.1: The impact of the real-time requirement is relatively small, and the scanner may tend to meet the bandwidth or data integrity requirements;
[0107] In this embodiment, the data integrity requirement value of the user's main device is the requirement of the user for the accuracy of the transmitted data, usually expressed by the packet loss rate or error rate. For example, the data integrity requirement value is 99.99%: It means that at most 0.01% of the data errors or losses are allowed during the transmission process. The data integrity requirement value is 100%: It means that absolutely no errors are allowed during the transmission process.
[0108] In this embodiment, the preset conversion coefficient of the real-time requirement value of the user's main device is to convert the user's real-time requirement into a parameter value that the scanner can understand. Considering the actual situation and hardware capabilities, for example: User requirement: The latency is less than 30 ms. The conversion coefficient is 0.8, indicating that the real-time requirement is appropriately relaxed, and the latency target becomes 30 ms × 0.8 = 24 ms. The conversion coefficient is 1.2, indicating that the real-time requirement is appropriately increased, and the latency target becomes 30 ms × 1.2 = 36 ms;
[0109] In this embodiment, the conversion coefficient of the data integrity requirement of the user's main device is to convert the user's data integrity requirement into an operable index of the scanner, considering the limitations of the Bluetooth protocol. For example: User requirement: The data packet loss rate does not exceed 0.01%. The conversion coefficient is 0.5, and the data packet loss rate requirement is appropriately relaxed to 0.02%. The conversion coefficient is 1.5, and the data packet loss rate requirement is appropriately increased to 0.005%.
[0110] The beneficial effects of the above technical solutions are as follows: By comprehensively analyzing the user requirement parameters and the user's main device configuration parameters, a multi-dimensional working coefficient model is constructed to quantify key requirements such as real-time performance, communication bandwidth, and data integrity. Combining the coefficient-mode data table, the working mode of the scanner is intelligently matched, realizing efficient, safe, and personalized functional adjustment of the Bluetooth scanner, and improving the user experience and device adaptation ability.
[0111] Embodiment 6:
[0112] The embodiment of the present invention provides a functional safety communication method for a Bluetooth scanner. When the user presses the scan button to trigger the scanning action, the scanning head decodes the data and transmits it to the main board through the serial port based on the initialized data transmission protocol, including:
[0113] After the user presses the scan button, the scanning head immediately enables the scanning function, scans the target code, and acquires the original image data;
[0114] Based on the preset decoding algorithm in the scanning head, the acquired image data is processed to determine the encoding information of the target code;
[0115] Based on the preset conversion method, the encoding information of the target code is converted into the first character data in the preset format;
[0116] The first character data is subjected to preset formatting processing to generate the second character data;
[0117] Based on the initialized communication protocol and the preset protocol-format database, the data encapsulation format corresponding to the initialized communication protocol is obtained;
[0118] Based on the data encapsulation format corresponding to the initialized communication protocol, the second character data is encapsulated to obtain the third character data;
[0119] Transmit the third character data through the preset serial port interface of the Bluetooth module based on the initialized communication protocol and send it to the main board.
[0120] In this embodiment, the target codes are two-dimensional codes and barcodes;
[0121] In this embodiment, the preset decoding algorithm refers to the algorithm built into the scanning head and specifically used to analyze the acquired bar code or two-dimensional code image data. By processing the acquired original image data, the effective information of the target code is extracted. Features: Support multiple encoding formats: such as Code128, EAN-13, QR code, etc. High-efficiency decoding: Quickly identify the target code, and it can be decoded even under complex lighting or angles. Example: After the scanning head acquires an image with a product bar code, the preset decoding algorithm automatically analyzes the image and extracts the bar code data "8901234567890" (product number);
[0122] In this embodiment, the encoded information of the target code refers to the original data extracted from the bar code or two-dimensional code, usually including the encoding type and the encoding content. Content: Encoding type: For example, the bar code is Code128 and the two-dimensional code is QR code. Encoding content: The information actually stored in the encoding, such as product number, URL, or encrypted data. Example: By scanning a logistics two-dimensional code, the encoded information of the target code may be the encoding type "QR code" and the encoding content "https: / / logistics.com / track / 12345".
[0123] In this embodiment, the preset conversion method refers to the rule for converting the encoded information of the target code into a format that conforms to specific specifications. The conversion method can be defined according to specific application scenarios to be compatible with different devices and systems. Features: Can be adjusted according to the requirements of the target device, such as converting the encoding content from binary to ASCII characters. Support content format optimization, such as adding prefixes or check information. Example: Convert the encoded information "8901234567890" of the target code into the first character data with a prefix "PRD-8901234567890" through the preset conversion method;
[0124] In this embodiment, the first character data in the preset format refers to the data that conforms to the preliminary specifications after being processed by the preset conversion method. This data can be directly used for subsequent formatting and encapsulation operations. Content characteristics: The character data has initially met the basic requirements of the target system or protocol, including the encoding content and basic format modifications. Example: The bar code "8901234567890" is converted into the first character data "[EAN13]8901234567890", where "[EAN13]" represents the encoding type.
[0125] In this embodiment, the second character data refers to the data generated by further performing a preset formatting process on the basis of the first character data. The formatting process may include adding check bits, delimiters, or structured information, etc., to meet the specific requirements of the communication protocol. The processing characteristics are as follows: adjusting the data format according to the protocol requirements, such as chunking and supplementing check bits, to ensure the integrity and transmission compatibility of the data. Example: Format the first character data "[EAN13]8901234567890" into "[EAN13][8901-2345-6789-0][CHK:7]", where delimiters and a check bit (CHK:7) are added.
[0126] In this embodiment, the preset protocol-format database is a rule base that contains communication protocols and corresponding data encapsulation formats. It guides how to encapsulate data according to the requirements of the communication protocol. Content: The encapsulation format definition for each protocol, such as the packet structures of the BLE, HID, and SPP protocols, including field definitions, head and tail flag bits, check rules, etc. Example: For the BLE protocol, the database may specify the encapsulation format: "[HEADER][DATA][CHECKSUM]", and for the SPP protocol, the specified encapsulation format is " <start>[DATA] <end>”。
[0127] In this embodiment, the third character data refers to the data generated based on the data encapsulation format corresponding to the initialized communication protocol on the basis of the second character data. It is the data finally transmitted to the main board through the Bluetooth module, with the characteristics: it fully meets the transmission requirements of the communication protocol, includes necessary checksum and protocol header and tail flags. Example: encapsulate the second character data "[EAN13][8901-2345-6789-0][CHK:7]" into the third character data "[BLE_HDR][EAN13][8901-2345-6789-0][CHK:7][BLE_END]" of the BLE protocol, where the header and tail flags of the BLE protocol are added.
[0128] The beneficial effects of the above technical solution are: realizing the efficient processing and formatting of the target code data through the preset decoding algorithm and conversion method, combining the protocol-format database and the initialized communication protocol to ensure the security and compatibility of data encapsulation and transmission, and enhancing the functional security, real-time performance and reliability of the Bluetooth scanner in data transmission.
[0129] Embodiment 7:
[0130] The embodiment of the present invention provides a functional safety communication method for a Bluetooth scanner, which transmits the third character data through the preset serial port interface of the Bluetooth module based on the initialized data transmission protocol, including:
[0131] Determine the segmentation size of the data packet based on the initialized data protocol, and then segment the third character data into several first data packets based on the preset segmentation method;
[0132] Encrypt and compress each data packet based on the initialized data protocol to obtain several second data packets;
[0133] Determine the transmission rules during the transmission process based on the initialized data protocol;
[0134] Store all the unsent second data packets in a preset buffer;
[0135] Analyze all the second data packets to determine the sending priority of each second data packet;
[0136] Determine the sending rules of the second data packets in the preset buffer based on the initialized data protocol;
[0137] Transmit all the second data packets through the preset serial port interface of the Bluetooth module based on the transmission rules during the transmission process and the sending rules of the second data packets in the preset buffer.
[0138] In this embodiment, the splitting size of the data packet is determined based on the initialized data protocol. The size of each data packet is usually adjusted according to the maximum transmission unit (MTU) of the communication protocol. When the protocol is initialized, the value of the MTU is defined, which determines the maximum size of each data packet. The splitting mechanism ensures that the data packet does not exceed this maximum transmission unit, thus avoiding the truncation or loss of the data packet;
[0139] In this embodiment, the preset splitting method refers to the rule or algorithm for splitting larger data (such as the third character data) into small data packets suitable for Bluetooth protocol transmission. The design of the splitting method usually takes into account the limitations of the data protocol (such as the MTU size) and transmission efficiency. The data is split according to the maximum transmission unit (MTU) limit of the Bluetooth protocol to ensure that each split data packet is complete and does not lose key information. Assume that the third character data is 1000 bytes and the MTU of the Bluetooth protocol is 200 bytes. The preset splitting method divides the data into 5 first data packets, each with a size of 200 bytes;
[0140] In this embodiment, the first data packet refers to the data unit obtained by initially splitting the third character data according to the preset splitting method, which has not been encrypted or compressed. The size of each first data packet meets the requirements of the Bluetooth protocol, and the content of the data packet has not been further processed and remains the original character data. If the third character data is "[HEADER][DATA][CHECKSUM]", the first data packets generated after splitting may be: Packet 1: "[HEADER][DATA1]", Packet 2: "[DATA2][CHECKSUM]".
[0141] In this embodiment, the second data packet refers to the data packet generated after encryption and compression on the basis of the first data packet, which is suitable for actual transmission. The encryption algorithm is used to ensure the security of the data during transmission, and the compression algorithm is used to reduce the data volume and improve the transmission efficiency. Assume that the content of the first data packet is "[HEADER][DATA1]", and after AES encryption and compression, the second data packet "E94AB1C7D" is generated. This data packet is both encrypted and smaller in size;
[0142] In this embodiment, the transmission rule refers to the relevant operation specifications defined by the data protocol during the data packet transmission process, including the transmission order of the data packets, the retransmission mechanism, and the verification method, etc. Content: Determine the order of sending data packets (such as sending the packets with higher priority first), set the error verification and retransmission strategy during transmission, and define the recovery process when the transmission is interrupted. For example, give priority to transmitting control packets (such as handshake signals). If a certain data packet is not acknowledged by the receiving party, it will be resent according to the transmission rule;
[0143] In this embodiment, the preset buffer refers to the temporary storage area in the Bluetooth module, which is used to store data packets that have not been sent or are waiting for transmission. Its functions are: buffering unsent data packets to prevent data loss, assigning priorities to data packets, and arranging the transmission order. Assume that the maximum storage capacity of the scanner's buffer is 10 second data packets. When 5 high-priority packets and 3 low-priority packets are received, the high-priority packets will be transmitted first, and the low-priority packets will wait until there is idle time for transmission.
[0144] The beneficial effects of the above technical solution are as follows: Through the initialized data protocol, packet segmentation, encryption, compression, and priority management are achieved. Combining the sending rules and transmission rules of the preset buffer improves the security, efficiency, and reliability of Bluetooth scanner data transmission, ensures that functional safety requirements are met in complex communication scenarios, and optimizes resource utilization and real-time performance.
[0145] Embodiment 8:
[0146] The embodiment of the present invention provides a functional safety communication method for a Bluetooth scanner. The connection mode of the scanner is obtained, and the main board processes and encapsulates data based on the connection mode of the scanner, including:
[0147] The scanner obtains the current connection mode through the Bluetooth module;
[0148] Based on the current connection mode determination and the preset mode-method data table, determine the encryption method of the data;
[0149] If in the connected mode, the scanner encrypts the data based on the corresponding encryption method and transmits it to the master device in real time;
[0150] If in the unconnected mode, the scanner encrypts the data based on the corresponding encryption method and stores it in the preset memory, and transmits it based on the preset transmission method after the Bluetooth connection is established.
[0151] In this embodiment, the preset mode-method data table is a mapping table used to associate the Bluetooth connection modes of the scanner (such as connected, unconnected, broadcast mode, etc.) with the corresponding encryption methods. This table is loaded during device initialization to guide the scanner to select appropriate encryption schemes in different connection modes. Features: The table records the encryption methods corresponding to each mode, such as AES, RSA, etc., improving the flexibility and security of data processing;
[0152] In this embodiment, the corresponding encryption method refers to the data encryption method determined according to the Bluetooth connection mode and the mode-method data table, which is used to ensure the security of data during storage or transmission. Common methods include: symmetric encryption (such as AES): the same key is used for encryption and decryption, which is fast and suitable for real-time transmission in the connected mode; asymmetric encryption (such as ECC, RSA): different keys are used for encryption and decryption, which has high security and is suitable for storage in the unconnected mode. If the scanner is in the connected mode, AES-128 encryption is used to encrypt the data "123456789" into "E9F24D67B". If the scanner is in the unconnected mode, ECC-256 encryption is used to encrypt the data "123456789" into "043D8FAB94C".
[0153] In this embodiment, the preset transmission method refers to the transmission process and specifications used by the scanner to send the encrypted data stored in the memory to the master device after the Bluetooth connection is established, including: real-time transmission: the scanner automatically sends all the stored data instantly when the Bluetooth connection is established; segmented transmission: if the data volume is large, the data is divided into multiple small packets and sent in sequence, and an acknowledgment mechanism (such as ACK) is set; priority transmission: according to the importance of the data, high-priority data is transmitted first. Example: After the scanner reconnects to the Bluetooth, it sends 10 encrypted data packets in the segmented transmission mode, each packet being 200 bytes in size, and does not send the next packet until it receives the ACK signal from the master device. In the priority transmission mode, the high-priority order information data packet is transmitted before the log information data packet.
[0154] The beneficial effects of the above technical solution are as follows: Through the preset mode-method data table, the Bluetooth scanner can flexibly select the encryption method in different connection modes, ensuring the security of data transmission and storage. In the unconnected mode, it supports encrypted data storage and, after the connection is established, efficiently transmits data based on the preset transmission method, improving the reliability and transmission efficiency of data management and meeting the requirements of functional security.
[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments or perform equivalent replacements for some of the technical features. However, such modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present invention.< / end> < / start>
Claims
1. A functional secure communication method for a Bluetooth scanner, characterized in that, include: Step 1: Activate the scanner and enter Bluetooth pairing mode to wait for pairing, and then perform Bluetooth pairing based on the preset method; Step 2: Obtain user requirements and user main device configuration data to determine the working mode of the scanner; Step 3: Initialize the corresponding data transmission protocol based on the working mode of the scanner; Step 4: The user presses the scan button to trigger the code scanning action. The scanning head decodes the data and transmits the decoded data to the mainboard through the serial port based on the initialized data transmission protocol; Step 5: Get the connection mode of the scanner. The mainboard processes and packages the data based on the connection mode of the scanner.
2. A functional safety communication method for a Bluetooth scanner according to claim 1, characterized in that: The connection mode of the scanner, including connected mode and unconnected mode.
3. A functional safety communication method for a Bluetooth scanner according to claim 1, characterized in that: The scanner's working modes include: HID mode, SPP mode and BLE mode.
4. A functional safety communication method for a Bluetooth scanner according to claim 1, characterized in that: Activate the scanner and enter Bluetooth pairing mode to wait for pairing, and then perform Bluetooth pairing based on the preset method, including: After the scanner is turned on, the core module of the scanner is started, wherein the core module includes: a mainboard, a scanning head, a Bluetooth module and a storage module; Initialize the Bluetooth module based on a preset initialization method and enter the broadcast mode, and then send a Bluetooth signal to surrounding devices, waiting for the user's main device to initiate a Bluetooth pairing request; Obtaining and analyzing device information of the user's primary device, and then determining a preset pairing method of the user's primary device; The user's main device and the scanner are paired by Bluetooth based on the preset pairing method. After the pairing is completed, a session key is generated by the preset encryption method.
5. A functional safety communication method for a Bluetooth scanner according to claim 1, characterized in that: Obtain user requirements and user main device configuration data to determine the scanner's operating mode, including: Obtain user needs and analyze them to determine the relevant parameters of user needs; Analyze the user's main equipment configuration data to determine the relevant parameters of the user's main equipment configuration; Determine the scanner's operating coefficient based on the relevant parameters of user needs and the relevant parameters of the user's main device configuration: Where W is the working coefficient of the scanner, U i is the demand value of the i-th user, γ i is the preset adjustment coefficient of the i-th user demand, w i is the weight of the i-th user demand, n1 is the total number of user demands, α1 is the weight of the user demand, α2 is the weight of the user device configuration, M j is the value of the jth user master device configuration item, w j is the weight of the jth user main device configuration item, M k is the value of the kth user main device configuration item, γ ij is the interaction coefficient between the jth user main device configuration item and the kth user main device configuration item, and j≠k, n2 is the number of user main device configuration items, α3 is the weight of the communication requirement of the user main device, and C is the communication requirement value of the user main device: r is the real-time requirement value of the user main device, β1 is the preset sensitivity coefficient of the real-time requirement, ∝r is the preset conversion coefficient of the real-time requirement value of the user main device, r0 is the preset reference value of the real-time requirement of the user main device, b is the bandwidth requirement value of the user main device, β2 is the preset sensitivity coefficient of the bandwidth requirement, ∝b is the preset conversion coefficient of the bandwidth requirement value of the user main device, d is the data integrity requirement value of the user main device, ∝d is the conversion coefficient of the data integrity requirement of the user main device, and min() is the minimum value function; The operating mode of the scanner is determined based on the operating coefficient of the scanner and a preset coefficient-mode data table.
6. A functional safety communication method for a Bluetooth scanner according to claim 1, characterized in that: The user presses the scan button to trigger the code scanning action. The scanning head decodes the data and transmits it to the mainboard through the serial port based on the initialized data transmission protocol, including: After the user presses the scan button, the scanning head immediately starts scanning, scans the target code, and collects the original image data; The collected image data is processed based on the preset decoding algorithm in the scanning head to determine the encoding information of the target code; Converting the encoding information of the target code into first character data of a preset format based on a preset conversion method; Performing a preset formatting process on the first character data to generate second character data; Acquire a data encapsulation format corresponding to the initialized communication protocol based on the initialized communication protocol and a preset protocol-format database; encapsulating the second character data based on the data encapsulation format corresponding to the initialized communication protocol, thereby obtaining the third character data; The third character data is transmitted through a preset serial port interface of the Bluetooth module based on the initialized communication protocol and sent to the main board.
7. A functional safety communication method for a Bluetooth scanner according to claim 6, characterized in that: Transmitting the third character data through a preset serial port interface of the Bluetooth module based on the initialized data transmission protocol, including: Determine the segmentation size of the data packet based on the initialized data protocol, and then segment the third character data into a plurality of first data packets based on a preset segmentation method; Encrypting and compressing each data packet based on the initialized data protocol, thereby obtaining a plurality of second data packets; Determine the transmission rules during the transmission process based on the initialized data protocol; storing all unsent second data packets in a preset buffer; Analyze all second data packets to determine the sending priority of each second data packet; Determine a sending rule of the second data packet in the preset buffer based on the initialized data protocol; Based on the transmission rule in the transmission process and the sending rule of the second data packet in the preset buffer, all the second data packets are transmitted through the preset serial port interface of the Bluetooth module.
8. A functional safety communication method for a Bluetooth scanner according to claim 1, characterized in that: Get the connection mode of the scanner. The mainboard processes and encapsulates data based on the connection mode of the scanner, including: The scanner obtains the current connection mode through the Bluetooth module; Determine the encryption method of the data based on the current connection mode and the preset mode-method data table; If it is in connected mode, the scanner encrypts the data based on the corresponding encryption method and transmits it to the main device in real time; If it is in unconnected mode, the scanner will encrypt the data based on the corresponding encryption method and store it in the preset memory, and transmit it based on the preset transmission method after the Bluetooth connection is established.
Citation Information
Cited By
Data transmission method, data transmission system, scanning equipment and computer equipment
CN120583186A