WO2018040879A1 - 一种密码键盘usb通信异常恢复方法及系统 - Google Patents

一种密码键盘usb通信异常恢复方法及系统 Download PDF

Info

Publication number
WO2018040879A1
WO2018040879A1 PCT/CN2017/096824 CN2017096824W WO2018040879A1 WO 2018040879 A1 WO2018040879 A1 WO 2018040879A1 CN 2017096824 W CN2017096824 W CN 2017096824W WO 2018040879 A1 WO2018040879 A1 WO 2018040879A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
communication
module
command number
cryptographic keyboard
Prior art date
Application number
PCT/CN2017/096824
Other languages
English (en)
French (fr)
Inventor
林晖
吴闽星
Original Assignee
福建联迪商用设备有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 福建联迪商用设备有限公司 filed Critical 福建联迪商用设备有限公司
Publication of WO2018040879A1 publication Critical patent/WO2018040879A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/08Arrangements for detecting or preventing errors in the information received by repeating transmission, e.g. Verdan system
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0023Systems modifying transmission characteristics according to link quality, e.g. power backoff characterised by the signalling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • H04L1/1867Arrangements specially adapted for the transmitter end

Definitions

  • the present invention relates to the field of USB communication technologies, and in particular, to a password keyboard USB communication abnormality recovery method and system.
  • the PIN pad is one of the indispensable computer external devices for the financial checkout system. It is widely used in communication, government, transportation, government, industry and commerce, taxation, supermarket and other service industries. It is used in conjunction with banking systems, POS machines and management systems. Is used to enter a password.
  • a signature board module In the existing PIN pad, in addition to the password input module, a signature board module, an acoustic wave module, and a scanning module are integrated.
  • the connection between the terminal and the external PIN pad is normal, but due to the interference of the hardware or the influence of the surrounding environment, the terminal and the external PIN pad are temporarily disconnected, and then the normal situation is restored immediately. Although the connection to the external PIN pad is normal, the communication service has been disconnected.
  • the POS host mainly connects an external cryptographic keyboard through a USB port, and performs communication service data transmission through the USB.
  • the USB is disconnected due to interference, resulting in a communication process.
  • the underlying driver module cannot receive the response data and returns a timeout error, which causes the application to be interrupted due to non-human interference, which affects the normal operation of the application.
  • the inventor provides a cryptographic keyboard USB communication abnormality recovery method, and the cryptographic keyboard USB communication abnormality recovery method includes the following steps:
  • Each underlying driver module of the PIN pad inserts a command number in the respective communication data
  • the underlying driver module sends the original data again with the same command number
  • the connection device determines whether the command numbers of the received data are consistent. If yes, the data is repeatedly received, and the repeatedly received data is discarded. If not, the data is received.
  • the method further includes the following steps:
  • the communication abnormality of the cryptographic keyboard and the connection device includes data transmission failure and data reception timeout.
  • the communication data sent by each of the underlying driver modules of the cryptographic keyboard is further inserted with a module number corresponding to each of the underlying driver modules.
  • the inventor further provides a cryptographic keyboard USB communication abnormality recovery system, the cryptographic keyboard USB communication abnormality recovery system, comprising an insertion unit, a first determining unit, a second determining unit, a retransmitting unit and a receiving unit;
  • the insertion unit is used for each underlying driver module of the cryptographic keyboard, and inserts a command number in the respective communication data;
  • the first determining unit is configured to determine whether the communication between the PIN pad and the connected device is abnormal
  • the second determining unit is configured to: when the first determining unit determines that the communication is abnormal, each underlying driving module of the cryptographic keyboard determines whether the data needs to be retransmitted;
  • the retransmission unit is configured to: when the second determining unit determines that retransmission data is needed, the bottom driving module sends the original data again with the same command number;
  • the receiving unit is configured to connect the device to determine whether the command numbers of the received data are consistent. If yes, the data is repeatedly received, and the repeatedly received data is discarded. If not, the data is received.
  • the retransmission unit is further configured to determine whether the number of data retransmissions exceeds a preset maximum number of retransmissions before sending the original data again with the same command number, and if so, sending a timeout and updating the command number, if No, the original data is sent again with the same command number.
  • the communication abnormality of the cryptographic keyboard and the connection device includes data transmission failure and data reception timeout.
  • the inserting unit is further configured to insert, in the communication data sent by each of the bottom driver modules of the PIN pad, a module number corresponding to each of the bottom layer driving modules.
  • each underlying driver module determines whether it is necessary to resend the data, and each underlying driver retransmits the data to solve the communication abnormality problem,
  • each underlying driver module sends a command number to the sent message, and the same data is sent by the same command number, thereby avoiding repeated processing of the same command and synchronizing the command processing status of both sides of the communication; the technical solution consists of each underlying driver module.
  • the error processing is performed to solve the problem that the communication is disturbed and disconnected for a short time, and the design of the communication protocol can be simplified, and the command serial number mechanism is adopted to prevent repeated reception and transmission of the same command, thereby causing the communication parties to be out of synchronization or repeated operation problems.
  • FIG. 1 is a flowchart of a method for recovering an abnormality of a cryptographic keyboard USB communication according to a specific embodiment
  • connection device 2 is a flow chart of sending data by the connection device according to the specific embodiment
  • FIG. 3 is a flowchart of a data receiving response processing process of a connection device according to an embodiment
  • connection device event receiving response process is a flow chart of a connection device event receiving response process according to a specific embodiment
  • FIG. 5 is a block diagram of a cryptographic keyboard USB communication abnormality recovery system according to an embodiment of the present invention.
  • the first determining unit
  • a second determining unit
  • the USB keyboard communication abnormality recovery method includes the following steps:
  • connection device is a device connected to the PIN pad.
  • the connection device is preferably a POS machine
  • the PIN pad includes a numeric keyboard module, a signature board module and a scanner module, and each module Each includes a hardware circuit and a corresponding underlying driver module, wherein the numeric keypad module is configured to obtain digital information such as an input password, the signature board module is configured to acquire information such as a signature of the user, and the scanner is used to scan a one-dimensional code. Or QR code to be barcode information.
  • the digital keyboard module, the signature board module and the scanning gun module all have independent data processing capabilities, can implement data transceiving functions, and each module shares a USB communication interface.
  • Each of the underlying driver modules inserts a command number in each of the transmitted data when communicating normally with the connected device (ie, the host side), wherein the command numbers of the different data are different in order to facilitate distinguishing different data.
  • the transmitted data can be incremented by the command number in the order in which they are sent.
  • S102 Determine whether the communication between the password keyboard and the connected device is abnormal. If yes, the bottom keyboard driver module and the connection device of the password keyboard determine whether the data needs to be retransmitted.
  • the types of communication anomalies include data transmission failure and data reception timeout. When the PIN pad fails to send data to the connected device, or the connected device receives the timeout, the PIN pad needs to resend the data to the connection; and when the connected device fails to send or receives the timeout, the connected device needs to resend the data.
  • the bottom driving module and the connecting device have the same life.
  • the token sends the original data again.
  • the bottom keyboard driver module of the digital keyboard module, the signature board module and the scanner module support the data retransmission mechanism, and the maximum number of retransmissions is preset. When the data response sent by each underlying driver module times out and the number of retransmissions does not exceed the maximum number of retransmissions, the data is sent again with the same command number.
  • the connecting device and the bottom driving module determine whether the command number of the received data is consistent. If yes, the data is repeatedly received, and the repeatedly received data is discarded. If not, the data is received.
  • the underlying driver drives the retransmission data to solve the communication anomaly problem.
  • each underlying driver module introduces a command number by sending a message, and the same data is sent by the same command number, thereby avoiding the same command. Repeat processing, as well as the command processing status of both sides of the synchronous communication.
  • the USB communication interface protocol is only responsible for the basic data transmission functions such as data transmission and reception, and is not responsible for the judgment of data retransmission, and the data retransmission and discarding are judged by the respective underlying driver modules, thereby simplifying The design of the communication protocol, and by introducing a command sequence number mechanism, prevents repeated reception and transmission of the same command, causing the communication parties to be out of sync or repeat operation problems.
  • FIG. 2 is a flow chart of the data transmitted by the connected device when the communication abnormality recovery method is used for communication.
  • Connecting the device to send data includes the steps:
  • connection device determines whether the response after the data is timed out, if not, the communication is normal, returning a response, if timeout, then step S202;
  • step S202 it is determined whether data retransmission is supported, if not, then go to step S205; if data retransmission is supported, go to step S203;
  • step S203 it is determined whether the number of data retransmissions is full, if yes, go to step S205, if no, go to step S204;
  • step S204 the command number remains unchanged, resending the data; after the data is retransmitted, the process returns to step S201;
  • the update command number then sends the next data, and the communication times out.
  • connection device data reception response processing flow includes:
  • step S301 determining whether the data retransmission mechanism is supported, if yes, proceeding to step S302, if not, proceeding to step S305; processing the response data, updating the command number, that is, the command number is incremented by one;
  • step S302 extracting the command number of the data, and then proceeding to step S303;
  • step S303 determining whether the command number is repeated, that is, whether it is consistent, if yes, then go to step S304, if not, then go to step S305;
  • the data is repeatedly received, and the repeatedly received data is discarded.
  • the module numbers corresponding to the respective underlying driver modules are also inserted in the communication data sent by the underlying driver modules of the cryptographic keyboard.
  • the module number of the numeric keypad is 1.
  • the module of the signature board is 2.
  • the data sent by each underlying driver module includes the command number and the module number.
  • the format of the data sent by the underlying driver module is: protocol header + protocol length + module number + command number + each module command specific service data + count number + check + protocol tail.
  • the password keyboard uploads an event instruction to the connection device in addition to uploading data to the connection device.
  • the event instruction specifically refers to sending an instruction to the connection device to request the connection device to perform a corresponding operation.
  • an event number is inserted in the event instruction, and the event number is in effect, which is the same as the command number in the above embodiment.
  • a connection device event reception response processing flow is performed.
  • the connection device event receiving response processing flow is similar to the data receiving response processing flow, including:
  • step S402 extract the event number of the event instruction; and then go to step S403;
  • the command number is inserted in the communication data, and when the communication is abnormal, the passage is passed.
  • Each underlying driver module of the PIN pad determines whether it is necessary to resend the data, and resends the same data with the same command number.
  • On the connected device side it is determined by the judgment command number whether the data is duplicate data, thereby effectively solving the short password keyboard.
  • an embodiment of a cryptographic keyboard USB communication abnormality recovery system includes an insertion unit 10, a first determining unit 20, a second determining unit 30, a resending unit 40, and a receiving unit 50. .
  • the plug-in unit 10 is used for each of the underlying driver modules of the PIN pad and the connection device, and inserts a command number in the respective communication data.
  • the PIN pad includes a digital keyboard module, a signature board module and a scanner module. Each module includes a hardware circuit and a corresponding underlying driving module.
  • the digital keyboard module is configured to acquire digital information such as an input password, and the signature board.
  • the module is configured to acquire information such as a signature of a user, and the scanner is used to scan a one-dimensional code or a two-dimensional code to be bar code information.
  • Each of the underlying driver modules inserts a command number in each of the transmitted data when communicating normally with the connected device (ie, the host side), wherein the command numbers of the different data are different in order to facilitate distinguishing different data.
  • the transmitted data can be incremented by the command number in the order in which they are sent.
  • the first determining unit 20 is configured to determine whether the communication between the PIN pad and the connected device is abnormal.
  • the second determining unit 30 is configured to determine, when the first determining unit determines that the communication is abnormal, the bottom keyboard driving module and the connecting device of the cryptographic keyboard. Whether to resend data; the type of communication exception includes data transmission failure and data reception timeout.
  • the PIN pad fails to send data to the connected device, or the connected device receives the timeout, the PIN pad needs to resend the data to the connection; and when the connected device fails to send or receives the timeout, the connected device needs to resend the data.
  • the retransmission unit 40 is configured to: when the second determining unit determines that retransmission data is needed, the bottom driving module and the connecting device send the original data again with the same command number.
  • the bottom keyboard driver module of the digital keyboard module, the signature board module and the scanner module support the data retransmission mechanism, and the maximum number of retransmissions is preset. When the data response sent by each underlying driver module times out, it is resent If the number of times does not exceed the maximum number of retransmissions, the data is sent again with the same command number.
  • the receiving unit 50 is configured to connect the device to the underlying driving module to determine whether the command number of the received data is consistent. If yes, the data is repeatedly received, and the repeatedly received data is discarded. If not, the data is received.
  • the underlying driver drives the retransmission data to solve the communication anomaly problem.
  • each underlying driver module introduces a command number by sending a message, and the same data is sent by the same command number, thereby avoiding the same command.
  • the technical solution can simplify the design of the communication protocol, and use the command serial number mechanism to prevent repeated reception and transmission of the same command, causing the communication parties to be out of sync or repeated operation problems.
  • the plug-in unit is further configured to insert, in the communication data sent by each of the underlying driver modules of the cryptographic keyboard, a module number corresponding to each of the underlying driver modules.
  • a module number corresponding to each of the underlying driver modules For example, the module number of the numeric keypad is 1.
  • the module of the signature board is 2.
  • the data sent by each underlying driver module includes the command number and the module number.
  • the format of the data sent by the underlying driver module is: protocol header + protocol length + module number + command number + each module command specific service data + count number + check + protocol tail.
  • the computer device includes but is not limited to: a personal computer, a server, a general purpose computer, a special purpose computer, a network device, an embedded device, a programmable device, a smart mobile terminal, a smart home device, a wearable smart device, a vehicle smart device, and the like;
  • the storage medium includes, but is not limited to, a RAM, a ROM, a magnetic disk, a magnetic tape, an optical disk, a flash memory, a USB flash drive, a mobile hard disk, a memory card, a memory stick, a network server storage, a network cloud storage, and the like.
  • the computer program instructions can also be stored in a computer device readable memory that can direct the computer device to operate in a particular manner, such that instructions stored in the computer device readable memory produce an article of manufacture comprising the instruction device, the instruction device being implemented in the process Figure One or more processes and/or block diagrams of the functions specified in a block or blocks.
  • These computer program instructions can also be loaded onto a computer device such that a series of operational steps are performed on the computer device to produce computer-implemented processing, such that instructions executed on the computer device are provided for implementing one or more processes in the flowchart And/or block diagram of the steps of a function specified in a box or blocks.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Input From Keyboards Or The Like (AREA)
  • Detection And Prevention Of Errors In Transmission (AREA)

