CN107729264A - A kind of method for controlling peripheral serial equipment - Google Patents

A kind of method for controlling peripheral serial equipment Download PDF

Info

Publication number
CN107729264A
CN107729264A CN201710923154.1A CN201710923154A CN107729264A CN 107729264 A CN107729264 A CN 107729264A CN 201710923154 A CN201710923154 A CN 201710923154A CN 107729264 A CN107729264 A CN 107729264A
Authority
CN
China
Prior art keywords
thresholding
virtual
serial
serial port
equipment
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201710923154.1A
Other languages
Chinese (zh)
Other versions
CN107729264B (en
Inventor
樊季林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Konka Group Co Ltd
Original Assignee
Konka Group Co Ltd
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 Konka Group Co Ltd filed Critical Konka Group Co Ltd
Priority to CN201710923154.1A priority Critical patent/CN107729264B/en
Publication of CN107729264A publication Critical patent/CN107729264A/en
Application granted granted Critical
Publication of CN107729264B publication Critical patent/CN107729264B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/102Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/105Program control for peripheral devices where the programme performs an input/output emulation function

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Systems (AREA)

Abstract

The invention discloses a kind of method for controlling peripheral serial equipment, including:According to default serial ports configuration information, any virtual serial port that third-party control devices middle-end slogan is more than to thresholding is converted into any virtual serial port of the third-party control devices middle-end slogan less than or equal to thresholding;Any virtual serial port that control device is less than or equal to thresholding with third-party control devices middle-end slogan establishes connection;The control information that is operated of any virtual serial port that receiving control apparatus transmits, being less than or equal to thresholding to third-party control devices middle-end slogan;The operation for any virtual serial port for being less than or equal to thresholding corresponding to control information to third-party control devices middle-end slogan is converted into the operation of any virtual serial port for being more than thresholding to third-party control devices middle-end slogan, controls peripheral serial equipment.Implement the embodiment of the present invention so that control device realizes the control to peripheral serial equipment by any virtual serial port on third-party control devices.

Description

A kind of method for controlling peripheral serial equipment
The application be directed to be submitted on November 07th, 2011 Patent Office of the People's Republic of China, Application No. 201110314253.2, The division Shen that the parent application of entitled " a kind of method, system and control device for controlling peripheral serial equipment " is made Please, the content of above-mentioned parent application is incorporated herein in a manner of introducing.
Technical field
The present invention relates to serial communication field, specifically, more particularly to a kind of method for controlling peripheral serial equipment.
Background technology
Peripheral serial equipment based on serial communication, it is required to set by serial ports (physical serial interface or virtual serial port) and control It is standby to establish connection, so as to realize the serial communication between control device and peripheral serial equipment.
In existing, the peripheral serial equipment for carrying out serial communication by physical serial interface, is typically the peripheral serial ports One driving of equipment development, control device is after the driving of the peripheral serial equipment is mounted with, it is possible to passes through its physics string The physical serial interface of mouth and peripheral serial equipment carries out serial communication, and then controls peripheral serial equipment.For example, developer develops The driving of one bar code scan equipment, control device are mounted with the driver of the bar code scan equipment, it is possible to pass through physics The physical serial interface of serial ports and the bar code scan equipment carries out serial communication, such as carries out bar code scan operation etc..In existing, control The equipment that equipment is usually built-in with WINCE systems, such as PDA etc..
In existing, the peripheral serial equipment for carrying out serial communication by virtual serial port and control device, it is typically With the virtual serial port progress serial communication that third-party control devices upper end slogan is 1-9.Control device is assisted by remote desktop RDP View is established with the virtual serial port that third-party control devices upper end slogan is 1-9 and connected, and is realized and is led to the serial ports of peripheral serial equipment News, and then realize control of the control device to peripheral serial equipment.
The content of the invention
It is an object of the invention to overcome the deficiencies of the prior art and provide a kind of method of the peripheral serial equipment of control, it is System and control device so that control device can be by controlling its virtual serial port or controlling any void of third-party control devices Intend serial ports to realize the control to peripheral serial equipment.
In order to solve the above problems, the present invention proposes a kind of method for controlling peripheral serial equipment, including:
According to default serial ports configuration information, the physical serial interface of peripheral serial equipment is converted into any virtual of control device Serial ports;
Receive the control information operated to the virtual serial port of the control device;
Operation corresponding to the control information to the virtual serial port is converted into the thing to the peripheral serial equipment Manage the operation of serial ports.
A kind of method for controlling peripheral serial equipment, including:
According to default serial ports configuration information, any virtual serial port that third-party control devices middle-end slogan is more than to thresholding turns Change any virtual serial port that third-party control devices middle-end slogan is less than or equal to thresholding into;The third-party control devices with it is outer Enclose any virtual serial port progress serial communication that serial equipment is more than thresholding by the port numbers;Control device and the described 3rd Any virtual serial port that square control device middle-end slogan is less than or equal to thresholding establishes connection;
Any void that receiving control apparatus transmits, being less than or equal to thresholding to the third-party control devices middle-end slogan Intend the control information that serial ports is operated;
Any of thresholding will be less than or equal to corresponding to the control information to the third-party control devices middle-end slogan The operation of virtual serial port is converted into the operation for being more than any virtual serial port of thresholding to the third-party control devices middle-end slogan, Control the peripheral serial equipment.
Correspondingly, the invention provides a kind of control device, including:
Receiving module, for receiving the control information operated to the virtual serial port of the control device;
Modular converter, for according to default serial ports configuration information, the serial ports of peripheral serial equipment to be converted into control device Virtual serial port;And it is additionally operable to corresponding to the control information that receives the receiving module to the behaviour of the virtual serial port It is converted into the operation of the physical serial interface to the peripheral serial equipment.
Finally, present invention also offers a kind of system for controlling peripheral serial equipment, including:
Control device, for according to default serial ports configuration information, the serial ports of peripheral serial equipment to be converted into control device Virtual serial port;Receive the control information operated to the virtual serial port of the control device;And by the control information The corresponding operation to the virtual serial port is converted into the operation of the physical serial interface to the peripheral serial equipment;
Peripheral serial equipment, the control information transmitted for receiving control apparatus and respond it is right corresponding to the control information The operation of the virtual serial port, and operating result is returned to by control device by its physical serial interface.
Beneficial effects of the present invention:
By the way that according to default serial ports configuration information, the physical serial interface of peripheral serial equipment is converted into the virtual of control device Serial ports;Or any virtual serial port of the third-party control devices middle-end slogan more than thresholding is converted into third-party control devices Port numbers are less than or equal to any virtual serial port of thresholding, wherein, third-party control devices are more than thresholding by its port numbers Any virtual serial port carries out serial communication with peripheral serial equipment, and control device utilizes RDP, with the third party Any virtual serial port that control device middle-end slogan is less than or equal to thresholding establishes connection;It is so designed that, control device is empty to it Intend the operation of serial ports or be less than or equal to the operation of any virtual serial port of thresholding to third-party control devices middle-end slogan To be converted to the operation of the serial ports to peripheral serial equipment, and then realize control of the control device to the peripheral serial equipment.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is the method flow diagram for the peripheral serial equipment of control that the present invention implements one;
Fig. 2 is the method flow diagram for the peripheral serial equipment of control that the present invention implements two;
Fig. 3 is the method flow diagram for the peripheral serial equipment of control that the present invention implements three;
Fig. 4 is the method flow diagram for the peripheral serial equipment of control that the present invention implements four;
Fig. 5 is the structural representation of the control device of the embodiment of the present invention five;
Fig. 6 is the structural representation of the modular converter of the embodiment of the present invention five;
Fig. 7 is the system schematic of the peripheral serial equipment of control of the embodiment of the present invention six.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained all other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
In existing, if peripheral serial equipment carries out serial communication by physical serial interface and control device, it is required to apply Developer develops a driving for the peripheral serial equipment.Application developer when developing the driving of peripheral serial equipment, it is necessary to It is related to many details, for example, how peripheral serial equipment initializes, how receives and send data, how to parse and encapsulate Packet, its power supply how is managed so as to power saving etc..Therefore, for application developer, it needs to be grasped enough technologies Details, and it also requires spending the longer construction cycle to develop is suitable for some specific peripheral serial communication equipment Driving.
Just think, if the manufacturer of peripheral serial equipment or third party developer are by corresponding to peripheral serial communication equipment Driving is made a virtual serial port and loaded by the operating system of control device, in this way, then shielding to the peripheral serial equipment All ins and outs of bottom operation, and its ins and outs is completed by the driving of virtual serial port.So, for application and development For person, its need can then realize the control to the peripheral serial equipment by controlling the virtual serial port on control device, and Do not spend the bottom operation for being concerned about the peripheral serial equipment.Also, all application developers can be by controlling the control Virtual serial port in equipment controls peripheral serial equipment.
According to above-mentioned design, as shown in figure 1, be a kind of method of control periphery serial equipment of the embodiment of the present invention one, Including:
The default serial ports configuration information of S11, basis, the virtual of control device is converted into by the physical serial interface of peripheral serial equipment Serial ports;
Virtual serial port, control device is referred under conditions of any hardware is not increased, by certain operation, in its behaviour Make to establish VSP (the Virtual Serial Port of peripheral serial equipment in system:Virtual serial port).In this way, application developer can To carry out serial communication using virtual serial port and peripheral serial equipment as using the standard serial port of operating system.Virtual serial port Equivalent to the data link that an endless is established between control device and peripheral serial equipment, application developer can recognize It is directly to for peripheral serial equipment on control device.
In this step, control device, can be by the physical serial interface of peripheral serial equipment according to default serial ports virtual information It is converted into the virtual serial port of control device.In this way, operation of the application developer to the control device virtual serial port can be exchanged into Operation to the physical serial interface of peripheral serial equipment.
Peripheral serial equipment can be equipment that all carry out serial communication based on physical serial interface and control device, such as bar Code scanning device etc..In existing, when control device the physical serial interface of bar code scan equipment is converted into it is virtual on control device During serial ports, application developer is by controlling the virtual serial port on control device, you can realizes the control to peripheral serial equipment.Its In, control device can be PDA etc..
S12, receive the control information operated to the virtual serial port of the control device;
In this step, operated corresponding to the control information that application developer inputs on the control device, including to the control The operation such as the access of the virtual serial port of control equipment, reading and writing.
S13, the operation corresponding to the control information to the virtual serial port is converted into the peripheral serial equipment Physical serial interface operation.
In step S13, control device also leads to the control information after it have received the control information of application developer input Cross the virtual serial port and send the peripheral serial equipment to.Peripheral serial equipment is responded corresponding to the control information to described The operation of the virtual serial port of control device, and operating result is returned into control device.In this way, can be by the control information The corresponding operation to the virtual serial port on the control device is converted into the physical serial interface of the peripheral serial equipment Operation.
In step S11-S13, by the way that the physical serial interface of peripheral serial equipment to be converted into the virtual serial port of control device, It is such then cause operation of the application developer to the virtual serial port of control device to be converted into behaviour to peripheral serial equipment Make.Therefore, all application developers are by controlling the virtual serial port on control device, you can realization is set to peripheral serial ports Standby control, such as access, reading and writing periphery serial ports control device, the bottom operation of the peripheral serial equipment is concerned about without spending Realization (such as:How peripheral serial equipment initializes, and how to receive and send the realization of the bottom operations such as data), so as to subtract Lack the development amount of application developer, and also cause the virtual serial port that there is certain versatility and ease for operation.
As shown in Fig. 2 be a kind of method of control periphery serial equipment of the embodiment of the present invention two, including:
S21, receive default serial ports configuration information;
In the specific implementation, before the physical serial interface of peripheral serial equipment is converted into the virtual serial port of control device, also Need to receive the default serial ports configuration information that developer imports, the default serial ports configuration information specifically includes:Developer The log-on message of the virtual serial port set, the configuration file of the virtual serial port of configuration and the default periphery The physical serial interface of serial equipment is converted into the driver of the virtual serial port of the control device.
Wherein, the control device is built-in with operating system, and the basis presets serial ports configuration information, peripheral serial ports is set Standby physical serial interface is converted into the virtual serial port of control device, specifically includes:
First, for operating system according to the log-on message received, identification needs the loading sequence of the virtual serial port loaded, end Slogan and the title of corresponding driving.For example, it is desired to the corresponding driving of the virtual serial port of loading is entitled: VirualCom.dll, port numbers 9.
Can be existing all operating systems it should be noted is that the operating system in the embodiment of the present invention, example Such as Windows sequence of maneuvers systems, the operating system of Vista series etc..
Need to illustrate on the other hand, developer is used to open when setting the log-on message of the virtual serial port Hair language does not limit clearly, such as can be C language, C Plus Plus, assembler language etc..In embodiments of the present invention, it is described Developer, refer to manufacturer or the third party developer of peripheral serial equipment, not application developer.
Secondly, the configuration file that the operating system configures according to developer, for example, being somebody's turn to do according to what developer configured The bib configuration files of virtual serial port, the physical serial interface for loading the peripheral serial equipment are converted into the virtual of the control device The driver of serial ports, when operating system generates, to ensure to include the driver in the operating system.Need Bright is a little that when configuring the configuration file of the virtual serial port, used development language does not limit clearly developer It is fixed, such as can be C language, C Plus Plus, assembler language etc..
Finally, the physical serial interface of peripheral serial equipment described in the operating system is converted into the void of the control device Intend the driver of serial ports, complete the physical serial interface of the peripheral serial equipment to the conversion of the virtual serial port of control device.
It should be noted that developer is converted into the virtual of control device in the physical serial interface for presetting peripheral serial equipment During the driver of serial ports, used development language does not limit clearly, can be C language, C Plus Plus, assembler language Deng.
For example, it is converted into the virtual string of control device in the physical serial interface that peripheral serial equipment is preset using C Plus Plus During the driver of mouth, developer (including the manufacturer of peripheral serial equipment or third party developer, opened different from application Originator) initialization of peripheral serial equipment can be completed using COM_Init functions, opened using COM_Open functions outer The physical serial interface of serial equipment is enclosed, and serial equipment sends the control letter that application developer inputs to the periphery by the physical serial interface Breath.For example, the closing of the physical serial interface of peripheral serial equipment is also controlled using COM_Close functions;Use COM_ IOControl functions complete the communication baud rate to physical serial interface, parity bit, data bit, hardware flow and device power supply (DPS) pipe The setting of reason, some control functions of peripheral serial equipment can be encapsulated in the function certainly.Use COM_Deinit Function unloads peripheral serial equipment, has carried out the encapsulation of paired data bag using COM_Write and packet is sent to periphery Serial equipment.Come the reading and parsing of paired data bag using COM_Read functions, and transfer data to control device.
The default serial ports configuration information of S22, basis, the virtual of control device is converted into by the physical serial interface of peripheral serial equipment Serial ports;
S23, receive the control information operated to the virtual serial port of the control device;
S24, the operation corresponding to the control information to the virtual serial port is converted into the peripheral serial equipment Physical serial interface operation.
Wherein, step S22-S24 operation is identical with the step S11-S13 of embodiment one operation, is not repeating to retouch herein State.
In embodiment one and this implementation, peripheral serial equipment can be that all are entered based on physical serial interface with control device The equipment of row serial communication, such as bar code scan equipment etc..When the physical serial interface of bar code scan equipment is converted into by developer During virtual serial port on control device, application developer is by controlling the virtual serial port on control device, you can realizes pair The control of bar code scan equipment.In this way, all application developers are not spent when changing the application of bar code scan equipment to exploitation The realization of the bottom operation of the virtual serial port is concerned about, so as to also reduce the workload of application developer.
In the prior art, for by virtual serial port carry out serial communication peripheral serial equipment (such as bluetooth equipment), It is typically that (bluetooth such as the bluetooth equipment equipped with WINCE systems, Windows mobile systems is set with third-party control devices It is standby) upper end slogan be 1-9 virtual serial port carry out serial communication.Control device (such as PC) passes through RDP (Remote Desktop Protocol:RDP) connected with third-party control devices foundation, by controlling third-party control devices Upper end slogan is 1-9 virtual serial port, and then controls peripheral serial equipment.However, for port numbers third party very in short supply Control device (bluetooth equipment, the bluetooth equipment of Windows mobile systems that WINCE systems are such as housed), it goes here and there with periphery The port numbers for the virtual serial port that jaws equipment is communicated may not be the either end slogan in 1-9, but port numbers are more than 9 end Slogan.Now, when PC establishes connection by RDP agreements and when WINCE bluetooth equipment is housed, because it can only find to be equipped with Any serial ports of WINCE systems, the bluetooth equipment upper end slogan of Windows mobile systems between 1-9, so now PC Machine can not be established with peripheral serial equipment and connected, and control peripheral serial equipment.Thus, present invention also offers one kind control periphery The method of serial equipment, as shown in figure 3, be a kind of method of control periphery serial equipment of the embodiment of the present invention three, including:
The default serial ports configuration information of S31, basis, third-party control devices middle-end slogan is more than to any virtual string of thresholding Mouth is converted into any virtual serial port that third-party control devices middle-end slogan is less than or equal to thresholding;The third-party control devices Any virtual serial port for being more than thresholding by the port numbers with peripheral serial equipment carries out serial communication;Control and the described 3rd Any virtual serial port that square control device middle-end slogan is less than or equal to thresholding establishes connection;
Virtual serial port described in this step, it is identical with the virtual serial port described in implementation one, it is not repeated to describe herein. Thresholding described in this step, should when referring to that any virtual serial port of control device and third-party control devices establishes connection Maximum port numbers corresponding to any virtual serial port.
In the specific implementation, peripheral serial equipment, which can be all, is based on virtual serial port and third-party control devices progress serial ports The equipment of communication, such as bluetooth equipment A.Third-party control devices are the equipment for being built-in with operating system, and Wince systems such as are housed Or the bluetooth equipment B of windows mobile systems.If two bluetooth equipments establish connection by the serial port protocol of bluetooth, it is assumed that Bluetooth equipment B carries out serial communication using the bluetooth serial ports that port numbers are 12 with bluetooth equipment A.And control device can be PC Machine, it is established by RDP and bluetooth equipment B and connected.Due to that can only find bluetooth equipment B middle-end slogans 0 to 9 at PC end Between any serial ports.That is, 9 are third-party control devices and establish the virtual port used during connection with control device Corresponding maximum port numbers, i.e., 9 be thresholding.Because can't find the bluetooth serial ports that port numbers are 12 on PC, just do not have Method accesses bluetooth equipment B.If PC is wanted to access the bluetooth equipment A that same bluetooth equipment B establishes connection by RDP, Need by bluetooth equipment B add a port number be 0 to 9 between any virtual serial port.Specific practice is exactly blue The bluetooth serial ports that tooth equipment B upper ends slogan is 12 is converted into any virtual serial port of the bluetooth equipment B upper ends slogan between 0 to 9, Assuming that just virtual is virtual serial port 9, then all operations to the virtual serial port that bluetooth equipment B upper ends slogan is 9 can be whole The operation to the bluetooth serial ports that bluetooth equipment upper end slogan is 12 is converted, such PC can is by controlling bluetooth equipment B's The virtual serial port that port numbers are 9 controls bluetooth equipment A.
It is that S32, receiving control apparatus transmit, the third-party control devices middle-end slogan is appointed less than or equal to thresholding The control information that one virtual serial port is operated;
In this step, application developer inputs control information on the control device, and is transmitted to third party's control and sets It is standby.Wherein, operated corresponding to the control information of application developer input, including the operation such as reading and writing, control.
S33, thresholding will be less than or equal to the third-party control devices middle-end slogan corresponding to the control information The operation of any virtual serial port is converted into any virtual serial port for being more than thresholding to the third-party control devices middle-end slogan Operation, control the peripheral serial equipment.
In step S33, application developer inputs control information on the control device, and is transmitted to third party's control and sets It is standby.Such as third-party control devices have received to the port numbers for 1 to 9 any virtual serial port control information after, by this It is that any virtual serial port of 1-9 any virtual serial port, port numbers more than 9 sends periphery to that control information, which passes sequentially through port numbers, Serial equipment.It is 1-9 to the third-party control devices middle-end slogan that peripheral serial equipment, which is responded corresponding to the control information, Any virtual serial port operation, and operating result is returned into third-party control devices.Third-party control devices receive institute After stating operating result, control device is also transferred to.
Any virtual serial port that third-party control devices middle-end slogan is more than to thresholding in step S31-S33 is converted into the Tripartite's control device middle-end slogan is less than or equal to any virtual serial port of thresholding so that application developer is defeated by control device The operation being less than or equal to third-party control devices upper end slogan on any virtual serial port of thresholding entered can be converted into It is more than the operation of any virtual serial port of thresholding to third-party control devices upper end slogan, and then is converted to peripheral serial equipment Virtual serial port operation.So so that control device passes through any virtual serial port on third-party control devices, you can realize Control to peripheral serial equipment.
As shown in figure 4, be a kind of method of control periphery serial equipment of the embodiment of the present invention four, including:
S41, receive default serial ports configuration information;
In the specific implementation, any virtual serial port that control device middle-end slogan is more than to thresholding is converted into control device middle-end Slogan is less than or equal to before any virtual serial port of thresholding, in addition to receives default serial ports configuration information, the default serial ports Configuration information specifically includes:
The third-party control devices upper end slogan that developer is set is less than or equal to the note of any virtual serial port of thresholding Volume information, the configuration file of any virtual serial port less than or equal to thresholding configured and the default port numbers Any virtual serial port more than thresholding is converted into driver of the port numbers less than or equal to any virtual serial port of thresholding.
Wherein, the third-party control devices are built-in with operating system, such as WINC systems, or Windows systems, will control Any virtual serial port that equipment middle-end slogan is more than thresholding is converted into any that control device middle-end slogan is less than or equal to thresholding Virtual serial port, it is specially:
First, for operating system according to the log-on message received, identification needs the loading sequence of the virtual serial port loaded, end Slogan and the title of corresponding driving.For example, it is desired to the corresponding driving of the virtual serial port of loading is entitled: VirualCom.dll, port numbers 9.When this is in the port numbers for setting virtual serial port, port numbers can only be set to be less than or waiting In any virtual serial port of thresholding, such as any virtual serial port of the port numbers between 1-9.
It should be noted is that developer is setting the registration of any virtual serial port less than or equal to thresholding During information, used development language does not limit clearly, such as can be C language, C Plus Plus, assembler language etc..At this In inventive embodiments, described developer, manufacturer or the third party developer of peripheral serial equipment are referred to, is not Application developer.
Secondly, according to the configuration file, any virtual serial port for loading the port numbers more than thresholding turns operating system Change driver of the port numbers less than or equal to any virtual serial port of thresholding into.For example, operating system is according to exploit person The bib configuration files (wherein 9 be thresholding) for the virtual serial port that the port numbers of member's configuration are 9, loading end slogan are 12 virtual string Mouth is converted into the driver of 9 virtual serial ports, when operating system generates, to ensure to include the drive in the operating system Dynamic program.It should be noted is that developer is in configuration file of the configuration less than or equal to any virtual serial port of thresholding When, used development language does not limit clearly, such as can be C language, C Plus Plus, assembler language etc..
Finally, the default port numbers of developer described in the operating system are more than any virtual string of thresholding Mouth is converted into driver of the port numbers less than or equal to any virtual serial port of thresholding, completes the port numbers and is more than domain Any virtual serial port of value is converted into conversion of the port numbers less than or equal to any virtual serial port of thresholding.
Wherein, developer is more than any virtual serial port of thresholding to be converted into the port numbers small presetting the port numbers In or equal to any virtual serial port of thresholding driver when, used development language does not limit clearly, such as can Think C language, C Plus Plus, assembler language etc..
For example, it is converted into the end presetting any virtual serial port of the port numbers more than thresholding using C Plus Plus When slogan is less than or equal to the driver of any virtual serial port of thresholding, developer (includes the manufacture of peripheral serial equipment Business or third party developer, different from application developer) peripheral serial equipment can be completed using COM_Init functions Initialization, virtual serial port corresponding to peripheral serial equipment is opened using COM_Open functions, and outside by the virtual serial port Enclose the control information that serial equipment sends application developer input.For example, peripheral serial ports is also controlled using COM_Close functions The closing of the virtual serial port of equipment;The communication baud rate to virtual serial port, odd even are completed using COM_IOControl functions Some control functions of peripheral serial equipment, all may be used at the setting of data bit, hardware flow and device power supply (DPS) management by position certainly To be encapsulated in the function.Peripheral serial equipment is unloaded using COM_Deinit functions, logarithm is completed using COM_Write According to bag encapsulation and packet is sent to peripheral serial equipment.The reading of paired data bag is carried out using COM_Read functions And parsing, and transfer data to control device.
The default serial ports configuration information of S42, basis, third-party control devices middle-end slogan is more than to any virtual string of thresholding Mouth is converted into any virtual serial port that third-party control devices middle-end slogan is less than or equal to thresholding;The third-party control devices Any virtual serial port for being more than thresholding by the port numbers with peripheral serial equipment carries out serial communication;Control device with it is described Any virtual serial port that third-party control devices middle-end slogan is less than or equal to thresholding establishes connection;
It is that S43, receiving control apparatus transmit, the third-party control devices middle-end slogan is appointed less than or equal to thresholding The control information that one virtual serial port is operated;
S44, thresholding will be less than or equal to the third-party control devices middle-end slogan corresponding to the control information The operation of any virtual serial port is converted into any virtual serial port for being more than thresholding to the third-party control devices middle-end slogan Operation, control the peripheral serial equipment.
Wherein, step S42-S44 operation is identical with the step S31-S33 of embodiment three operation, is not repeating to retouch herein State.
In the present embodiment, third-party control devices according to the default serial ports configuration information received, will thereon port numbers it is big Any virtual serial port of the port numbers less than or equal to thresholding is converted into any virtual serial port of thresholding so that application developer is led to Cross the operation being less than or equal to third-party control devices upper end slogan on any virtual serial port of thresholding of control device input The operation for being more than any virtual serial port of thresholding to third-party control devices upper end slogan can be converted into, and then is converted to pair The operation of the virtual serial port of peripheral serial equipment.So so that control device passes through any virtual on third-party control devices Serial ports, you can realize the control to peripheral serial equipment, such as access, read and write peripheral serial ports control device.
Correspondingly, as shown in figure 5, a kind of control device is also disclosed in the embodiment of the present invention five, including:
Receiving module 51, for receiving the control information operated to the virtual serial port of the control device;Wherein, should Operated corresponding to the control information inputted on the control device with developer, including the operation such as access, reading and writing.Inventive embodiments Described virtual serial port, it is identical with the virtual serial port described in implementation one, no longer describe herein.
Wherein, the receiving module 51 is additionally operable to receive default serial ports configuration information, and the default serial ports configuration information is Developer is default, specifically includes:
The log-on message of the virtual serial port;
The configuration file of the virtual serial port;
The physical serial interface of the peripheral serial equipment is converted into the driver of the virtual serial port of the control device.Its In, when configuring the default serial ports configuration information, used development language does not limit clearly developer, such as can be with For C language, C Plus Plus, assembler language etc..
Modular converter 52, for according to default serial ports configuration information, the serial ports of peripheral serial equipment being converted into control and set Standby virtual serial port;In this way, operation of the application developer to the virtual serial port can be exchanged into the physics for externally enclosing serial equipment The operation of serial ports.
Modular converter 52, to the virtual serial port corresponding to the control information for being additionally operable to receive receiving module 51 Operation be converted into the operation of the physical serial interface to the peripheral serial equipment.
In the specific implementation, as shown in fig. 6, modular converter 52 includes:
Log-on message recognition unit 61, for according to the log-on message, identification to need the virtual port loaded Loading sequence, port numbers and driving title;For example, log-on message recognition unit 61 is, it is necessary to the correspondence of the virtual serial port of loading Driving it is entitled:VirualCom.dll, port numbers 9.Herein, developer is at the end for setting the virtual serial port after changing During slogan, port number does not limit.
Driver records unit 62, for according to the configuration information, the physics string of the loading peripheral serial equipment Mouth is transformed into the driver of the virtual serial port of the control device;For example, driver records unit 62 according to developer The port numbers of configuration are the bib configuration files (wherein 9 be thresholding) of 9 virtual serial port, and loading end slogan is 12 virtual serial port The driver of 9 virtual serial ports is converted into, when operating system generates, to ensure to include the driving in the operating system Program.
Driver running unit, for running the driver, the physical serial interface of the peripheral serial equipment is turned Change the virtual serial port of control device into.
, wherein it is desired to explanation, developer is when using C Plus Plus to preset the driver, peripheral serial ports The manufacturer of equipment or third party developer's (being different from application developer) can complete periphery using COM_Init functions The initialization of serial equipment, the physical serial interface of peripheral serial equipment is opened using COM_Open functions, and pass through the physics string Serial equipment sends the control information that application developer inputs to mouth to the periphery.For example, also controlled using COM_Close functions outer Enclose the closing of the physical serial interface of serial equipment;The communication baud rate to physical serial interface is completed using COM_IOControl functions, Parity bit, the setting of data bit, hardware flow and device power supply (DPS) management, certainly to some control functions of peripheral serial equipment It can be encapsulated in the function.Peripheral serial equipment is unloaded using COM_Deinit functions, is completed using COM_Write Packet is simultaneously sent to peripheral serial equipment by encapsulation to packet.Paired data bag is carried out using COM_Read functions Read and parse, and transfer data to control device.
Transmit-Receive Unit 62, for sending the control information to the peripheral serial equipment by the virtual serial port; And returned for receiving after the peripheral serial equipment responds the operation corresponding to the control information to the virtual serial port Operating result.
In the present embodiment, in the presence of modular converter, the control for the application developer input that receiving module is received Operation corresponding to information to the virtual serial port of the control device is converted into the operation to peripheral serial equipment.It is in this way, all Application developer by controlling the virtual serial port on control device, you can realize control to peripheral serial equipment, such as access, Reading and writing periphery serial ports control device etc., without spend be concerned about the peripheral serial equipment bottom operation realization (such as:Periphery How serial equipment initializes, and how to receive and send the realization of the bottom operations such as data), reduce the work of application developer Amount, and also cause the virtual serial port that there is certain versatility and ease for operation.
Finally, as shown in fig. 7, the invention also discloses a kind of system for controlling peripheral serial equipment, including:
Control device 71, for according to default serial ports configuration information, the serial ports of peripheral serial equipment being converted into control and set Standby virtual serial port;Receive the control information operated to the virtual serial port of the control device;And the control is believed Operation corresponding to breath to the virtual serial port is converted into the operation of the physical serial interface to the peripheral serial equipment;
Peripheral serial equipment 72, the control information transmitted for receiving control apparatus are simultaneously responded corresponding to the control information Operation to the virtual serial port, and operating result is returned to by control device by its physical serial interface.
The system of the peripheral serial equipment of control of the present embodiment, by control device by the physical serial interface of peripheral serial equipment It is converted into the virtual serial port of control device so that operation of the application developer on the virtual serial port of control device can be changed The operation of paired peripheral serial equipment.In this way, all application developers are by controlling the virtual serial port on control device, The external control for enclosing serial equipment can be achieved, such as access, read and write peripheral serial ports control device, be concerned about the periphery without spending The bottom operation of serial equipment realization (such as:How peripheral serial equipment initializes, and how to receive and send the bottoms such as data The realization of operation), so as to reduce the development amount of application developer, and also cause the virtual serial port that there is certain lead to With property and ease for operation.
The embodiment of the present invention is provided above, is described in detail, specific case used herein is to this hair Bright principle and embodiment is set forth, the explanation of above example be only intended to help the method for understanding the present invention and its Core concept;Meanwhile for those of ordinary skill in the art, according to the thought of the present invention, in embodiment and application There will be changes in scope, in summary, this specification content should not be construed as limiting the invention.

Claims (4)

  1. A kind of 1. method for controlling peripheral serial equipment, it is characterised in that including:
    According to default serial ports configuration information, any virtual serial port that third-party control devices middle-end slogan is more than to thresholding is converted into Third-party control devices middle-end slogan is less than or equal to any virtual serial port of thresholding;The third-party control devices are gone here and there with periphery Any virtual serial port that jaws equipment is more than thresholding by the port numbers carries out serial communication;Control device is controlled with the third party Any virtual serial port that control equipment middle-end slogan is less than or equal to thresholding establishes connection;
    Any virtual string that receiving control apparatus transmits, being less than or equal to thresholding to the third-party control devices middle-end slogan The control information that mouth is operated;
    Any virtual of thresholding will be less than or equal to corresponding to the control information to the third-party control devices middle-end slogan The operation of serial ports is converted into the operation for being more than any virtual serial port of thresholding to the third-party control devices middle-end slogan, control The peripheral serial equipment.
  2. 2. the method as described in claim 1, it is characterised in that control device middle-end slogan is more than to any virtual string of thresholding Before mouth is converted into control device middle-end slogan less than or equal to any virtual serial port of thresholding, in addition to receives default serial ports and match somebody with somebody Confidence ceases, and the default serial ports configuration information includes:
    The log-on message of any virtual serial port less than or equal to thresholding;
    The configuration file of any virtual serial port less than or equal to thresholding;
    The port numbers are converted into the port numbers more than any virtual serial port of thresholding and are less than or equal to any virtual of thresholding The driver of serial ports.
  3. 3. method as claimed in claim 2, it is characterised in that the third-party control devices Built In Operating System, it is described to incite somebody to action Third-party control devices middle-end slogan is converted into third-party control devices middle-end slogan more than any virtual serial port of thresholding and is less than Or any virtual serial port equal to thresholding, including:
    The operating system is suitable according to the log-on message, the loading of identification any virtual port less than or equal to thresholding Sequence, port numbers and driving title;
    For the operating system according to the configuration file, any virtual serial port for loading the port numbers more than thresholding is converted into institute State driver of the port numbers less than or equal to any virtual serial port of thresholding;
    Driver described in the operating system, third-party control devices middle-end slogan is more than to any virtual string of thresholding Mouth is converted into any virtual serial port that third-party control devices middle-end slogan is less than or equal to thresholding.
  4. 4. the method as described in claim any one of 1-3, it is characterised in that by corresponding to the control information to the described 3rd The operation of any virtual serial port in square control device less than or equal to thresholding is converted into the third-party control devices middle-end Slogan is more than the operation of any virtual serial port of thresholding, and then controls the peripheral serial equipment, including:
    It is big less than or equal to any virtual serial port of thresholding, the port numbers that the control information is passed sequentially through into the port numbers The peripheral serial equipment is sent in any virtual serial port of thresholding;
    The peripheral serial equipment is received to respond corresponding to the control information to being less than or waiting in the third-party control devices The operating result returned after the operation of any virtual serial port of thresholding, and send the operating result to the control and set It is standby.
CN201710923154.1A 2011-10-17 2011-10-17 Method for controlling peripheral serial port equipment Active CN107729264B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710923154.1A CN107729264B (en) 2011-10-17 2011-10-17 Method for controlling peripheral serial port equipment

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710923154.1A CN107729264B (en) 2011-10-17 2011-10-17 Method for controlling peripheral serial port equipment
CN201110314253.2A CN103049401B (en) 2011-10-17 2011-10-17 A kind of method, system and control device for controlling peripheral serial equipment

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201110314253.2A Division CN103049401B (en) 2011-10-17 2011-10-17 A kind of method, system and control device for controlling peripheral serial equipment

Publications (2)

Publication Number Publication Date
CN107729264A true CN107729264A (en) 2018-02-23
CN107729264B CN107729264B (en) 2020-06-16

Family

ID=48062048

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201110314253.2A Active CN103049401B (en) 2011-10-17 2011-10-17 A kind of method, system and control device for controlling peripheral serial equipment
CN201710923154.1A Active CN107729264B (en) 2011-10-17 2011-10-17 Method for controlling peripheral serial port equipment

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN201110314253.2A Active CN103049401B (en) 2011-10-17 2011-10-17 A kind of method, system and control device for controlling peripheral serial equipment

Country Status (1)

Country Link
CN (2) CN103049401B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113360443A (en) * 2021-05-31 2021-09-07 浪潮电子信息产业股份有限公司 Serial port card communication implementation method, device, equipment and readable storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106021136B (en) * 2016-05-09 2019-01-01 广州广电运通金融电子股份有限公司 A kind of serial-port mapping method and device based on Linux or Unix kernel operating system
CN106201974A (en) * 2016-08-29 2016-12-07 深圳市华阳信通科技发展有限公司 A kind of serial data order keeping method and system
CN113064842B (en) * 2021-04-09 2024-06-07 艾体威尔电子技术(北京)有限公司 Physical serial port and virtual serial port self-adaptive switching system and method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050157328A1 (en) * 2004-01-20 2005-07-21 Han Sang-Eun Apparatus for transmitting print data using multiple virtual connections and a method thereof
CN1758187A (en) * 2005-11-25 2006-04-12 北京中星微电子有限公司 Virtual serial port device
CN101340459A (en) * 2008-08-07 2009-01-07 中兴通讯股份有限公司 Remote control method based on Bluetooth
CN101621440A (en) * 2009-05-22 2010-01-06 浙江天正电气股份有限公司 Remote multi-path serial port communication mapping system
CN101630370A (en) * 2008-07-14 2010-01-20 中兴通讯股份有限公司 Method for controlling radio frequency identification system and radio frequency identification system
CN101894041A (en) * 2010-07-15 2010-11-24 中兴通讯股份有限公司 Multivirtual serial port system and communication method thereof

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101470688A (en) * 2007-12-28 2009-07-01 希姆通信息技术(上海)有限公司 Method for implementing multi-function by single-terminal serial port

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050157328A1 (en) * 2004-01-20 2005-07-21 Han Sang-Eun Apparatus for transmitting print data using multiple virtual connections and a method thereof
CN1758187A (en) * 2005-11-25 2006-04-12 北京中星微电子有限公司 Virtual serial port device
CN101630370A (en) * 2008-07-14 2010-01-20 中兴通讯股份有限公司 Method for controlling radio frequency identification system and radio frequency identification system
CN101340459A (en) * 2008-08-07 2009-01-07 中兴通讯股份有限公司 Remote control method based on Bluetooth
CN101621440A (en) * 2009-05-22 2010-01-06 浙江天正电气股份有限公司 Remote multi-path serial port communication mapping system
CN101894041A (en) * 2010-07-15 2010-11-24 中兴通讯股份有限公司 Multivirtual serial port system and communication method thereof

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113360443A (en) * 2021-05-31 2021-09-07 浪潮电子信息产业股份有限公司 Serial port card communication implementation method, device, equipment and readable storage medium

Also Published As

Publication number Publication date
CN107729264B (en) 2020-06-16
CN103049401A (en) 2013-04-17
CN103049401B (en) 2018-02-06

Similar Documents

Publication Publication Date Title
CN104620564B (en) Apparatus and method for the transmission of the multi-protocol data element via the interface using data tunnel
CN103049401B (en) A kind of method, system and control device for controlling peripheral serial equipment
CN101212428B (en) Home gateway applied in digital home system
CN104620554B (en) For the technology using near-field communication transmission data payload
EP2497003A1 (en) Tcp/ip stack-based operating system
CN205680208U (en) A kind of single node bluetooth controlled in wireless self-help terminal equipment
CN105808396A (en) Chip debugging device, debugging method and SOC (System of Chip) chip system
CN107948009B (en) Method and model for constructing data interaction channel for PLC protocol test
CN102833137B (en) A kind of digital family system based on intelligent gateway
CN107092335A (en) The link training and administrative mechanism of optimization
CN117097762A (en) Cloud connection equipment and system based on LUA script
CN110515662A (en) Long-range control method, system, equipment and the readable storage medium storing program for executing of dual-system device
CN105354166B (en) Robot and the data transmission method being applicable in
CN102546637B (en) Communication terminal and method thereof for realizing communication protocol
CN102647317B (en) System and method for improving accessibility of sensor
CN101132568A (en) Mobile communication terminal and computer interactively integrated application system
CN102385557B (en) Drive processing method and processing device
Drumea et al. GSM solutions for low cost embedded systems for industrial control
CN101252598B (en) Development system and development method of network communication protocol stack
Ouyang Design and Implementation of a Wireless ZigBee Mesh Network
WO2017152738A1 (en) Method and apparatus for controlling intelligent terminal device via cloud desktop, and storage medium
CN209070523U (en) A kind of USB interface CAN card
CN204206217U (en) A kind of Intelligent communication module of PROFIBUS-DP interface
CN206921081U (en) Multi-channel serial port reversible controller
CN203012141U (en) GPS positioning terminal platform with video function

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant