Data transmission control method and device of code scanning gun and code scanning gun
Patent Information
- Application Number
- CN202611065811.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-17
- Publication Date
- 2026-10-16
AI Technical Summary
当用户需要将扫码枪切换至另一主机使用时,往往需要重新执行蓝牙配对或连接设置,操作过程较为繁琐,影响扫码作业的连续性
[0004]以上扫码枪的数据传输控制方法,能够利用扫码枪已有的扫描输入能力,基于扫描解析得到的条码数据类型完成主机切换和数据输入,使扫码枪在多个主机之间切换数据传输对象时更加便捷。同时,由于主机切换在当前待发送的普通条码数据已完成发送,或者当前待发送的普通条码数据已被保存至待处理缓存的情况下执行,可以降低切换过程中普通条码数据未完成发送而造成的数据丢失风险,由此提高扫码枪在多主机共享场景下的数据传输连续性和使用可靠性。并且由于不需要额外对扫码枪应付多个主机连接进行切换时设置物理按键,进一步提高了扫码枪在复杂工作环境下的物理防护水平,提高扫码枪的使用寿命。
Smart Images

Figure CN122934384A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data transmission technology for barcode scanners, and in particular to a data transmission control method, device, and barcode scanner for a barcode scanner. Background Technology
[0002] In retail stores, warehousing and logistics, and production lines, barcode scanners are typically used to collect product barcodes, material barcodes, or process barcodes, and send the scanned data to a host computer for recording and processing. With the increasing demand for mobile work and multi-terminal collaborative use, the scenario of switching the same barcode scanner between different hosts is gradually becoming more common. Existing barcode scanners typically establish a connection with a specific host after Bluetooth pairing and send the scanned data to that host. When users need to switch the barcode scanner to another host, they often need to re-perform Bluetooth pairing or connection settings, which is cumbersome and affects the continuity of scanning operations. Therefore, the efficiency of continuous operation of barcode scanners deserves attention. Summary of the Invention
[0003] In view of this, this application provides a data transmission control method, device and barcode scanner for barcode scanners, in order to improve the data transmission efficiency and reliability of barcode scanners in continuous working scenarios. Firstly, a data transmission control method for a barcode scanner is provided, applied to data transmission between multiple hosts of the barcode scanner. The barcode scanner stores multiple host configuration files corresponding to the hosts, and the host configuration files include connection information of the hosts. The data transmission control method includes: acquiring decoded data obtained after the barcode scanner scans a barcode; determining the data type of the scanned barcode based on the decoded data, the data type including: ordinary barcode data and host switching configuration code; when the data type of the barcode is ordinary barcode data, sending ordinary barcode data to the first host based on the current first host configuration file; when the data type of the barcode is a host switching configuration code, parsing the host switching configuration code to determine the target host identifier; determining a second host configuration file from multiple host configuration files based on the target host identifier; and when a preset switching condition is met, switching the first host configuration file to the second host configuration file, and establishing a connection with the second host based on the connection information in the second host configuration file; wherein the preset switching condition includes: the ordinary barcode data to be sent has been sent, or the ordinary barcode data to be sent has been saved to the pending processing cache.
[0004] The data transmission control method described above for barcode scanners leverages the scanner's existing scanning input capabilities to complete host switching and data input based on the barcode data type obtained from scanning and parsing. This makes switching data transmission objects between multiple hosts more convenient. Furthermore, since host switching is performed after the currently pending ordinary barcode data has been sent or saved to the processing cache, the risk of data loss due to incomplete transmission of ordinary barcode data during switching is reduced. This improves the continuity and reliability of data transmission in multi-host shared scenarios. Moreover, the elimination of the need for additional physical buttons for switching between multiple host connections further enhances the physical protection of the scanner in complex working environments, extending its lifespan.
[0005] Optionally, the decoded data obtained after the barcode is scanned by the barcode scanner includes: decoding the collected barcode image to obtain decoded data; determining the data type of the scanned barcode based on the decoded data, including: matching the decoded data with a preset switching instruction identifier; when the match is successful, determining the data type of the barcode as a host switching configuration code; when the match is unsuccessful, determining the data type of the barcode as ordinary barcode data.
[0006] Optionally, based on the connection information in the second host configuration file, a connection is established with the second host, including: determining whether the barcode scanner has stored a historical connection record corresponding to the second host based on the connection information in the second host configuration file; if a historical connection record is stored, initiating a reconnection request to the second host based on the historical connection record; if no historical connection record is stored, performing a connection configuration process with the second host based on the connection information in the second host configuration file; and after establishing a connection with the second host, sending the subsequently scanned ordinary barcode data to the second host.
[0007] Optionally, after establishing a connection with the second host based on the connection information in the second host configuration file, the method further includes: maintaining the connection between the barcode scanner and the first host, as well as the connection between the barcode scanner and the second host; updating the current data transmission target from the first host to the second host, and setting the second host configuration file as the host configuration file currently used for transmitting ordinary barcode data; when the data type of the subsequently scanned barcode is ordinary barcode data, sending the subsequently scanned ordinary barcode data to the second host based on the second host configuration file and the connection with the second host; when a host switching configuration code pointing to the first host is obtained again, updating the current data transmission target from the second host to the first host, and sending the subsequently scanned ordinary barcode data to the first host through the maintained connection with the first host.
[0008] Optionally, when the data type of the barcode is a host switching configuration code, the host switching configuration code is parsed to determine the target host identifier, including: parsing the host switching configuration code to obtain the device identifier, verification information, and target host identifier; determining whether the device identifier matches the barcode scanner's local identifier, and verifying the host switching configuration code based on the verification information; when the device identifier matches the local identifier and the verification information passes the verification, the target host identifier is determined to be valid; when the device identifier does not match the local identifier, or the verification information fails the verification, host switching based on the host switching configuration code is prohibited.
[0009] Optionally, when the data type of the barcode is a host switching configuration code, the method further includes: entering a switching protection state to prohibit the host switching configuration code from being sent to the first host as ordinary barcode data; detecting whether there is any ordinary barcode data that has not yet been sent; if there is ordinary barcode data that has not yet been sent, generating a cache record corresponding to the ordinary barcode data that has not yet been sent, and saving the cache record to the pending cache; wherein, the cache record includes: ordinary barcode data, data generation sequence identifier, and sending object identifier; wherein, the sending object identifier of ordinary barcode data obtained before the host switching configuration code and not yet sent is the first host, and the sending object identifier of ordinary barcode data obtained after the host switching configuration code and before establishing a connection with the second host is the second host; after establishing a connection with the second host, controlling the sending of ordinary barcode data in the pending cache based on the sending object identifier and the data generation sequence identifier.
[0010] Optionally, it also includes: obtaining registration decoding data after the barcode scanner scans the host registration configuration code; parsing the registration decoding data to obtain the host identifier and connection information of the host to be registered; generating a host configuration file corresponding to the host to be registered, or updating the stored host configuration file, based on the host identifier and connection information of the host to be registered; and storing the generated or updated host configuration file in the barcode scanner so that the barcode scanner can establish a connection with the corresponding host based on the host configuration file.
[0011] Optionally, the process of establishing a connection with the second host based on the connection information in the second host configuration file further includes: determining whether a connection with the second host is successfully established within a preset time period; when a connection with the second host is successfully established within the preset time period, setting the second host configuration file as the current host configuration file, and outputting a successful switch prompt message in a haptic manner, including one or more of the following: vibration prompt and sound prompt; when a connection with the second host is not successfully established within the preset time period, determining that the host switch has failed, restoring the first host configuration file to the current host configuration file, and outputting a switch failure prompt message; after determining that the host switch has failed, maintaining or restoring the connection with the first host based on the first host configuration file, or keeping the ordinary barcode data in the pending cache from being sent.
[0012] Secondly, a data transmission control device for a barcode scanner is provided, applied to a barcode scanner. The barcode scanner stores multiple host configuration files, each corresponding to a host, and the host configuration file includes connection information of the host. The data transmission control device includes: an acquisition unit for acquiring decoded data obtained after the barcode scanner scans a barcode; a type determination unit for determining the data type of the scanned barcode based on the decoded data, the data type including: ordinary barcode data and host switching configuration code; a sending unit for sending ordinary barcode data to a first host based on the current first host configuration file when the barcode data type is ordinary barcode data; a parsing unit for parsing the host switching configuration code and determining the target host identifier when the barcode data type is a host switching configuration code; a configuration determination unit for determining a second host configuration file from multiple host configuration files based on the target host identifier; and a connection switching unit for switching the first host configuration file to the second host configuration file when a preset switching condition is met, and establishing a connection with the second host based on the connection information in the second host configuration file. The preset switching condition includes: the ordinary barcode data to be sent has been sent, or the ordinary barcode data to be sent has been saved to a pending processing cache.
[0013] Thirdly, a barcode scanner is provided, comprising: a scanning module for acquiring barcode images; a decoding module connected to the scanning module for decoding the barcode images to obtain decoded data; a storage module for storing multiple host configuration files, each corresponding to a host and including host connection information; a communication module for establishing a connection with the host and transmitting data; and a control module connected to the decoding module, storage module, and communication module, for determining the data type of the scanned barcode based on the decoded data, including ordinary barcode data and host switching configuration codes; wherein the control module is further used to, when the barcode data type is ordinary barcode data, determine the data type based on the decoded data. The current first host configuration file sends ordinary barcode data to the first host via the communication module. When the data type of the barcode is a host switching configuration code, the host switching configuration code is parsed to determine the target host identifier, and the second host configuration file is determined from multiple host configuration files based on the target host identifier. It is also used to switch the first host configuration file to the second host configuration file when preset switching conditions are met, and to control the communication module to establish a connection with the second host based on the connection information in the second host configuration file. The preset switching conditions include: the ordinary barcode data to be sent has been completed, or the ordinary barcode data to be sent has been saved to the pending processing cache. Attached Figure Description
[0014] The accompanying drawings used in the description of the embodiments of this disclosure are briefly introduced below: Figure 1 A flowchart illustrating a data transmission control method for a barcode scanner provided in some embodiments of this application is shown. Figure 2 A schematic diagram of the data transmission control device for a barcode scanner provided in some embodiments of this application is shown. Detailed Implementation
[0015] To more clearly illustrate the technical solutions in the embodiments of this application, the specific implementation methods of this application will be described below with reference to the accompanying drawings. The accompanying drawings described below are merely some embodiments of this application. For those skilled in the art, other drawings or embodiments can be obtained based on these drawings or embodiments without creative effort. Adjustments and improvements made without departing from the concept of this application are all within the protection scope of this application.
[0016] In this application, unless otherwise expressly specified and limited, ordinal numbers, such as "first," "second," etc., are used only to distinguish and describe related objects, and should not be construed as indicating or implying the relative importance or order between related objects; furthermore, they do not represent the quantity of related objects. "Multiple" includes two or more, and other quantifiers are similar. " / " is used to describe the relationship between related objects, indicating an "or" relationship between them. "And / or" is used to describe the relationship between related objects, including any combination relationship between them, such as "a and / or b" including: "a alone," "b alone," or "a and b." "One or more" in multiple objects refers to any object or any combination of multiple objects, such as "one or more of a1, a2, a3" or "at least one of a1, a2, a3" including: "a1 alone," "a2 alone," "a3 alone," "a1 and a2," "a1 and a3," "a2 and a3," or "a1, a2 and a3."
[0017] Barcode scanners are typically used to collect barcode information and send the barcode data to a host computer. In scenarios such as retail stores, warehousing and logistics, and production lines, barcode scanners usually need to be used in conjunction with host devices such as POS machines, inventory management terminals, industrial control hosts, or mobile tablets. With the increasing demand for multi-terminal collaboration in actual business processes, it is common for the same barcode scanner to be switched between different host devices. For example, in a warehousing scenario, the barcode scanner may first connect to the receiving computer to complete the receiving registration, and then need to connect to the inventory tablet for inventory counting; in a store scenario, the barcode scanner may need to be switched between the POS terminal and the back-end management terminal. In existing technologies, taking Bluetooth barcode scanners as an example, after completing Bluetooth pairing, a connection is usually established with one host device, and the scanned ordinary barcode data is sent to that host device. When switching to another host device is required, the user needs to disconnect the current connection and re-search for, pair, or reconnect to the Bluetooth device. This process requires the user to enter the Bluetooth configuration process of the host device or barcode scanner, which involves many steps and can easily affect the continuity of scanning operations in scenarios with frequent host switching. In addition, barcode scanners are typically held and used in complex environments such as warehouses, stores, and workstations, requiring high levels of casing strength, waterproofing, dustproofing, and long-term reliability. Adding a physical button for the main unit switching function would necessitate adding openings to the casing and designing it in conjunction with seals, button structures, and assembly processes. This would not only increase structural complexity and manufacturing costs but also potentially introduce risks such as water or dust ingress or mechanical failure.
[0018] In view of this, embodiments of this application provide a data transmission control method, apparatus, and barcode scanner for a barcode scanner. The barcode scanner pre-stores multiple host configuration files and distinguishes between ordinary barcode data and host switching configuration codes based on the decoded data obtained from scanning. When the decoded data is ordinary barcode data, the barcode scanner can send ordinary barcode data to the current host based on the current host configuration file; when the decoded data is a host switching configuration code, the barcode scanner can parse the target host identifier and establish a connection with the target host. This improves the data transmission efficiency of the barcode scanner in various application scenarios, reduces the impact of adding extra physical buttons on the structural design and sealing reliability of the barcode scanner, and improves the reliability of data transmission during host switching.
[0019] The following description is in conjunction with the accompanying drawings: Please refer to Figure 1 This document illustrates a flowchart of a data transmission control method for a barcode scanner according to some embodiments of this application. This data transmission control method is applied to data transmission between multiple hosts of the barcode scanner. The barcode scanner stores multiple host configuration files corresponding to each host, and the host configuration files include the host's connection information. The data transmission control method includes: S110: Obtain the decoded data obtained after the barcode is scanned by the barcode scanner; based on the decoded data, determine the data type of the scanned barcode, which includes: ordinary barcode data and host switching configuration code; S120: When the data type of the barcode is ordinary barcode data, send ordinary barcode data to the first host based on the current first host configuration file; S130: When the data type of the barcode is host switching configuration code, parse the host switching configuration code to determine the target host identifier; S140: Determine a second host profile from multiple host profiles based on the target host identifier; S150: When the preset switching conditions are met, the first host configuration file is switched to the second host configuration file, and a connection is established with the second host based on the connection information in the second host configuration file; wherein, the preset switching conditions include: the ordinary barcode data to be sent has been sent, or the ordinary barcode data to be sent has been saved to the pending processing cache.
[0020] In the above embodiments, the host device can be a computer, tablet device, POS terminal, inventory terminal, or other electronic device capable of receiving barcode data. The barcode scanner and the host can establish a communication connection via a wired or wireless connection. Wired connections can include connections established through data cables, interface sockets, or adapters, such as connections via USB interfaces, serial ports, or other data transmission interfaces. Wireless connections can include Bluetooth, wireless LAN, short-range wireless communication, proprietary wireless communication protocols, or other wireless communication methods capable of data transmission. For example, when the barcode scanner is a Bluetooth scanner, the scanner can establish a Bluetooth connection with the corresponding host based on the connection information in the host configuration file, and send ordinary barcode data to the host through this Bluetooth connection. Multiple pre-stored host configuration files can each correspond to a host, and the barcode scanner can establish a connection with the corresponding host through the connection information.
[0021] The decoded data obtained after a barcode scanner scans a barcode can carry characters, numbers, encoded fields, or other data content that can be recognized by the scanner. Based on this content, the data type of the currently scanned barcode is determined. For example, ordinary barcode data can be product barcodes, material barcodes, process barcodes, inventory barcodes, or other barcode data that needs to be sent to the host for business processing. The host switching configuration code can be data used to trigger a host switch, instructing the scanner to switch from the current host to the target host.
[0022] When the barcode data type is ordinary barcode data, it indicates that the purpose of this scan is to upload business data to the current host. In this case, the barcode scanner can send ordinary barcode data to the first host based on the current first host configuration file. The first host configuration file can be understood as the host configuration file currently used by the barcode scanner for data transmission, and the first host is the host currently receiving the scanned data. Therefore, without triggering a host switch, the ordinary barcode data scanned by the barcode scanner can continue to be sent to the current host, thus maintaining the continuity of the scanning operation.
[0023] When the barcode data type is a host switch configuration code, it indicates that the purpose of this scan is not to upload business data, but to trigger a switch of the data transmission object for the barcode scanner. In this case, the barcode scanner can parse the host switch configuration code to determine the target host identifier. The target host identifier can be used to indicate the host the user wishes to switch to. After obtaining the target host identifier, the barcode scanner can determine the second host configuration file from multiple stored host configuration files based on this identifier; that is, the host configuration file corresponding to the target host. The second host is the target host to be switched to. The previously established connection with the first host can be disconnected or maintained.
[0024] Furthermore, after determining the second host configuration file, it is possible to further determine whether preset switching conditions are met. This is used to limit the timing of host switching by the barcode scanner, thereby reducing data anomalies caused by incomplete transmission of ordinary barcode data during the switching process. For example, if the ordinary barcode data to be sent has already been sent, it indicates that the barcode scanner has completed the upload processing of the current business data before the host switching; if the ordinary barcode data to be sent has been saved to the pending processing cache, it indicates that the barcode scanner has saved the ordinary barcode data that has not yet been sent before the host switching, ensuring that the ordinary barcode data is not lost during the host switching process.
[0025] By determining preset switching conditions, the barcode scanner can switch from a first host configuration file to a second host configuration file and establish a connection with the second host based on the connection information in the second host configuration file. This allows the data transmission target of the barcode scanner to switch from the first host to the second host. After the switch is complete, subsequent scans of ordinary barcode data can be sent to the second host, enabling the same barcode scanner to be used across multiple hosts. Therefore, users can trigger the host switching process by scanning the host switching configuration code without needing to set up an additional physical button for host switching or perform complex connection settings each time a host is switched.
[0026] The data transmission control method provided in this application can utilize the existing scanning input capability of the barcode scanner to complete the input of host switching commands, making it more convenient for the barcode scanner to switch data transmission objects between multiple hosts. Simultaneously, since host switching is performed after the currently pending ordinary barcode data has been sent, or after the currently pending ordinary barcode data has been saved to the processing cache, the risk of data loss caused by the incomplete sending of ordinary barcode data during the switching process can be reduced, thereby improving the continuity and reliability of data transmission in multi-host shared scenarios. Furthermore, since no additional physical buttons are needed for switching between multiple host connections, the physical protection level of the barcode scanner in complex working environments is further improved, extending the service life of the barcode scanner.
[0027] In some embodiments of this application, obtaining decoded data after a barcode scanner scans a barcode includes: decoding the collected barcode image to obtain decoded data; determining the data type of the scanned barcode based on the decoded data, including: matching the decoded data with a preset switching instruction identifier; when the match is successful, determining the data type of the barcode as a host switching configuration code; when the match is unsuccessful, determining the data type of the barcode as ordinary barcode data.
[0028] In the above embodiments, the barcode image can be a one-dimensional barcode image, a two-dimensional barcode image, or other coded images that can be recognized by a barcode scanner. The decoded data can be the characters, numbers, symbol combinations, or other coded content carried in the barcode image, and the data type of the scanned barcode is determined based on this. The preset switching instruction identifier can be an identifier field used to distinguish between host switching configuration codes and ordinary barcode data. The decoded data is matched with the preset switching instruction identifier to determine whether the decoded data contains instruction content used to trigger host switching. When the match is successful, it can be determined that the currently scanned barcode is a host switching configuration code. In this case, the barcode scanner does not send the decoded data to the current host as ordinary barcode data, but instead uses the decoded data as data for subsequent processing to perform host switching. When the match fails, it can be determined that the currently scanned barcode is ordinary barcode data, which can be processed as business data and sent to the first host based on the current first host configuration file. Therefore, the barcode scanner can maintain the normal data upload process when scanning ordinary barcodes, and can enter the host switching process when scanning host switching configuration codes.
[0029] In some embodiments of this application, establishing a connection with the second host based on the connection information in the second host configuration file includes: determining whether the barcode scanner stores a historical connection record corresponding to the second host based on the connection information in the second host configuration file; if a historical connection record is stored, initiating a reconnection request to the second host based on the historical connection record; if no historical connection record is stored, performing a connection configuration process with the second host based on the connection information in the second host configuration file; and after establishing a connection with the second host, sending the subsequently scanned ordinary barcode data to the second host.
[0030] Historical connection records are connection logs created and saved after a barcode scanner previously established a connection with the second host. These records indicate that the scanner has previously established a connection with the second host, and the scanner can re-establish a connection based on these historical records. After determining the second host's configuration file, the scanner can first check the connection information in the configuration file to see if it already has a corresponding historical connection record stored locally. If the scanner does have such a record, it means it has previously established a connection with the second host. In this case, the scanner can initiate a reconnection request based on this historical record. This method allows the scanner to attempt to restore the connection with the second host without re-executing the entire connection configuration process, thus shortening the connection waiting time during host switching.
[0031] If the barcode scanner does not have a historical connection record for the second host, it means that the barcode scanner has not previously established a connection with the second host, or that no record for reconnection is saved locally. In this case, the barcode scanner can perform a connection configuration process with the second host based on the connection information in the second host's configuration file. Therefore, the barcode scanner can establish a new connection with the second host even in the absence of historical connection records, based on the connection information in the second host's configuration file.
[0032] In some embodiments of this application, after establishing a connection with the second host based on the connection information in the second host configuration file, the method further includes: maintaining the connection between the barcode scanner and the first host, and the connection between the barcode scanner and the second host; updating the current data transmission target from the first host to the second host, and determining the second host configuration file as the host configuration file currently used for transmitting ordinary barcode data; when the data type of the subsequently scanned barcode is ordinary barcode data, sending the subsequently scanned ordinary barcode data to the second host based on the second host configuration file and the connection with the second host; when a host switching configuration code pointing to the first host is obtained again, updating the current data transmission target from the second host to the first host, and sending the subsequently scanned ordinary barcode data to the first host through the maintained connection with the first host.
[0033] Although the barcode scanner has established a connection with the second host, in this application, the barcode scanner can maintain a connection with the first host, but the data transmission target is updated to the second host. When the barcode scanner subsequently scans and obtains ordinary barcode data, it sends this ordinary barcode data to the second host. At this time, although the barcode scanner still maintains a connection with the first host, the transmission target of the ordinary barcode data has been switched to the second host, so subsequent ordinary barcode data will not be sent to the first host. When the barcode scanner obtains the host switching configuration code pointing to the first host again, it can update the current data transmission target from the second host to the first host and reset the first host configuration file as the current host configuration file used for sending ordinary barcode data. Since the connection between the barcode scanner and the first host is still maintained, the barcode scanner can send subsequently scanned ordinary barcode data to the first host through the maintained connection. This process allows the barcode scanner to switch the data transmission target while maintaining connections with multiple hosts when frequently switching between them, thereby reducing the waiting time caused by repeated disconnections and reconnections and improving the data transmission continuity of the barcode scanner in multi-host shared scenarios.
[0034] In some embodiments of this application, when the data type of the barcode is a host switching configuration code, parsing the host switching configuration code to determine the target host identifier includes: parsing the host switching configuration code to obtain the device identifier, verification information, and the target host identifier; determining whether the device identifier matches the local identifier of the barcode scanner, and verifying the host switching configuration code based on the verification information; when the device identifier matches the local identifier and the verification information passes the verification, the target host identifier is determined to be valid; when the device identifier does not match the local identifier, or the verification information fails the verification, host switching based on the host switching configuration code is prohibited.
[0035] Since the barcode scanner in this application receives host switching commands by scanning barcodes, if any barcode can trigger host switching, the scanner may be incorrectly switched to an unexpected host. For example, some data in ordinary barcode data used as product barcodes may be identical to the host switching configuration code, posing a risk of incorrect scanner switching. Therefore, this application can set device identifiers and verification information in the host switching configuration code to determine the applicable object and data validity of the host switching configuration code.
[0036] The device identifier can be used to indicate the barcode scanner corresponding to the host switching configuration code, or to indicate the range of barcode scanners that the host switching configuration code is allowed to control. The local identifier can be the device number, device serial number, device address, or other identifier stored within the barcode scanner itself that can distinguish the barcode scanner device. After the barcode scanner parses the device identifier, it can match the device identifier with the local identifier. If the device identifier matches the local identifier, it means that the host switching configuration code can be used with the current barcode scanner; if the device identifier does not match the local identifier, it means that the host switching configuration code is not used with the current barcode scanner, and the barcode scanner can prohibit host switching based on this host switching configuration code. Verification information can be used to verify whether the data in the host switching configuration code is complete or has been tampered with. The barcode scanner can verify the host switching configuration code based on the verification information. If the verification passes, it means that the host switching configuration code meets the preset data validity requirements; if the verification fails, it means that the host switching configuration code may have data errors, abnormal formatting, or does not meet the preset generation rules, and the barcode scanner can prohibit host switching based on this host switching configuration code. Therefore, only host switching configuration codes that meet the device matching and verification requirements will trigger the subsequent host switching process, thereby reducing the possibility of ordinary barcodes, incorrect configuration codes, or configuration codes that do not correspond to the current barcode scanner accidentally triggering host switching, and improving the accuracy and security of the multi-host switching process.
[0037] In some embodiments of this application, when the data type of the barcode is a host switching configuration code, the method further includes: entering a switching protection state to prohibit the transmission of the host switching configuration code as ordinary barcode data to the first host; detecting whether there is any ordinary barcode data that has not yet been transmitted; if there is any ordinary barcode data that has not yet been transmitted, generating a cache record corresponding to the ordinary barcode data that has not yet been transmitted, and saving the cache record to the pending processing cache; wherein, the cache record includes: ordinary barcode data, data generation sequence identifier, and sending object identifier; wherein, the sending object identifier of ordinary barcode data obtained before the host switching configuration code and not yet transmitted is the first host, and the sending object identifier of ordinary barcode data obtained after the host switching configuration code and before establishing a connection with the second host is the second host; after establishing a connection with the second host, transmission control is performed on the ordinary barcode data in the pending processing cache based on the sending object identifier and the data generation sequence identifier.
[0038] The switching protection state in this application can be understood as a temporary control state that the barcode scanner enters after recognizing the host switching configuration code but before completing the host switching. In this state, the barcode scanner no longer directly sends the currently decoded data according to the processing method for ordinary barcode data. Instead, it first distinguishes between the host switching configuration code and the ordinary barcode data that has not yet been sent. This prevents the host switching configuration code from being mistakenly sent to the first host as ordinary barcode data.
[0039] Upon entering the handover protection state, it checks whether there is any unsent regular barcode data, such as data that has been scanned and decoded but not yet transmitted through the connection with the first host. If so, a cache record corresponding to this regular barcode data is generated and saved to the pending processing cache. This allows recording the regular barcode data, data generation sequence identifier, and destination identifier. The data generation sequence identifier indicates the generation order of this regular barcode data relative to other regular barcode data, and the destination identifier indicates the host to which the regular barcode data should be sent. By setting the data generation sequence identifier and destination identifier in the cache record, the transmission order and destination of the cached data can be determined during subsequent transmission, thus preventing regular barcode data from being sent to the wrong host due to changes in host connection status before and after the handover.
[0040] In some embodiments of this application, the method further includes: obtaining registration decoding data obtained after the barcode scanner scans the host registration configuration code; parsing the registration decoding data to obtain the host identifier and connection information of the host to be registered; generating a host configuration file corresponding to the host to be registered, or updating the stored host configuration file, based on the host identifier and connection information of the host to be registered; and storing the generated or updated host configuration file in the barcode scanner so that the barcode scanner establishes a connection with the corresponding host based on the host configuration file.
[0041] The host registration configuration code can be generated by the host to be registered, the management terminal, or the configuration tool. After being scanned by a barcode scanner, it can be used to write or update the host configuration file. When the barcode scanner decodes the host registration configuration code, it obtains registration decoding data to determine the host identifier and connection information of the host to be registered. The host identifier is used to distinguish different hosts, and the connection information is used by the barcode scanner to establish a connection with the corresponding host. The barcode scanner can then generate a host configuration file corresponding to the host to be registered and store it locally. If the barcode scanner already has a host configuration file corresponding to the host identifier stored, it can update the stored host configuration file based on the connection information in the registration decoding data. Therefore, when the host's connection information changes, or when the host connection relationship needs to be reconfigured, the user can complete the configuration update by scanning the host registration configuration code.
[0042] In some embodiments of this application, the process of establishing a connection with a second host based on the connection information in the second host configuration file further includes: determining whether a connection with the second host has been successfully established within a preset time period; when a connection with the second host is successfully established within the preset time period, determining the second host configuration file as the current host configuration file, and outputting a successful switch prompt message in a haptic manner, the haptic manner including one or more of the following: vibration prompt and sound prompt; when a connection with the second host is not successfully established within the preset time period, determining that the host switch has failed, restoring the first host configuration file to the current host configuration file, and outputting a switch failure prompt message; after determining that the host switch has failed, maintaining or restoring the connection with the first host based on the first host configuration file, or keeping the ordinary barcode data in the pending cache from being sent.
[0043] In the above embodiments, when the barcode scanner establishes a connection with the second host, a preset time period can be set to determine whether the host switch is successful. The preset time period can be set according to the connection method between the barcode scanner and the host, the connection response time, or actual usage requirements. When a connection is successfully established within the preset time period, the barcode scanner can determine the second host configuration file as the current host configuration file, allowing subsequent ordinary barcode data to be sent to the second host based on the second host configuration file. Furthermore, considering the manufacturing cost of barcode scanners, they often do not have a user-observable interface. Therefore, the barcode scanner of this application can output a successful switch notification message in a haptic manner, allowing the user to perceive the current host switch result without observing a display interface. For example, the haptic method can output a notification sound through a buzzer, or a vibration notification through a vibrator, or both. When the barcode scanner fails to establish a connection with the second host within the preset time period, the host switch failure can also be determined through the aforementioned haptic notification method, which differs from the successful connection notification.
[0044] In addition, after determining that the host switchover has failed, the barcode scanner can maintain or restore the connection with the first host based on the first host configuration file. For ordinary barcode data in the pending cache, the barcode scanner can keep the ordinary barcode data from being sent, so as to avoid sending ordinary barcode data to the wrong host when the host switchover status is unclear.
[0045] Figure 2 The diagram illustrates a data transmission control device for a barcode scanner according to some embodiments of this application. The data transmission control device includes: an acquisition unit 210 for acquiring decoded data obtained after the barcode scanner scans a barcode; a type determination unit 220 for determining the data type of the scanned barcode based on the decoded data, where the data type includes: ordinary barcode data and a host switching configuration code; a sending unit 230 for sending ordinary barcode data to a first host based on the current first host configuration file when the barcode data type is ordinary barcode data; a parsing unit 240 for parsing the host switching configuration code and determining a target host identifier when the barcode data type is a host switching configuration code; a configuration determination unit 250 for determining a second host configuration file from multiple host configuration files based on the target host identifier; and a switching connection unit 260 for switching the first host configuration file to the second host configuration file when preset switching conditions are met, and establishing a connection with the second host based on the connection information in the second host configuration file; wherein the preset switching conditions include: the ordinary barcode data to be sent has been sent, or the ordinary barcode data to be sent has been saved to a pending processing cache.
[0046] Based on the same technical concept, this application also provides a barcode scanner, comprising: a scanning module for acquiring barcode images; a decoding module connected to the scanning module for decoding the barcode images to obtain decoded data; a storage module for storing multiple host configuration files, each corresponding to a host and including host connection information; a communication module for establishing a connection with the host and transmitting data; and a control module connected to the decoding module, storage module, and communication module, for determining the data type of the scanned barcode based on the decoded data, wherein the data type includes ordinary barcode data and host switching configuration codes; wherein the control module is further configured to determine the data type of the barcode when the data type is ordinary barcode data. According to the current first host configuration file, ordinary barcode data is sent to the first host through the communication module; when the data type of the barcode is a host switching configuration code, the host switching configuration code is parsed to determine the target host identifier, and the second host configuration file is determined from multiple host configuration files based on the target host identifier; and when preset switching conditions are met, the first host configuration file is switched to the second host configuration file, and the communication module is controlled to establish a connection with the second host based on the connection information in the second host configuration file; wherein, the preset switching conditions include: the ordinary barcode data to be sent has been sent, or the ordinary barcode data to be sent has been saved to the pending processing cache.
[0047] The data transmission control device and the specific implementation process and beneficial effects of the barcode scanner described above can be found in the content of the data transmission control method of the barcode scanner mentioned above, and will not be repeated here.
[0048] To keep the drawings simple, each figure only schematically shows the parts relevant to the embodiments, and they do not represent the actual structure of the product. In addition, for the sake of clarity and ease of understanding, some figures only schematically show parts of components with the same structure or function, and there may actually be more or fewer components with the same structure or function.
Claims
1. A data transmission control method for a barcode scanner, characterized in that, A data transmission control method is applied to multiple hosts of a barcode scanner, wherein the barcode scanner stores multiple host configuration files corresponding to the hosts, and the host configuration files include connection information of the hosts. Obtain the decoded data obtained after the barcode is scanned by the barcode scanner; Based on the decoded data, the data type of the scanned barcode is determined, and the data type includes: ordinary barcode data and host switching configuration code; When the data type of the barcode is ordinary barcode data, the ordinary barcode data is sent to the first host based on the current first host configuration file; When the data type of the barcode is a host switching configuration code, the host switching configuration code is parsed to determine the target host identifier; Based on the target host identifier, a second host configuration file is determined from a plurality of host configuration files; When the preset switching conditions are met, the first host configuration file is switched to the second host configuration file, and a connection is established with the second host based on the connection information in the second host configuration file. The preset switching conditions include: the ordinary barcode data to be sent has been sent, or the ordinary barcode data to be sent has been saved to the processing cache.
2. The data transmission control method for a barcode scanner according to claim 1, characterized in that, The decoded data obtained after the barcode is scanned by the barcode scanner includes: The decoded data is obtained by decoding the collected barcode image; Based on the decoded data, determining the data type of the scanned barcode includes: The decoded data is matched with a preset switching instruction identifier; When a match is successful, the data type of the barcode is determined to be the host switching configuration code; If a match fails, the data type of the barcode is determined to be the ordinary barcode data.
3. The data transmission control method for a barcode scanner according to claim 1, characterized in that, Based on the connection information in the second host configuration file, establish a connection with the second host, including: Based on the connection information in the second host configuration file, determine whether the barcode scanner stores historical connection records corresponding to the second host; If the historical connection records are stored, a reconnection request is initiated to the second host based on the historical connection records; If the historical connection record is not stored, then a connection configuration process is performed with the second host based on the connection information in the second host configuration file; After establishing a connection with the second host, the ordinary barcode data obtained from subsequent scanning is sent to the second host.
4. The data transmission control method for a barcode scanner according to claim 3, characterized in that, After establishing a connection with the second host based on the connection information in the second host configuration file, the process also includes: Maintain the connection between the barcode scanner and the first host, as well as the connection between the barcode scanner and the second host; The current data transmission target is updated from the first host to the second host, and the configuration file of the second host is determined as the host configuration file currently used for ordinary barcode data transmission; When the data type of the barcode scanned subsequently is ordinary barcode data, the ordinary barcode data obtained from the subsequent scan is sent to the second host through the connection between the second host configuration file and the second host. When the host switching configuration code pointing to the first host is obtained again, the current data sending target is updated from the second host to the first host, and the ordinary barcode data obtained from subsequent scanning is sent to the first host through the connection maintained with the first host.
5. The data transmission control method for a barcode scanner according to claim 1, characterized in that, When the data type of the barcode is a host switching configuration code, the host switching configuration code is parsed to determine the target host identifier, including: Parse the host switching configuration code to obtain the device identifier, verification information, and target host identifier; Determine whether the device identifier matches the local identifier of the barcode scanner, and verify the host switching configuration code based on the verification information; When the device identifier matches the local identifier and the verification information passes the verification, the target host identifier is determined to be valid; When the device identifier does not match the local identifier, or when the verification information fails verification, host switching based on the host switching configuration code is prohibited.
6. The data transmission control method for a barcode scanner according to claim 1, characterized in that, When the data type of the barcode is a host switching configuration code, it also includes: Enter the switching protection state and prohibit the host switching configuration code from being sent to the first host as ordinary barcode data; Detect whether there is any ordinary barcode data that has not yet been sent; If there is any ordinary barcode data that has not yet been sent, a cache record corresponding to the ordinary barcode data that has not yet been sent is generated, and the cache record is saved to the cache to be processed. The cached record includes: ordinary barcode data, data generation sequence identifier, and sending object identifier; The first host is identified as the recipient of ordinary barcode data that was obtained before the host configuration code was switched and has not yet been sent. The second host is identified as the recipient of ordinary barcode data that was obtained after the host configuration code was switched and before the connection with the second host was established. After establishing a connection with the second host, the transmission control is performed on the ordinary barcode data in the pending cache based on the sending object identifier and the data generation sequence identifier.
7. The data transmission control method for a barcode scanner according to any one of claims 1 to 6, characterized in that, Also includes: Obtain the registration decoding data obtained after the barcode scanner scans the host registration configuration code; The registration decoding data is parsed to obtain the host identifier and connection information of the host to be registered; Based on the host identifier and connection information of the host to be registered, generate a host configuration file corresponding to the host to be registered, or update the stored host configuration file; The generated or updated host configuration file is stored in the barcode scanner so that the barcode scanner can establish a connection with the corresponding host based on the host configuration file.
8. The data transmission control method for a barcode scanner according to any one of claims 1 to 6, characterized in that, The process of establishing a connection with the second host based on the connection information in the second host configuration file also includes: Determine whether a connection with the second host has been successfully established within a preset time period; When a connection with the second host is successfully established within the preset time period, the second host configuration file is determined as the current host configuration file, and a successful switch prompt message is output in a motion sensing manner. The motion sensing manner includes one or more of the following: vibration prompt and sound prompt. If a connection with the second host is not successfully established within the preset time period, the host switching is determined to have failed, the first host configuration file is restored to the current host configuration file, and a switching failure prompt message is output. If the host switchover fails, based on the first host configuration file, either maintain or restore the connection with the first host, or keep the ordinary barcode data in the pending cache from being sent.
9. A data transmission control device for a barcode scanner, characterized in that, A data transmission control device is used for data transmission between multiple hosts of a barcode scanner. The barcode scanner stores multiple host configuration files corresponding to each host, and each host configuration file includes connection information for the host. The data transmission control device includes: The acquisition unit is used to acquire the decoded data obtained by the barcode scanner after scanning the barcode; A type determination unit is used to determine the data type of the scanned barcode based on the decoded data, wherein the data type includes: ordinary barcode data and host switching configuration code; The sending unit is configured to send the ordinary barcode data to the first host based on the current first host configuration file when the data type of the barcode is ordinary barcode data. The parsing unit is used to parse the host switching configuration code and determine the target host identifier when the data type of the barcode is host switching configuration code; A configuration determining unit is configured to determine a second host configuration file from a plurality of host configuration files based on the target host identifier; The connection switching unit is used to switch the first host configuration file to the second host configuration file when a preset switching condition is met, and to establish a connection with the second host based on the connection information in the second host configuration file. The preset switching conditions include: the ordinary barcode data to be sent has been sent, or the ordinary barcode data to be sent has been saved to the processing cache.
10. A barcode scanner, characterized in that, include: The barcode scanning module is used to capture barcode images; A decoding module, connected to the scanning module, is used to decode the barcode image to obtain decoded data; A storage module is used to store multiple host configuration files, each host configuration file corresponding to a host and including the connection information of the host. The communication module is used to establish a connection with the host and transmit data. The control module is connected to the decoding module, the storage module and the communication module respectively, and is used to determine the data type of the scanned barcode based on the decoded data. The data type includes ordinary barcode data and host switching configuration code. The control module is further configured to: when the data type of the barcode is ordinary barcode data, send the ordinary barcode data to the first host through the communication module based on the current first host configuration file; when the data type of the barcode is a host switching configuration code, parse the host switching configuration code, determine the target host identifier, and determine the second host configuration file from multiple host configuration files based on the target host identifier; and when a preset switching condition is met, switch the first host configuration file to the second host configuration file, and control the communication module to establish a connection with the second host based on the connection information in the second host configuration file. The preset switching conditions include: the ordinary barcode data to be sent has been sent, or the ordinary barcode data to be sent has been saved to the processing cache.