Abstract

本发明涉及USB通信技术领域,发明人提供了一种密码键盘USB通信异常恢复方法及系统,该方法包括以下步骤:密码键盘各底层驱动模块,在各自的通信数据中插入命令号;判断通信是否异常,若是,则密码键盘各底层驱动模块,判断是否需要重发数据;若需要重发数据,则底层驱动模块,以相同的命令号再次发送原数据;连接设备判断接收到的数据的命令号是否一致,若是,则丢弃重复接收数据,若否,则接收该数据。本发明技术方案由各个底层驱动模块进行出错处理,解决通信受干扰而短时间断开问题,可以简化通信协议的设计,并用通过命令序列号机制,防止重复接收和发送相同命令,引发通信双方不同步或者重复操作问题。

Description

一种密码键盘USB通信异常恢复方法及系统 技术领域
本发明涉及USB通信技术领域,特别是涉及一种密码键盘USB通信异常恢复方法及系统。
背景技术
密码键盘是金融收银系统必不可少的计算机外部设备之一,广泛应用在通讯、政府、交通、政府、工商、税务、超市等服务行业,配合银行系统、POS机和管理系通中使用,主要是用来输入密码。在现有的密码键盘中,除了密码输入模块,还集成有签字板模块、声波模块和扫描模块等。在通信过程中,终端和外置密码键盘的连接正常,但是由于硬件的干扰或者周边环境的影响,使得终端和外置密码键盘出现短暂的断开,而后马上又恢复正常的情况,此时终端和外置密码键盘虽然连接正常,但是通信服务已断开。
在现有技术中,POS主机主要通过USB口连接外置密码键盘,通过USB进行通信业务数据传输,POS主机和密码键盘在通信拷机过程中,因为受到干扰导致USB断开连接,导致通信过程中出现各个底层驱动模块无法接收到响应数据,返回超时错误,使得应用程序因为非人为干扰,导致业务中断,从而影响了应用程序正常运行。
发明内容
为此,需要提供一种USB通信恢复方法及系统,用于解决现有USB设备因受到干扰,而短时间断开,导致通信异常与中断的问题。
为实现上述目的,发明人提供了一种密码键盘USB通信异常恢复方法,该密码键盘USB通信异常恢复方法,包括以下步骤:
密码键盘各底层驱动模块,在各自的通信数据中插入命令号;
判断密码键盘与连接设备的通信是否异常,若是,则密码键盘各底层驱动模块,判断是否需要重发数据;
若需要重发数据,则所述底层驱动模块,以相同的命令号再次发送原数据;
连接设备判断接收到的数据的命令号是否一致,若是,则数据重复接收,丢弃重复接收数据,若否,则接收该数据。
进一步的,在所述底层驱动模块,以相同的命令号再次发送原数据之前,还包括步骤:
判断数据重发次数是否超过预设的最大重发次数,若是,则发送超时,并更新命令号,若否,则以相同的命令号再次发送原数据。
进一步的,所述密码键盘与连接设备的通信异常包括数据发送失败和数据接收超时。
进一步的,密码键盘各底层驱动模块所发送的通信数据中,还插入有与各底层驱动模块对应的模块号。
为实现上述目的,发明人还提供了一种密码键盘USB通信异常恢复系统,该密码键盘USB通信异常恢复系统,包括插入单元、第一判断单元、第二判断单元、重发单元和接收单元;
所述插入单元用于密码键盘各底层驱动模块,在各自的通信数据中插入命令号;
所述第一判断单元用于判断密码键盘与连接设备的通信是否异常;
所述第二判断单元用于在第一判断单元判定通信异常时,密码键盘各底层驱动模块判断是否需要重发数据;
所述重发单元用于在第二判断单元判定需要重发数据时,所述底层驱动模块,以相同的命令号再次发送原数据;
所述接收单元用于连接设备判断接收到的数据的命令号是否一致,若是,则数据重复接收,丢弃重复接收数据,若否,则接收该数据。
进一步的,所述重发单元还用于在以相同的命令号再次发送原数据之前,判断数据重发次数是否超过预设的最大重发次数,若是,则发送超时,并更新命令号,若否,则以相同的命令号再次发送原数据。
进一步的,所述密码键盘与连接设备的通信异常包括数据发送失败和数据接收超时。
进一步的,所述插入单元还用于在密码键盘各底层驱动模块所发送的通信数据中,插入有与各底层驱动模块对应的模块号。
区别于现有技术,上述技术方案密码键盘USB通信异常恢复方法及系统在通信异常时,各个底层驱动模块判断是否需要重发数据,以及由各个底层驱动重发数据来解决通信异常问题,在重发数据时,各底层驱动模块通过对发送消息引入命令号,同一数据采用相同命令号发送,从而避免对同一条命令重复处理,以及同步通信双方的命令处理状态;本技术方案由各个底层驱动模块进行出错处理,解决通信受干扰而短时间断开问题,可以简化通信协议的设计,并用通过命令序列号机制,防止重复接收和发送相同命令,引发通信双方不同步或者重复操作问题。
附图说明
图1为具体实施方式所述密码键盘USB通信异常恢复方法的流程图;
图2为具体实施方式所述连接设备发送数据的流程图;
图3为具体实施方式所述连接设备数据接收响应处理流程;
图4为具体实施方式所述连接设备事件接收响应处理流程;
图5为具体实施方式所述密码键盘USB通信异常恢复系统的模块框图。
附图标记说明:
10、插入单元;
20、第一判断单元;
30、第二判断单元;
40、重发单元;
50、接收单元。
具体实施方式
为详细说明技术方案的技术内容、构造特征、所实现目的及效果,以下结合具体实施例并配合附图详予说明。
请参阅图1,本实施例一种密码键盘USB通信异常恢复方法,该密码键盘USB通信异常恢复方法包括以下步骤:
S101、密码键盘各底层驱动模块以及连接设备,在各自的通信数据中插入命令号。其中,所述连接设备即为密码键盘所连接的设备,在本实施例中,所述连接设备优选为POS机,所述密码键盘包括有数字键盘模块、签字板模块和扫描枪模块,各模块分别包括硬件电路以及对应的底层驱动模块,其中,数字键盘模块用于获取输入的密码等数字信息,所述签字板模块用于获取用户的签名等信息,所述扫描枪用于扫描一维码或二维码待条码信息。所述数字键盘模块、签字板模块和扫描枪模块均具有独立的数据处理能力,能够实现数据收发功能,并且各模块共用一个USB通信接口。
各底层驱动模块在与连接设备(即主机端)正常通信时,在各自所述发送的数据中插入了命令号,其中,为了便于区别不同数据,不同数据的命令号是不同的。例如发送的数据可按发送的先后顺序递增命令号。
S102、判断密码键盘与连接设备的通信是否异常,若是,则密码键盘各底层驱动模块以及连接设备,判断是否需要重发数据。其中,通信异常的类型包括数据发送失败和数据接收超时。而当密码键盘向连接设备发送数据失败,或连接设备接收超时,则密码键盘则需要向连接重新发送数据;而当连接设备发送失败或接收超时,则连接设备需要重新发送数据。
S103、若需要重发数据,则所述底层驱动模块和连接设备,以相同的命 令号再次发送原数据。在本技术方案中,数字键盘模块、签字板模块和扫描枪模块的底层驱动模块均支持数据重发机制,并预设有最大重发次数。当各底层驱动模块发送的数据响应超时,而重发的次数未超过最大重发次数,则以相同的命令号,再次发送该数据。
S104、连接设备与底层驱动模块,判断接收到的数据的命令号是否一致,若是,则数据重复接收,丢弃重复接收数据,若否,则接收该数据。
本实施例中,由各个底层驱动重发数据来解决通信异常问题,在重发数据时,各底层驱动模块通过对发送消息引入命令号,同一数据采用相同命令号发送,从而避免对同一条命令重复处理,以及同步通信双方的命令处理状态。本技术方案中,USB通信接口协议只负责数据的发送与接收等基础的数据传输功能,而不负责数据重发的判断,数据的重发以及是否丢弃则于各底层驱动模块自行判断,从而简化通信协议的设计,并且用通过引入命令序列号机制,防止重复接收和发送相同命令,引发通信双方不同步或者重复操作问题。
请参阅图2,为采用上述通信异常恢复方法进行通信时,连接设备发送数据的流程图。连接设备发送数据包括步骤:
S201、连接设备判断发送的数据后的响应是否超时,若否,则通信正常,返回响应,若超时,则转步骤S202;
S202、判断是否支持数据重发,若否,则转步骤S205;若支持数据重发,则转步骤S203;
S203、判断数据重发次数是否已满,若是,转步骤S205,若否,则转步骤S204;
S204、命令号保持不变,重发该数据;数据重发后转回至步骤S201;
S205、更新命令号接着发送下一数据,通信超时退出。
请参阅图3,为采用上述通信异常恢复方法进行通信时,连接设备数据接收响应处理流程。该连接设备数据接收响应处理流程包括:
S301、判断是否支持数据重发机制,若是,则转步骤S302,若否,则转步骤S305;处理响应数据,更新命令号,即命令号加1;
S302、提取数据的命令号,然后转步骤S303;
S303、判断命令号是否有重复,即是否一致,若是,则转步骤S304,若否,则转步骤S305;
S304、数据重复接收,丢弃重复接收的数据;
S305、处理响应数据,更新命令号,即命令号加1。
在上述实施例中,在密码键盘各底层驱动模块所发送的通信数据中,还插入有与各底层驱动模块对应的模块号。例如数字键盘的模块号为1、签字板的模块为2,各底层驱动模块所发送的数据中即包括了命令号,同时又包括了模块号。在一实施例中,底层驱动模块所发送的数据的格式为:协议头+协议长度+模块号+命令号+各模块命令具体业务数据+计数号+校验+协议尾。
所述密码键盘除了向连接设备上传数据,还向连接设备上传事件指令,所述事件指令具体是指,向连接设备上送请求连接设备执行相应操作的指令。在上传事件指令时,在事件指令中插入事件号,所述事件号在作用上,与上述实施例中的命令号相同。请参阅图4,为采用上述通信异常恢复方法进行通信时,连接设备事件接收响应处理流程。该连接设备事件接收响应处理流程与数据接收响应处理流程相似,包括:
S401、判断是否支持重发机制,若是,则转S402,若否,则转S405;
S402、提取事件指令的事件号;而后转步骤S403;
S403、判断事件号是否正确(即事件号是否重复),若错误,则转S406,若正确,则转S404;
S404、返回响应,保存事件号,并转405;
S405、回调事件给上层应用;
S406、事件号所对应数据为重复数据,丢弃重复接收数据。
可见在上述实施例中,在通信数据中插入命令号,在通信异常时,通过 密码键盘的各底层驱动模块,判断是否需要重发数据,以及以相同命令号重发同一数据,在连接设备端,通过判断命令号来识别数据是否为重复数据,从而有效解决了密码键盘在短时间通信中断时,重复接收和发送相同数据,引发通信双方不同步或者重复操作问题。
请参阅图5,实施例一种密码键盘USB通信异常恢复系统,该密码键盘USB通信异常恢复系统包括插入单元10、第一判断单元20、第二判断单元30、重发单元40和接收单元50。
所述插入单元10用于密码键盘各底层驱动模块以及连接设备,在各自的通信数据中插入命令号。所述密码键盘包括有数字键盘模块、签字板模块和扫描枪模块,各模块分别包括硬件电路以及对应的底层驱动模块,其中,数字键盘模块用于获取输入的密码等数字信息,所述签字板模块用于获取用户的签名等信息,所述扫描枪用于扫描一维码或二维码待条码信息。各底层驱动模块在与连接设备(即主机端)正常通信时,在各自所述发送的数据中插入了命令号,其中,为了便于区别不同数据,不同数据的命令号是不同的。例如发送的数据可按发送的先后顺序递增命令号。
所述第一判断单元20用于判断密码键盘与连接设备的通信是否异常;所述第二判断单元30用于在第一判断单元判定通信异常时,密码键盘各底层驱动模块以及连接设备,判断是否需要重发数据;其中,通信异常的类型包括数据发送失败和数据接收超时。而当密码键盘向连接设备发送数据失败,或连接设备接收超时,则密码键盘则需要向连接重新发送数据;而当连接设备发送失败或接收超时,则连接设备需要重新发送数据。
所述重发单元40用于在第二判断单元判定需要重发数据时,所述底层驱动模块和连接设备,以相同的命令号再次发送原数据。在本技术方案中,数字键盘模块、签字板模块和扫描枪模块的底层驱动模块均支持数据重发机制,并预设有最大重发次数。当各底层驱动模块发送的数据响应超时,而重发的 次数未超过最大重发次数,则以相同的命令号,再次发送该数据。
所述接收单元50用于连接设备与底层驱动模块,判断接收到的数据的命令号是否一致,若是,则数据重复接收,丢弃重复接收数据,若否,则接收该数据。
本实施例中,由各个底层驱动重发数据来解决通信异常问题,在重发数据时,各底层驱动模块通过对发送消息引入命令号,同一数据采用相同命令号发送,从而避免对同一条命令重复处理,以及同步通信双方的命令处理状态。本技术方案可以简化通信协议的设计,并用通过命令序列号机制,防止重复接收和发送相同命令,引发通信双方不同步或者重复操作问题。
所述插入单元还用于在密码键盘各底层驱动模块所发送的通信数据中,插入有与各底层驱动模块对应的模块号。例如数字键盘的模块号为1、签字板的模块为2,各底层驱动模块所发送的数据中即包括了命令号,同时又包括了模块号。在一实施例中,底层驱动模块所发送的数据的格式为:协议头+协议长度+模块号+命令号+各模块命令具体业务数据+计数号+校验+协议尾。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者终端设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者终端设备所固有的要素。在没有更多限制的情况下,由语句“包括……”或“包含……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者终端设备中还存在另外的要素。此外,在本文中,“大于”、“小于”、“超过”等理解为不包括本数;“以上”、“以下”、“以内”等理解为包括本数。
本领域内的技术人员应明白,上述各实施例可提供为方法、装置、或计 算机程序产品。这些实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。上述各实施例涉及的方法中的全部或部分步骤可以通过程序来指令相关的硬件来完成,所述的程序可以存储于计算机设备可读取的存储介质中,用于执行上述各实施例方法所述的全部或部分步骤。所述计算机设备,包括但不限于:个人计算机、服务器、通用计算机、专用计算机、网络设备、嵌入式设备、可编程设备、智能移动终端、智能家居设备、穿戴式智能设备、车载智能设备等;所述的存储介质,包括但不限于:RAM、ROM、磁碟、磁带、光盘、闪存、U盘、移动硬盘、存储卡、记忆棒、网络服务器存储、网络云存储等。
上述各实施例是参照根据实施例所述的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到计算机设备的处理器以产生一个机器,使得通过计算机设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机设备以特定方式工作的计算机设备可读存储器中,使得存储在该计算机设备可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机设备上,使得在计算机设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已经对上述各实施例进行了描述,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例做出另外的变更和修改,所以以上所 述仅为本发明的实施例,并非因此限制本发明的专利保护范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围之内。

