Scanner control system and computer equipment
By designing the interface layer, configuration layer, data layer and control layer of the scanner control system, monitoring the connection status of the scanner interface and automatically configuring it solves the problem of manual pairing of scanners in the existing system and realizes the thermal stability of the scanner. Automatic plug-in configuration improves configuration efficiency.
Patent Information
- Application Number
- CN202310906240.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-21
- Publication Date
- 2025-01-21
AI Technical Summary
The existing scanner control system needs to be manually paired when connecting to a new scanner, which is inconvenient to use and is difficult to achieve automatic hot-swap configuration of the scanner.
A scanner control system is designed, including the interface layer, configuration layer, data layer and control layer. By monitoring the connection status of the scanner interface, it automatically reads the configuration file corresponding to the scanner and configures it to realize the thermal management of the scanner. Plug and unplug automatic configuration.
It improves the configuration efficiency of the scanner, realizes the hot-swappable automatic configuration of the scanner, reduces the user's manual pairing steps, and improves the automation of the system.
Smart Images

Figure CN119336664A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of scanners, and in particular to a scanner control system and a computer device. Background Art
[0002] A scanner is a reading device used to read the information contained in a barcode. The light emitted by the scanner's light source passes through the optical system and irradiates the barcode symbol. The reflected light passes through the optical system and is imaged on the photoelectric converter, generating an electrical signal. The signal is amplified by the circuit to generate an analog voltage, which is proportional to the light reflected from the barcode symbol. After filtering and shaping, a square wave signal corresponding to the analog signal is formed, which is interpreted by the decoder as a digital signal that can be directly accepted by the computer and transmitted to the computer via a data line or wirelessly. The scanner can be used to scan the barcodes of goods or documents and is widely used in supermarkets, logistics and express delivery and other industries.
[0003] The scanner control system is used to receive and parse the scanning information of the scanner. However, the scanner control system can usually only process the scanning information of the paired scanner. Each time a new scanner is connected, the scanner needs to be paired, which is inconvenient to use. Summary of the invention
[0004] Embodiments of the present application provide a scanner control system and a computer device, which can improve the efficiency of scanner configuration.
[0005] In a first aspect, an embodiment of the present application provides a scanner control system, comprising: an interface layer, a configuration layer, a data layer and a control layer; the control layer is respectively connected to the interface layer, the configuration layer and the data layer for communication;
[0006] The interface layer is used to monitor the connection status of the scanner interface and determine whether the scanner is connected to the scanner interface, and when monitoring that the scanner is connected to the scanner interface, send access information to the control layer;
[0007] The configuration layer stores at least one configuration file;
[0008] The control layer controls the configuration layer to read the configuration file corresponding to the scanner and configure the scanner according to the access information, and controls the data layer to obtain the scanning data of the scanner through the interface layer.
[0009] In a second aspect, an embodiment of the present application provides a computer device, comprising at least one scanner interface and a scanner control system as described in any one of the above;
[0010] The scanner interface is used to connect a scanner.
[0011] In the embodiment of the present application, the interface layer is used to monitor the connection status of the scanner interface. When the scanner is monitored to be connected to the scanner interface, the configuration layer is controlled to read the configuration file corresponding to the scanner and configure the scanner. At the same time, the control layer controls the data layer to obtain the scanning data of the scanner through the interface layer. In the present application, only the connection status of the scanner interface needs to be monitored to automatically configure according to the scanner connected to the scanner interface. The present application can realize the automatic configuration of the scanner hot plug and play, and improve the configuration efficiency of the scanner. In order to better understand and implement, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 A schematic diagram of the structure of a scanner control system in one embodiment of the present invention;
[0013] Figure 2 A flowchart of a process of reading and writing data in a data message queue in one embodiment of the present invention;
[0014] Figure 3 It is a schematic diagram of the structure of the configuration layer 120 in one embodiment of the present invention;
[0015] Figure 4 This is a schematic diagram of the structure of the data layer 130 in one embodiment of the present invention;
[0016] Figure 5 It is a structural schematic diagram of a scanner control system in another embodiment of the present invention;
[0017] Figure 6 It is a schematic diagram of the structure of the driving layer 150 in one embodiment of the present invention;
[0018] Figure 7 It is a schematic diagram of the structure of the device layer 160 in one embodiment of the present invention;
[0019] Figure 8 This is a schematic diagram of the structure of the control layer 140 in one embodiment of the present invention;
[0020] Fig. 9 The figure is a schematic diagram of the structure of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to make the objectives, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0022] It should be clear that the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of the present application.
[0023] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms of "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0024] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims. In the description of the present application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects, and do not have to be used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.
[0025] In addition, in the description of this application, unless otherwise specified, "several" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0026] The scanner control system of the embodiment of the present application can be applied to scanners such as barcode scanners and scanning guns to implement the configuration of the scanner and the processing of scanned data.
[0027] See also Figure 1 , the present application provides a scanner control system, including: an interface layer 110, a configuration layer 120, a data layer 130 and a control layer 104;
[0028] The interface layer 110 is used to monitor the connection status of the scanner interface and determine whether the scanner is connected to the scanner interface. When the scanner is monitored to be connected to the scanner interface, the interface layer 110 sends access information to the control layer 104;
[0029] The control layer 104 controls the configuration layer 120 to read the configuration file corresponding to the scanner and configure the scanner according to the access information, and controls the data layer 130 to obtain the scanning data of the scanner through the interface layer.
[0030] The scanner and the scanner interface may be connected via a USB cable, a serial port cable or other communication connection methods.
[0031] The interface layer 110 may monitor the connection status of the scanner interface by periodically acquiring the connection status information of the scanner interface.
[0032] When the interface layer 110 monitors that a scanner is connected to the scanner interface, it sends access information to the control layer 104. The access information may include information such as the model, driver type, and connection method of the connected scanner.
[0033] After sending the access information to the control layer 104, if the interface layer 110 monitors that the scanner leaves the scanner interface, that is, the scanner is not connected to the scanner interface, it can send a disconnection message to the control layer 104, so that the control layer stops controlling the configuration layer 120 to read the configuration file corresponding to the scanner and configure the scanner, and / or stops controlling the data layer 130 to obtain the scanning data of the scanner through the interface layer.
[0034] The configuration layer 120 stores at least one configuration file, and the configuration layer 120 is used to read the configuration file corresponding to the scanner and configure the scanner.
[0035] Among them, the configuration layer 120 can pre-store configuration files in various formats such as xml, json and different device models. When obtaining the configuration file, the corresponding configuration file can be read to configure the scanner according to the device information such as the model of the specific connected scanner and the actual configuration requirements of the user.
[0036] The configuration layer of this application can store multiple different types of configuration files and support the expansion of configuration files in more formats. When the user needs the current system to support configuration files in more formats, he only needs to write the corresponding function code for the configuration operation according to the configuration requirements without affecting the normal functions of other levels of the system.
[0037] The interface layer 110 is used to monitor whether the scanning data of the scanner is received, and send the scanning data to the data layer 130;
[0038] The configuration layer 120 is used to read the configuration file of the scanner and configure the scanner;
[0039] The data layer 130 is used to receive and store scan data;
[0040] In this application, corresponding interface layers, configuration layers and data layers are set for scanner access, configuration and scanner data reception. The interface layers, configuration layers and data layers are independent of each other. The control layer interacts with each layer to realize the corresponding functions to be realized in each layer. Compared with the traditional scanner control system that relies on existing application development frameworks such as QT, which is easy to lead to limited development and reuse, this application splits and abstracts the functions to be realized by the scanner control system into separate layers. When the functions of this layer are needed, it is only necessary to connect with this layer through the control layer. When the user needs to add new functions or expand existing functions, it is only necessary to add a new function layer or develop in the existing function layer, which will not affect the realization of functions of other layers, thereby making it more convenient for function expansion and transplantation. When the scanner of this application interacts with the scanner control system, it only needs to connect the scanner to the scanner interface, and the scanner control system can automatically realize the reading, writing, storage and transmission of scanned data, without having to care about the specific internal structure of the scanner control system, thereby improving the reading and writing efficiency of scanned data.
[0041] In an embodiment of the present application, the interface layer is used to monitor the connection status of the scanner interface. When the scanner is monitored to be connected to the scanner interface, the configuration layer is controlled to read the configuration file corresponding to the scanner and configure the scanner. At the same time, the control layer controls the data layer to obtain the scanning data of the scanner through the interface layer. In the present application, it is only necessary to monitor the connection status of the scanner interface to automatically configure according to the scanner connected to the scanner interface. The present application can realize automatic configuration of the scanner hot plug and play and improve the configuration efficiency of the scanner. At the same time, the present application makes each level independent and the interface layer interacts with the scanner interface in a unified manner. When modifying and expanding the system functions, the user only needs to modify the function code of the corresponding level without having to re-involve and replace the docking interface, which is beneficial for users to develop and expand new system functions.
[0042] In the embodiment of the present application, the interface layer 110 is used to monitor the connection status of the scanner interface and obtain the scanning data of the scanner through the scanner interface.
[0043] Specifically, the interface layer 110 may set a data message queue to cache the scan data of the scanner, wherein the read and write operations of the scan data of the data message queue may be implemented by setting corresponding threads respectively to improve the data read and write efficiency.
[0044] In the embodiment of the present application, the interface layer 110 includes a data message queue; the data message queue can transmit scan data in a producer-consumer mode. Specifically, a scanner or a scanner interface that generates scan data is used as a producer, and a data message queue is used as a consumer. The data message queue includes at least one data reading thread and at least one data writing thread. The at least one data reading thread and at least one data writing thread are used to read and remove scan data from the data message queue. After the scan data is sent to the data layer 130, the scan data cached in the data message queue can be cleared.
[0045] The interface layer 110 is used to monitor the data transmission status of the scanner interface. When a data transmission signal is detected on the scanner interface, the data reading thread is used to obtain the scan data of the scanner, and the data writing thread is used to send the scan data to the data layer 130.
[0046] like Figure 2 As shown, it is a flow chart of the reading and writing process of data message queue data in one embodiment. In this application, the scanner that generates scan data is used as the producer, the data message queue is used as the consumer, and the transmitted data is scan data. First, the data message queue is initialized, and at least one data reading thread and at least one data writing thread are newly created to monitor the signal when the producer produces data. The signal is used to determine that a certain event has occurred to the producer. In the embodiment of the present application, the signal is that the producer generates scan data. When the signal that the producer generates data is received, it is determined whether the producer produces data. When it is determined that the producer generates data, the data reading thread is used to read the data generated by the producer, and the data writing thread is used to send the data to the data layer. In this process, the data reading thread and the data writing thread run in parallel without affecting each other, which can ensure the reading and writing security of the data and improve the reading and writing efficiency of the data.
[0047] Preferably, in order to avoid conflicts between the data reading thread and the data writing thread, the data reading thread and the data writing thread can be locked based on the read-write lock mechanism, and then the corresponding data reading thread and the data writing thread can be unlocked according to the condition variable, thereby avoiding multi-thread conflicts. In the embodiment of the present application, the condition variable can be a signal when the producer produces data and the scan data is obtained.
[0048] like Figure 3 As shown, in one embodiment, the configuration layer 120 includes a configuration file reading module 121, a default configuration module 122 and a configuration file distribution module 123;
[0049] The configuration file reading module 121 is used to read the configuration file corresponding to the scanner from the database according to the control instruction of the control layer and send it to the configuration file distribution module 123;
[0050] The configuration file reading module 121 is used to read the configuration file corresponding to the scanner model, manufacturer and other information.
[0051] The database can pre-store configuration files in various formats such as xml and json to meet the configuration requirements of scanners of different models. Users can also add configuration files of more formats to the database so that this application can meet the configuration requirements of more scanners.
[0052] The default configuration module 122 is used to obtain a preset configuration file and send it to the configuration file distribution module 123 when the configuration file reading module 121 fails to read the configuration file of the scanner;
[0053] The preset configuration file may be a user's default configuration file, or the configuration file may be a common configuration file for the scanner.
[0054] The configuration file distribution module 123 is used to distribute the configuration file to the corresponding scanner interface and configure the scanner according to the configuration file.
[0055] The scanner interface of the present application may be at least one. When it is monitored that at least one scanner interface has a scanner connected, that is, when it is connected to at least one scanner, the configuration file reading module 121 can be used to read the configuration files corresponding to each scanner respectively. For a scanner without a corresponding configuration file, the preset configuration file is read by the default configuration module 122, and the configuration file distribution module 123 is used to distribute it to the corresponding scanner interface to implement the configuration of at least one scanner.
[0056] like Figure 4 As shown, in one embodiment, the data layer 130 includes a data receiving module 131, a data filtering module 132 and a data uploading module 133;
[0057] The data receiving module 131 is used to receive the scan data;
[0058] The data filtering module 132 is used to filter the scanned data received by the data receiving module according to a preset filtering rule;
[0059] When the control layer 140 receives the data sharing request from the client, it sends a data sharing instruction to the data uploading module 133; wherein the data sharing instruction includes a sharing address;
[0060] The data uploading module 133 is used to upload the scanned data filtered by the data filtering module 132 to the shared address according to the data sharing instruction.
[0061] The data filtering module 132 can filter out duplicate or invalid data in the scanned data according to filtering rules. The filtering rules of the data filtering module 132 can be specifically set according to the filtering requirements of the user.
[0062] The shared address may be one shared address or multiple shared addresses.
[0063] Specifically, the shared address may be the address of the client sending the data sharing request, or the shared address may be the address of a client specified by the client sending the data sharing request, wherein the client of the shared address may be a client that establishes a communication connection with the scanner control system of the present application.
[0064] This application reduces the amount of scanned data through a data filtering module and improves the transmission efficiency of scanned data; and sends the data to a corresponding shared address through a data upload module to realize the sharing of scanned data.
[0065] like Figure 5 As shown, it is a schematic diagram of a scanner control system according to another embodiment of the present application. The scanner control system further includes a driving layer 150;
[0066] The control layer 140 controls the driver layer 150 to load the driver file corresponding to the scanner according to the access information.
[0067] The driver layer 150 is used to realize the communication between the scanner interface and the scanner control system. The driver file may be an interface configuration file written by the scanner manufacturer. After the driver layer 150 loads the driver file, the scanner interface establishes a communication connection with the scanner control system.
[0068] like Figure 6 As shown, the driver layer may include a USB driver module 151, a serial port driver module 152 or other driver modules; other driver modules may be set according to the interface type of the scanner interface.
[0069] The USB driver module 151 can be used to implement the driver of the USB interface.
[0070] The serial port driver module 152 can be used to implement a universal serial port driver.
[0071] The control layer 140 controls the USB driver module 151 or the serial port driver module 152 to load the driver file corresponding to the scanner according to the access information.
[0072] In one embodiment, the scanner control system further includes a device layer 160 , and the device layer 160 is used to manage at least one scanner connected to the scanner interface according to the device management instruction of the control layer 140 .
[0073] Specifically, the device layer 160 manages all connected scanners in a unified manner according to the device management instructions. Specifically, the control layer 140 manages all connected scanners in a singleton mode. In the singleton mode, the control layer 140 uses only one management program to control all connected scanners at a time, thereby avoiding management confusion and excessive occupation of computer resources caused by the sequential startup of management programs. For example, in the singleton mode, only one monitoring program is used to monitor the connection status of all scanner interfaces at a time. When a scanner is hot-plugged, the monitoring program can timely feedback the current connection status of each scanner interface, thereby avoiding management omissions when a scanner is hot-plugged, and also avoiding data confusion caused by different monitoring programs.
[0074] like Figure 7 As shown, the device layer 160 includes a device scanning module 161, a device filtering module 162 and a device registration module 163;
[0075] The device scanning module 161 is used to obtain access information of at least one scanner connected to the scanner interface;
[0076] The device filtering module 162 is used to filter abnormal scanners;
[0077] The device registration module 163 is used to receive registration information of a scanner and implement registration of the corresponding scanner.
[0078] In the present application, the user may register the connected scanner in advance in the device registration module 163 , so that when the interface layer 110 monitors the registered scanner accessing the scanner interface, it may quickly obtain the access information and send it to the control layer 140 .
[0079] The device filtering module 162 can be used to filter unregistered scanners or scanners with abnormal connections. Scanners filtered out by the device filtering module 162 can be regarded as scanners that are not connected to the scanner interface and are not configured or scanned data is not read or written.
[0080] like Figure 8 As shown, the control layer 140 may include a drive control module 141, a data processing module 142 and a device management module 143;
[0081] The driver control module 141 is used to control the driver layer 150 to load the driver file corresponding to the scanner;
[0082] The data processing module 142 is used to control the data layer 130 to receive and store the scan data. Specifically, the data processing module 142 controls the data receiving module 131 to receive the scan data, controls the data filtering module 132 to filter the scan data received by the data receiving module according to preset filtering rules, and sends a data sharing instruction to the data upload module 133 when receiving a data sharing request from the client, so that the data upload module 133 uploads the scan data filtered by the data filtering module 132 to the shared address according to the data sharing instruction.
[0083] The device management module 143 is used to issue device management instructions to the device layer 160 so that the device layer 160 can uniformly manage all connected scanners according to the device management instructions to obtain the access information of at least one scanner connected to the scanner interface, filter abnormal scanners and / or receive the registration information of the scanner and implement the registration of the corresponding scanner.
[0084] The scanner control system of the present application makes each level an independent library, and each level can be independently encapsulated without affecting each other. The user can choose to independently access a certain module or all modules according to the functional needs of the system, thereby reducing the coupling between the modules of the scanner control system. Compared with the traditional control system that needs to be bound to the business, the present application is more convenient for users to develop, expand and transplant subsequent functions; the present application only needs to monitor the connection status of the scanner interface to automatically read the configuration file and configure the scanner connected to the scanner interface as well as read and write data. The user does not need to care about how the scanner is specifically configured, driven, and the specific reading and writing process of the scanned data. The configuration layer of the present application supports a variety of different types of configuration files and extensions of the configuration files to meet the configuration requirements of different scanners; the present solution adopts a singleton mode to manage multiple scanners to avoid the problem of chaotic scanner data management caused by multiple instances; the present application can automatically identify, register and configure the scanner in the case of hot plugging, thereby improving the reading efficiency of the scanner's scanned data.
[0085] See also Fig. 9 , the present application also provides a computer device 200, comprising at least one scanner interface 201 and a scanner control system 202 as described in any one of the above;
[0086] The scanner interface 201 is used to connect to a scanner.
[0087] The scanner interface 201 can be set as a USB interface or a universal serial port according to the specific model of the scanner.
[0088] The scanner may be a barcode scanner, a scanning gun, or other instrument or device that can be used to scan a barcode.
[0089] The present invention is not limited to the above-mentioned embodiments. If various changes or modifications to the present invention do not depart from the spirit and scope of the present invention, and if these changes and modifications fall within the scope of the claims and equivalent technologies of the present invention, the present invention is also intended to include these changes and modifications.
Claims
1. A scanner control system, characterized in that: include: An interface layer, a configuration layer, a data layer and a control layer; the control layer is respectively connected to the interface layer, the configuration layer and the data layer for communication; The interface layer is used to monitor the connection status of the scanner interface and determine whether the scanner is connected to the scanner interface, and when monitoring that the scanner is connected to the scanner interface, send access information to the control layer; The configuration layer stores at least one configuration file; The control layer controls the configuration layer to read the configuration file corresponding to the scanner and configure the scanner according to the access information, and controls the data layer to obtain the scanning data of the scanner through the interface layer.
2. The scanner control system according to claim 1, characterized in that: The configuration layer includes a configuration file reading module, a default configuration module and a configuration file distribution module; The configuration file reading module is used to read the configuration file corresponding to the scanner from the database according to the control instruction of the control layer and send it to the configuration file distribution module; The default configuration module is used to obtain a preset configuration file and send it to the configuration file distribution module when the configuration file reading module fails to read the configuration file of the scanner; The configuration file distribution module is used to distribute the configuration file to the corresponding scanner interface and configure the scanner according to the configuration file.
3. The scanner control system according to claim 1, characterized in that: The interface layer includes a data message queue; the data message queue includes at least one data reading thread and at least one data writing thread; The interface layer is used to monitor the data transmission status of the scanner interface. When a data transmission signal is detected on the scanner interface, the data reading thread is used to obtain the scan data of the scanner, and the data writing thread is used to send the scan data to the data layer.
4. The scanner control system according to claim 1, characterized in that: The scanner control system also includes a driving layer; The control layer controls the driver layer to load the driver file corresponding to the scanner according to the access information.
5. The scanner control system according to claim 1, characterized in that: The driver layer includes a USB driver module and a serial port driver module; the control layer controls the USB driver module or the serial port driver module to load the driver file corresponding to the scanner according to the access information.
6. The scanner control system according to claim 1, characterized in that: The scanner control system further comprises a device layer; the device layer is used to manage at least one scanner connected to the scanner interface according to the device management instructions of the control layer.
7. The scanner control system according to claim 6, characterized in that: The device layer includes a device scanning module, a device filtering module and a device registration module; The device scanning module is used to obtain access information of at least one scanner connected to the scanner interface; The device filtering module is used to filter abnormal scanners; The device registration module is used to receive registration information of the scanner and implement registration of the scanner.
8. The scanner control system according to claim 1, characterized in that: The data layer includes a data receiving module, a data filtering module and a data uploading module; The data receiving module is used to receive the scan data; The data filtering module is used to filter the scanned data received by the data receiving module according to a preset filtering rule; When the control layer receives the data sharing request from the client, it sends a data sharing instruction to the data upload module; wherein the data sharing instruction includes a sharing address; The data uploading module is used to upload the scanned data filtered by the data filtering module to the shared address according to the data sharing instruction.
9. The scanner control system according to claim 1, characterized in that: The control layer adopts a singleton mode to manage all connected scanners; in the singleton mode, the control layer adopts only one management program at a time to control all connected scanners.
10. A computer device, characterized in that: comprising at least one scanner interface and a scanner control system as claimed in any one of claims 1 to 9; The scanner interface is used to connect a scanner.