Claims (8)

  1. 一种密码键盘USB通信异常恢复方法,其特征在于,包括以下步骤:
    密码键盘各底层驱动模块,在各自的通信数据中插入命令号;
    判断密码键盘与连接设备的通信是否异常,若是,则密码键盘各底层驱动模块以及连接设备,判断是否需要重发数据;
    若需要重发数据,则所述底层驱动模块,以相同的命令号再次发送原数据;
    连接设备判断接收到的数据的命令号是否一致,若是,则数据重复接收,丢弃重复接收数据,若否,则接收该数据。
  2. 根据权利要求1所述的密码键盘USB通信异常恢复方法,其特征在于,在所述底层驱动模块,以相同的命令号再次发送原数据之前,还包括步骤:
    判断数据重发次数是否超过预设的最大重发次数,若是,则发送超时,并更新命令号,若否,则以相同的命令号再次发送原数据。
  3. 根据权利要求1所述的密码键盘USB通信异常恢复方法,其特征在于,所述密码键盘与连接设备的通信异常包括数据发送失败和数据接收超时。
  4. 根据权利要求1所述的密码键盘USB通信异常恢复方法,其特征在于,密码键盘各底层驱动模块所发送的通信数据中,还插入有与各底层驱动模块对应的模块号。
  5. 一种密码键盘USB通信异常恢复系统,其特征在于,包括插入单元、第一判断单元、第二判断单元、重发单元和接收单元;
    所述插入单元用于密码键盘各底层驱动模块,在各自的通信数据中插入命令号;
    所述第一判断单元用于判断密码键盘与连接设备的通信是否异常;
    所述第二判断单元用于在第一判断单元判定通信异常时,密码键盘各底层驱动模块,判断是否需要重发数据;
    所述重发单元用于在第二判断单元判定需要重发数据时,所述底层驱动 模块,以相同的命令号再次发送原数据;
    所述接收单元用于连接设备判断接收到的数据的命令号是否一致,若是,则数据重复接收,丢弃重复接收数据,若否,则接收该数据。
  6. 根据权利要求5所述的密码键盘USB通信异常恢复系统,其特征在于,所述重发单元还用于在以相同的命令号再次发送原数据之前,判断数据重发次数是否超过预设的最大重发次数,若是,则发送超时,并更新命令号,若否,则以相同的命令号再次发送原数据。
  7. 根据权利要求5所述的密码键盘USB通信异常恢复系统,其特征在于,所述密码键盘与连接设备的通信异常包括数据发送失败和数据接收超时。
  8. 根据权利要求5所述的密码键盘USB通信异常恢复系统,其特征在于,所述插入单元还用于在密码键盘各底层驱动模块所发送的通信数据中,插入有与各底层驱动模块对应的模块号。
PCT/CN2017/096824 2016-08-31 2017-08-10 一种密码键盘usb通信异常恢复方法及系统 WO2018040879A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610785173.8A CN106375064B (zh) 2016-08-31 2016-08-31 一种密码键盘usb通信异常恢复方法及系统
CN201610785173.8 2016-08-31

Publications (1)

Publication Number Publication Date
WO2018040879A1 true WO2018040879A1 (zh) 2018-03-08

Family

ID=57899518

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/096824 WO2018040879A1 (zh) 2016-08-31 2017-08-10 一种密码键盘usb通信异常恢复方法及系统

Country Status (2)

Country Link
CN (1) CN106375064B (zh)
WO (1) WO2018040879A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106375064B (zh) * 2016-08-31 2019-08-02 福建联迪商用设备有限公司 一种密码键盘usb通信异常恢复方法及系统
CN106407065B (zh) * 2016-08-31 2019-02-12 福建联迪商用设备有限公司 一种密码键盘usb通信异常恢复方法及系统
CN109993889A (zh) * 2017-12-29 2019-07-09 山东新北洋信息技术股份有限公司 一种商品售卖方法及自动售货控制装置
CN108317737A (zh) * 2018-02-21 2018-07-24 付志昊 一种家用智能热水器系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6708247B1 (en) * 1999-07-21 2004-03-16 Clearcube Technology, Inc. Extending universal serial bus to allow communication with USB devices at a remote location
US6721332B1 (en) * 1998-11-10 2004-04-13 Nortel Networks Limited USB networking on a multiple access transmission medium
CN201111079Y (zh) * 2007-09-13 2008-09-03 肖辉 一种无线条形码识读器
CN106375064A (zh) * 2016-08-31 2017-02-01 福建联迪商用设备有限公司 一种密码键盘usb通信异常恢复方法及系统
CN106407065A (zh) * 2016-08-31 2017-02-15 福建联迪商用设备有限公司 一种密码键盘usb通信异常恢复方法及系统

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100568819C (zh) * 2006-10-17 2009-12-09 中兴通讯股份有限公司 多媒体广播组播服务会话开始的异常处理方法
CN101488076A (zh) * 2008-12-30 2009-07-22 华为技术有限公司 串行硬盘接口协议中命令冲突的解决方法及主设备
CN101989248A (zh) * 2009-07-31 2011-03-23 比亚迪股份有限公司 一种usb设备和usb设备重启的方法
CN101697517B (zh) * 2009-09-24 2012-06-06 中兴通讯股份有限公司 在线计费降低呼损的装置、系统及方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6721332B1 (en) * 1998-11-10 2004-04-13 Nortel Networks Limited USB networking on a multiple access transmission medium
US6708247B1 (en) * 1999-07-21 2004-03-16 Clearcube Technology, Inc. Extending universal serial bus to allow communication with USB devices at a remote location
CN201111079Y (zh) * 2007-09-13 2008-09-03 肖辉 一种无线条形码识读器
CN106375064A (zh) * 2016-08-31 2017-02-01 福建联迪商用设备有限公司 一种密码键盘usb通信异常恢复方法及系统
CN106407065A (zh) * 2016-08-31 2017-02-15 福建联迪商用设备有限公司 一种密码键盘usb通信异常恢复方法及系统

Also Published As

Publication number Publication date
CN106375064A (zh) 2017-02-01
CN106375064B (zh) 2019-08-02

Similar Documents

Publication Publication Date Title
WO2018040879A1 (zh) 一种密码键盘usb通信异常恢复方法及系统
WO2018040877A1 (zh) 一种密码键盘usb通信异常恢复方法及系统
CN101699797B (zh) 使用udp协议进行数据传输的方法
USRE43151E1 (en) Acknowledging data transmissions in the presence of multiple shared-communications channels
CN106506124A (zh) 重传报文确定方法及装置
CN104462562A (zh) 一种基于数据仓库自动化的数据迁移系统及方法
CN113765976A (zh) 一种通信方法和系统
CN104038327A (zh) Fc网络的出错重传方法
CN106060962A (zh) 一种通信方法及装置
US10135578B2 (en) Method of re-transmitting data and electronic device therefor
CN105024945A (zh) 一种多处理器间的信息交互方式
KR100859499B1 (ko) 데이터 송수신 방법 및 그에 따른 통신 시스템
CN112187408B (zh) 数据处理方法、系统、装置、存储介质和处理器
CN111294161A (zh) Harq反馈方法及装置、存储介质、终端
CN115208877A (zh) 文件传输方法、装置、设备、介质及产品
JP4759418B2 (ja) メッセージ回復システムおよび回復方法
CN104980802A (zh) 一种安全可靠的机顶盒数据烧写方法及系统
CN103078722B (zh) 一种请求数据重传的方法及装置
JP2014116938A (ja) 電子タグ装置及びその通信方法
CN103107864A (zh) 双位校验的编码和解码方法
CN113364880B (zh) 信息交换方法、系统、电子设备及存储介质
CN114244485B (zh) 一种usb信号远距离传输时的数据管理方法
EP2405627B1 (en) Method for operating a remote procedure call handler in a client and a server and computer system comprising the same
KR101460183B1 (ko) 신뢰성 있는 메시지 서비스 시스템 및 방법
CN106506690A (zh) 一种占用资源少且具有高可靠性的文件传输系统及其方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17845181

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17845181

Country of ref document: EP

Kind code of ref document: A1