CN108737259A - Gateway device, data transmission method and storage medium - Google Patents

Gateway device, data transmission method and storage medium Download PDF

Info

Publication number
CN108737259A
CN108737259A CN201810433385.9A CN201810433385A CN108737259A CN 108737259 A CN108737259 A CN 108737259A CN 201810433385 A CN201810433385 A CN 201810433385A CN 108737259 A CN108737259 A CN 108737259A
Authority
CN
China
Prior art keywords
data
target device
access parameter
json
source signal
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.)
Pending
Application number
CN201810433385.9A
Other languages
Chinese (zh)
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.)
Ping An Securities Co Ltd
Original Assignee
Ping An Securities 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 Ping An Securities Co Ltd filed Critical Ping An Securities Co Ltd
Priority to CN201810433385.9A priority Critical patent/CN108737259A/en
Publication of CN108737259A publication Critical patent/CN108737259A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0078Avoidance of errors by organising the transmitted data in a format specifically designed to deal with errors, e.g. location
    • H04L1/0083Formatting with frames or packets; Protocol or part of protocol for error control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Communication Control (AREA)

Abstract

The invention discloses a kind of gateway device, data transmission method and storage medium, the method includes:Obtain the source signal that source device is sent;The source signal of acquisition is parsed, to parse the data segment information of source signal, data segment information includes source address, valid data section and destination address;According to the mapping relations between pre-stored function code and destination address, determine that the function code of the corresponding target device of destination address, function code are the byte of preset kind length, the data frame type for identifying target device support;Valid data section is parsed, the corresponding access parameter of target device is obtained, according to the access parameter that the function code of target device obtains parsing, is converted into the data frame format of target device support, and it is sent to target device, valid data section includes the access parameter of target device.The present invention solves the problems, such as gateway device poor universality.

Description

Gateway device, data transmission method and storage medium
Technical field
The present invention relates to a kind of mutual communication field more particularly to gateway device, data transmission method and storage medium.
Background technology
Gateway (Gateway) is also known as gateway, protocol converter.Between devices into the process of row data communication In, it is typically passed through gateway device.
Usually, common gateway device only supports the conversion of single communication protocol, such as supports to be based on http agreements Conversion, or only support Modbus, the conversion of the communication protocols such as CAN cannot achieve the seamless switching between multi-protocols, lead Cause the poor universality of gateway device.
Invention content
In view of this, a kind of gateway device of present invention proposition, data transmission method and storage medium, it can be accurately and efficiently Improve the versatility of gateway.
First, to achieve the above object, the present invention proposes a kind of gateway device, the gateway device include memory and The processor being connect with the memory, the processor is for executing the data distributing program stored on the memory, institute It states when data distributing program is executed by the processor and realizes following steps:
A1, the source signal that source device is sent is obtained, the source signal includes one or more communication protocol data frames;
A2, the source signal of acquisition is parsed, to parse the data segment information in the communication protocol data frame, institute It includes source address, valid data section and destination address to state data segment information;
A3, according to the mapping relations between pre-stored function code and destination address, determine the corresponding mesh of destination address The function code of marking device, the function code are the byte of preset kind length, the data frame class for identifying target device support Type;
A4, the valid data section is parsed, the corresponding access parameter of target device is obtained, based on target device Function code converts the access parameter to the data frame format of target device support, and is sent to target device, described effective Data segment includes the access parameter of target device.
Preferably, described that the valid data are parsed in the step A4, obtain the corresponding visit of target device The step of asking parameter, including:
The valid data section is converted to correspondence by the frame type for determining the valid data section according to determining frame type The Json data frames of frame type;
Call interface function corresponding with the frame type of Json data frames;
The Json attributes of the Json data frames generated are obtained according to the interface function of calling;
The Json attributes of generation are matched with preset Json fields access table, obtain the access of the target device Parameter.
Preferably, described that the access parameter is converted by mesh based on the function code of target device in the step A4 The step of data frame format that marking device is supported, including:
Convert the access parameter to the data format of default system;
The data format of the default system is converted to based on the function code of target device the data of target device support Frame format.
Preferably, the step A2 further includes following steps:
Calculate the character information length of the valid data section parsed;
The character information length is analyzed according to the calculation of cyclic redundancy, obtains check code;
According to the check code of acquisition, the reliability of the source signal is determined.
Preferably, the communication protocol data frame that the source signal includes include TCP/IP data frames, CAN protocol data frame, Modbus protocol data frames and Bacnet protocol data frames.
In addition, to achieve the above object, the present invention also provides a kind of data transmission methods, and this method comprises the following steps:
S1, the source signal that source device is sent is obtained, the source signal includes one or more communication protocol data frames;
S2, the source signal of acquisition is parsed, to parse the data segment information in the communication protocol data frame, institute It includes source address, valid data section and destination address to state data segment information;
S3, according to the mapping relations between pre-stored function code and destination address, determine the corresponding mesh of destination address The function code of marking device, the function code are the byte of preset kind length, the data frame class for identifying target device support Type;
S4, the valid data section is parsed, the corresponding access parameter of target device is obtained, based on target device Function code converts the access parameter to the data frame format of target device support, and is sent to target device, described effective Data segment includes the access parameter of target device.
Preferably, described that the valid data are parsed in the step S4, obtain the corresponding visit of target device The step of asking parameter, including:
The valid data section is converted to correspondence by the frame type for determining the valid data section according to determining frame type The Json data frames of frame type;
Call interface function corresponding with the frame type of Json data frames;
The Json attributes of the Json data frames generated are obtained according to the interface function of calling;
The Json attributes of generation are matched with preset Json fields access table, obtain the access of the target device Parameter.
Preferably, described that the access parameter is converted by mesh based on the function code of target device in the step S4 The step of data frame format that marking device is supported, including:
Convert the access parameter to the data format of default system;
The data format of the default system is converted to based on the function code of target device the data of target device support Frame format.
Preferably, the step S2 further includes following steps:
Calculate the character information length of the valid data section parsed;
The character information length is analyzed according to the calculation of cyclic redundancy, obtains check code;
According to the check code of acquisition, the reliability of the source signal is determined.
In addition, to achieve the above object, it is described computer-readable the present invention also provides a kind of computer readable storage medium Storage medium is stored with data distributing program, and the data distributing program can be executed by least one processor so that it is described extremely A few processor is executed such as the step of above-mentioned data transmission method.
Compared to the prior art, gateway device proposed by the invention, data transmission method and storage medium pass through acquisition The source signal that source device is sent, and the source signal of acquisition is parsed, to parse the data segment information of source signal, the number Include source address, valid data section and destination address according to segment information;Then according to pre-stored function code and destination address Between mapping relations, determine the function code of the corresponding target device of destination address, the function code is preset kind length Byte, the data frame type for identifying target device support;Finally the valid data section is parsed, target is obtained and sets Standby corresponding access parameter is converted into target device support according to the access parameter that the function code of target device obtains parsing Data frame format, and be sent to target device, the valid data section includes the access parameter of target device.Gateway is improved to set Standby versatility.
Description of the drawings
Fig. 1 is the schematic diagram of one optional hardware structure of gateway device proposed by the present invention;
Fig. 2 is the program module schematic diagram of data distributing program in one embodiment of gateway device of the present invention;
Fig. 3 is the implementing procedure figure of data transmission method preferred embodiment of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific implementation mode
In order to make the purpose , technical scheme and advantage of the present invention be clearer, with reference to the accompanying drawings and embodiments, right The present invention is further elaborated.It should be appreciated that described herein, specific examples are only used to explain the present invention, not For limiting the present invention.Based on the embodiments of the present invention, those of ordinary skill in the art are not before making creative work The every other embodiment obtained is put, shall fall within the protection scope of the present invention.
It should be noted that the description for being related to " first ", " second " etc. in the present invention is used for description purposes only, and cannot It is interpreted as indicating or implying its relative importance or implicitly indicates the quantity of indicated technical characteristic.Define as a result, " the One ", the feature of " second " can explicitly or implicitly include at least one of the features.In addition, the skill between each embodiment Art scheme can be combined with each other, but must can be implemented as basis with those of ordinary skill in the art, when technical solution Will be understood that the combination of this technical solution is not present in conjunction with there is conflicting or cannot achieve when, also not the present invention claims Protection domain within.
As shown in fig.1, being one optional hardware structure schematic diagram of gateway device proposed by the present invention.In the present embodiment, Gateway device 10 may include, but be not limited only to, and connection memory 11, processor 12, net can be in communication with each other by communication bus 14 Network interface 13.It should be pointed out that Fig. 1 illustrates only the gateway device 10 with component 11-14, it should be understood that simultaneously All components shown realistic are not applied, the implementation that can be substituted is more or less component.
Wherein, memory 11 includes at least a type of computer readable storage medium, computer readable storage medium Including flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memories etc.), random access storage device (RAM), quiet State random access storage device (SRAM), electrically erasable programmable read-only memory (EEPROM), can be compiled read-only memory (ROM) Journey read-only memory (PROM), magnetic storage, disk, CD etc..In some embodiments, memory 11 can be that gateway is set For the hard disk or memory of 10 internal storage unit, such as gateway device 10.In further embodiments, memory 11 can also It is the outer packet storage device of gateway device 10, such as the plug-in type hard disk being equipped on gateway device 10, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..Certainly, it stores Device 11 can also both include gateway device 10 internal storage unit and also including its External memory equipment.In the present embodiment, storage Device 11 is installed on the operating system and types of applications software of gateway device 10, such as data distributing program etc. commonly used in storage. In addition, memory 11 can be also used for temporarily storing the Various types of data that has exported or will export.
Processor 12 can be in some embodiments central processing unit (Central Processing Unit, CPU), Controller, microcontroller, microprocessor or other data processing chips.Processor 12 is commonly used in control gateway device 10 Overall operation.In the present embodiment, the program code or processing data that processor 12 is used to store in run memory 11, such as The data distributing program etc. of operation.
Network interface 13 may include that radio network interface or wired network interface, network interface 13 are commonly used in setting in gateway It is standby that communication connection is established between 10 and other electronic equipments.
Communication bus 14 is for realizing the communication connection between component 11-13.
Fig. 1 illustrates only the gateway device 10 that proving program is opened with component 11-14 and fire wall, it should be understood that Be, it is not required that implement all components shown, the implementation that can be substituted is more or less component.
Optionally, gateway device 10 can also include user interface (not shown in figure 1), and user interface may include display Device, input unit such as keyboard, wherein user interface can also be including standard wireline interface and wireless interface etc..
Optionally, in some embodiments, display can be that light-emitting diode display, liquid crystal display, touch control type LCD are shown Device and OLED touch device etc..Further, display is alternatively referred to as display screen or display unit, for being shown in gateway device Information is handled in 10 and for showing visual user interface.
In one embodiment, when the data distributing program stored in memory 11 is executed by processor 12, following behaviour is realized Make:
The source signal that source device is sent is obtained, source signal includes one or more kinds of communication protocol data frames, i.e. source signal Multi-protocol gateway equipment can be sent to by various communications protocols.
Source device can be host computer, such as client, and source device can also be slave computer, such as protector cluster etc.. In general, host computer refers to the computer that can directly send out manipulation command, usually PC/host computer/master Computer/upper computer show various signal intensities (hydraulic pressure, water level, temperature etc.) on screen.Slave computer is direct Control device obtains the computer of status of equipment, usually PLC/ microcontrollers single chip microcomputer/slave Computer/lower computer's etc.The order that host computer is sent out gives slave computer, slave computer to be ordered further according to this first It is construed to corresponding time sequence signal and directly controls relevant device.Slave computer reads device status data (generally analog quantity) frequently, It is converted into digital signal and feeds back to host computer.Conceptually, controller and service provider are host computer, controlled person and bedding and clothing Business person is slave computer, it is understood that is the relationship of host and slave, but host computer and slave computer can be converted.
Further, above-mentioned multi-protocol gateway equipment can integrate ICP/IP protocol, CAN protocol (Controller Area Network, control area network bus agreement), (agreement supports traditional RS-232, RS-422, RS-485 to Mondbus agreements And ethernet device) and a variety of different communication protocols such as Bacnet agreements, and can realize the conversion between above-mentioned various protocols. I.e. the multi-protocol gateway equipment can receive the data of above-mentioned a variety of different self-defined Transmission Control Protocol transmission, the acquiescence of source device Data frame can be TCP/IP data frames or various customized Transmission Control Protocol data frames.
The source signal of acquisition is parsed, the data segment to parse the communication protocol data frame that source signal includes is believed Breath, data segment information includes source address, valid data section and destination address.
Specifically, so-called data frame (Data frame), is exactly the protocol Data Unit of data link layer, it includes three Point:Frame head, data portion, postamble.Wherein, frame head and postamble include some necessary control information, such as synchronizing information, address Information, error control information etc.;Data portion includes then the data, such as IP data packets etc. that network layer hands down.In general, sending out Sending end, data link layer network layer hand down data are packaged into frame, be subsequently sent to link up;In receiving terminal, data Link layer takes out the data in the frame received and gives network layer.Different data link layer protocols corresponds to different frames, So there are many frames, for example PPP frames, mac frame etc., specific format are also not quite similar.
In the present embodiment, wherein source address, valid data section, destination address are in data portion, specifically, source Location indicates the address for being originally sent equipment of source signal, such as the address of client;Destination address indicates what source signal eventually arrived at The address of target device, such as can be the address of insurance service equipment.Further, source address and destination address can be adopted It is identified with (such as 7) byte mode of preset quantity.If in the data segment information parsed not including source address or mesh Address, then each byte of its source address or destination address is disposed as 0.
Valid data section refers to be converted to the data segment of Json data frame formats in data segment information.
Further, in some other embodiment, the source signal of acquisition is parsed, to parse source signal packet The step of data segment information of the communication protocol data frame contained further includes following steps:
Calculate the character information length of the valid data section parsed;
Character information length is analyzed according to the calculation of cyclic redundancy, obtains check code;
According to the check code of acquisition, determine source signal whether reliability.
In general, the valid data section and data length that will be obtained from source signal, according to the calculation of cyclic redundancy The legitimacy for calculating and obtaining check code, and accessed according to the verification code check source device obtained is calculated.Specifically, cyclic redundancy It is most common a kind of error check code in data communication field that calculation, which calculates and obtains check code, it is characterized in that information field Length with check field can be arbitrarily selected.It generates the basic principle of check code:Any one is by bit string group At code can be only with a coefficient 0 and 1 value multinomial correspond.Such as code 1010111 is corresponding more Xiang Shiwei x6+x4+x2+x+1, and it is 101111 etc. that multinomial, which is the corresponding codes of x5+x3+x2+x+1,.And verify code collection selection Principle be:If setting the code word size of check code as N, information field is K, and check field is R (N=K+R), then for inspection Any code word in code collection is tested, exists and there is only a R order polynomial g (x) so that V (x)=A (x) g (x)=xRm (x)+r (x);Wherein, m (x) is K-1 message polynomial, and r (x) is r-1 check polynomial, and g (x) is known as generator polynomial, specifically Ground, g (x)=g0+g1 × 1+g2 × 2+...+g (R-1) × (R-1)+gR × R;Source signal sender is produced by specified g (x) The code word of raw check code, receiving side signal then verify the code word received by the g (x).
According to the mapping relations between the function code and destination address to prestore, the function code of target device is determined;Function code For the predefined byte for identifying the data frame type of target device support, generally a byte.The work(of target device Energy code is the byte of the data frame type for identifying target device support.
The valid data section obtained to parsing parses, and obtains the access parameter of target device, and according to target device Function code convert obtained the accesss parameter of parsing to the data frame format that target device is supported, be sent to target device.
Specifically, the valid data section that parsing obtains is converted into Json data frames first;Generally, due to valid data section It can be formed by specific Json frame formats data conversion, therefore, by source signal resolving, acquisition can be converted into For the data segment of Json data frame formats as valid data section, the frame type of the valid data section is the frame class of Json data frames Type.And it further parses the valid data section and obtains Json data frames.Since usually used Ethernet or WIFI modes are made For bottom transmission medium, can all be related to ICP/IP protocol, application layer usually using HTTP mode, so selection uses Json The transmission frame as valid data section of data frame can easily parse the access parameter of target device.
Specifically, Json data frames are parsed, obtains the access parameter of target device, and according to the work(of target device Energy code converts the access parameter that parsing obtains to the data frame format of target device support, is sent to target device.
Specifically, interface function corresponding with Json data frames can be called, and is obtained according to the interface function of calling The Json attributes and preset Json fields are accessed table progress by the Json attributes of the corresponding character string forms of Json data frames Match, can know the access parameter of target device.Further, the access parameter of the target device of acquisition is converted to 16 systems Data, and the data of 16 systems are further converted to the data frame format of target device support, in order to by target device Access parameter be sent to target device.
By above-described embodiment it is found that gateway device proposed by the present invention, the source signal sent by obtaining source device, and it is right The source signal of acquisition is parsed, and to parse the data segment information of source signal, the data segment information includes source address, effectively Data segment and destination address;Then according to the mapping relations between pre-stored function code and destination address, purpose is determined The function code of the corresponding target device in address, the function code is the byte of preset kind length, for identifying target device branch The data frame type held;Finally the valid data section is parsed, the corresponding access parameter of target device is obtained, according to mesh The access parameter that the function code of marking device obtains parsing, is converted into the data frame format of target device support, and is sent to mesh Marking device, the valid data section include the access parameter of target device.Improve the versatility of gateway device.
Explanation is needed further exist for, data distributing program of the invention is different according to the function that its each section is realized, It can be described with program module with the same function.It please refers to shown in Fig. 2, is number in one embodiment of gateway device of the present invention According to the program module schematic diagram of transmission program.In the present embodiment, function that data distributing program is realized according to its each section Difference can be divided into acquisition module 201, parsing module 202, determining module 203 and parameter conversion module 204.By upper The description in face is it is found that the so-called program module of the present invention is the series of computation machine program instruction for referring to complete specific function Section, the implementation procedure than program more suitable for description data distributing program in gateway device 10.Wherein, module 201-204 institutes The functions or operations step of realization is similar as above, and and will not be described here in detail, illustratively, such as wherein:
Acquisition module 201 is used to obtain the source signal of source device transmission, and source signal includes one or more kinds of communication protocols Data frame, i.e. source signal can be sent to multi-protocol gateway equipment by various communications protocols.Source device can be host computer, example Such as client, source device can also be controlled device, such as protector cluster etc..
Parsing module 202 is for parsing the source signal of acquisition, to parse the communication protocol data frame of source signal In data segment information, data segment information includes source address, valid data section and destination address.
Determining module 203 is used to, according to the mapping relations between the function code to prestore and destination address, determine target device Function code;Function code is the predefined byte for identifying the data frame type of target device support, generally a word Section.The function code of target device is the byte of the data frame type for identifying target device support.
Parameter conversion module 204 is used to parse the valid data section that parsing obtains, and obtains the access of target device Parameter, and the access parameter that parsing obtains is converted by the data frame lattice that target device is supported according to the function code of target device Formula is sent to target device.
In addition, the present invention also proposes a kind of data transmission method, please refer to shown in Fig. 3, the data transmission method includes Following steps:
S100, the source signal that source device is sent is obtained, source signal includes one or more kinds of communication protocol data frames, i.e. source Signal can be sent to multi-protocol gateway equipment by various communications protocols.
Source device can be host computer, such as client, and source device can also be slave computer, such as protector cluster etc.. In general, host computer refers to the computer that can directly send out manipulation command, usually PC/host computer/master Computer/upper computer show various signal intensities (hydraulic pressure, water level, temperature etc.) on screen.Slave computer is direct Control device obtains the computer of status of equipment, usually PLC/ microcontrollers single chip microcomputer/slave Computer/lower computer's etc.The order that host computer is sent out gives slave computer, slave computer to be ordered further according to this first It is construed to corresponding time sequence signal and directly controls relevant device.Slave computer reads device status data (generally analog quantity) frequently, It is converted into digital signal and feeds back to host computer.Conceptually, controller and service provider are host computer, controlled person and bedding and clothing Business person is slave computer, it is understood that is the relationship of host and slave, but host computer and slave computer can be converted.
Further, above-mentioned multi-protocol gateway equipment can integrate ICP/IP protocol, CAN protocol (Controller Area Network, control area network bus agreement), (agreement supports traditional RS-232, RS-422, RS-485 to Mondbus agreements And ethernet device) and a variety of different communication protocols such as Bacnet agreements, and can realize the conversion between above-mentioned various protocols. I.e. the multi-protocol gateway equipment can receive the data of above-mentioned a variety of different self-defined Transmission Control Protocol transmission, the acquiescence of source device Data frame can be TCP/IP data frames or various customized Transmission Control Protocol data frames.
S200, the source signal of acquisition is parsed, the data segment in communication protocol data frame to parse source signal Information, data segment information include source address, valid data section and destination address.
Specifically, so-called data frame (Data frame), is exactly the protocol Data Unit of data link layer, it includes three Point:Frame head, data portion, postamble.Wherein, frame head and postamble include some necessary control information, such as synchronizing information, address Information, error control information etc.;Data portion includes then the data, such as IP data packets etc. that network layer hands down.In general, sending out Sending end, data link layer network layer hand down data are packaged into frame, be subsequently sent to link up;In receiving terminal, data Link layer takes out the data in the frame received and gives network layer.Different data link layer protocols corresponds to different frames, So there are many frames, for example PPP frames, mac frame etc., specific format are also not quite similar.
In the present embodiment, wherein source address, valid data section, destination address are in data portion, specifically, source Location indicates the address for being originally sent equipment of source signal, such as the address of client;Destination address indicates what source signal eventually arrived at The address of target device, such as can be the address of insurance service equipment.Further, source address and destination address can be adopted It is identified with (such as 7) byte mode of preset quantity.If in the data segment information parsed not including source address or mesh Address, then each byte of its source address or destination address is disposed as 0.
Valid data section refers to be converted to the data segment of Json data frame formats in data segment information.
Further, in some other embodiment, above-mentioned steps S200 further includes following steps:
Calculate the character information length of the valid data section parsed;
Character information length is analyzed according to the calculation of cyclic redundancy, obtains check code;
According to the check code of acquisition, determine source signal whether reliability.
In general, the valid data section and data length that will be obtained from source signal, according to the calculation of cyclic redundancy The legitimacy for calculating and obtaining check code, and accessed according to the verification code check source device obtained is calculated.Specifically, cyclic redundancy It is most common a kind of error check code in data communication field that calculation, which calculates and obtains check code, it is characterized in that information field Length with check field can be arbitrarily selected.It generates the basic principle of check code:Any one is by bit string group At code can be only with a coefficient 0 and 1 value multinomial correspond.Such as code 1010111 is corresponding more Xiang Shiwei x6+x4+x2+x+1, and it is 101111 etc. that multinomial, which is the corresponding codes of x5+x3+x2+x+1,.And verify code collection selection Principle be:If setting the code word size of check code as N, information field is K, and check field is R (N=K+R), then for inspection Any code word in code collection is tested, exists and there is only a R order polynomial g (x) so that V (x)=A (x) g (x)=xRm (x)+r (x);Wherein, m (x) is K-1 message polynomial, and r (x) is r-1 check polynomial, and g (x) is known as generator polynomial, specifically Ground, g (x)=g0+g1 × 1+g2 × 2+...+g (R-1) × (R-1)+gR × R;Source signal sender is produced by specified g (x) The code word of raw check code, receiving side signal then verify the code word received by the g (x).
Mapping relations between S300, the basis function code to prestore and destination address, determine the function code of target device;Work( Energy code is the predefined byte for identifying the data frame type of target device support, generally a byte.Target device Function code be for identify target device support data frame type byte.
S400, the valid data section obtained to parsing parse, and obtain the access parameter of target device, and be based on target The function code of equipment converts the access parameter that parsing obtains to the data frame format of target device support, is sent to target and sets It is standby.
Specifically, the valid data section that parsing obtains is converted into Json data frames first;Generally, due to valid data section It can be formed by specific Json frame formats data conversion, therefore, by source signal resolving, acquisition can be converted into For the data segment of Json data frame formats as valid data section, the frame type of the valid data section is the frame class of Json data frames Type.And it further parses the valid data section and obtains Json data frames.Since usually used Ethernet or WIFI modes are made For bottom transmission medium, can all be related to ICP/IP protocol, application layer usually using HTTP mode, so selection uses Json The transmission frame as valid data section of data frame can easily parse the access parameter of target device.
Specifically, Json data frames are parsed, obtains the access parameter of target device, and according to the work(of target device Energy code converts the access parameter that parsing obtains to the data frame format of target device support, is sent to target device.
Specifically, interface function corresponding with Json data frames can be called, and is obtained according to the interface function of calling The Json attributes and preset Json fields are accessed table progress by the Json attributes of the corresponding character string forms of Json data frames Match, can know the access parameter of target device.Further, the access parameter of the target device of acquisition is converted to 16 systems Data, and the data of 16 systems are further converted to the data frame format of target device support, in order to by target device Access parameter be sent to target device.
By above-described embodiment it is found that data transmission method proposed by the present invention, the source signal sent by obtaining source device, And the source signal of acquisition is parsed, to parse the data segment information of source signal, the data segment information include source address, Valid data section and destination address;Then it according to the mapping relations between pre-stored function code and destination address, determines The function code of the corresponding target device of destination address, the function code are the byte of preset kind length, are set for identifying target The standby data frame type supported;Finally the valid data section is parsed, obtains the corresponding access parameter of target device, root According to the access parameter that the function code of target device obtains parsing, it is converted into the data frame format of target device support, and transmit To target device, the valid data section includes the access parameter of target device.Improve the versatility of gateway device.By above-mentioned thing Example is it is found that proposed by the present invention
In addition, the present invention also proposes a kind of computer readable storage medium, number is stored on computer readable storage medium Following operation is realized according to transmission program, when data distributing program is executed by processor:
The source signal that source device is sent is obtained, source signal includes one or more kinds of communication protocol data frames;
The source signal of acquisition is parsed, the data segment information in communication protocol data frame to parse source signal, Data segment information includes source address, valid data section and destination address;
According to the mapping relations between the function code and destination address to prestore, the function code of target device is determined;
The valid data section obtained to parsing parses, and obtains the access parameter of target device, and according to target device Function code convert obtained the accesss parameter of parsing to the data frame format that target device is supported, be sent to target device.
Computer readable storage medium specific implementation mode of the present invention and above-mentioned gateway device and data transmission method are each Embodiment is essentially identical, does not make tired state herein.
The embodiments of the present invention are for illustration only, can not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical scheme of the present invention substantially in other words does the prior art Going out the part of contribution can be expressed in the form of software products, which is stored in a storage medium In (such as ROM/RAM, magnetic disc, CD), including some instructions are used so that a station terminal equipment (can be mobile phone, computer, clothes Be engaged in device, air conditioner or the network equipment etc.) execute method described in each embodiment of the present invention.
It these are only the preferred embodiment of the present invention, be not intended to limit the scope of the invention, it is every to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of gateway device, which is characterized in that the gateway device includes memory and the processing that is connect with the memory Device, the processor is for executing the data distributing program stored on the memory, and the data distributing program is by the place Reason device realizes following steps when executing:
A1, the source signal that source device is sent is obtained, the source signal includes one or more communication protocol data frames;
A2, the source signal of acquisition is parsed, to parse the data segment information in the communication protocol data frame, the number Include source address, valid data section and destination address according to segment information;
A3, according to the mapping relations between pre-stored function code and destination address, determine the corresponding function code of destination address, The function code is the byte of preset kind length, the data frame type for identifying target device support;
A4, the valid data section is parsed, obtains the corresponding access parameter of target device, the function based on target device Code converts the access parameter to the data frame format of target device support, and is sent to target device, the valid data Section includes the access parameter of target device.
2. gateway device as described in claim 1, which is characterized in that described to the valid data in the step A4 Duan Jinhang is parsed, the step of obtaining target device corresponding access parameter, including:
The valid data section is converted to corresponding frame class by the frame type for determining the valid data section according to determining frame type The Json data frames of type;
Call interface function corresponding with the frame type of Json data frames;
The Json attributes of the Json data frames generated are obtained according to the interface function of calling;
The Json attributes of generation are matched with preset Json fields access table, obtain the access ginseng of the target device Number.
3. gateway device as claimed in claim 2, which is characterized in that described based on target device in the step A4 The step of function code converts the access parameter to the data frame format of target device support, including:
Convert the access parameter to the data format of default system;
The data format of the default system is converted to based on the function code of target device the data frame lattice of target device support Formula.
4. gateway device as described in claim 1, which is characterized in that the step A2 further includes following steps:
Calculate the character information length of the valid data section parsed;
The character information length is analyzed according to the calculation of cyclic redundancy, obtains check code;
According to the check code of acquisition, the reliability of the source signal is determined.
5. gateway device according to any one of claims 1-4, which is characterized in that the communication protocol number that the source signal includes Include TCP/IP data frames, CAN protocol data frame, Modbus protocol data frames and Bacnet protocol data frames according to frame.
6. a kind of data transmission method, which is characterized in that described method includes following steps:
S1, the source signal that source device is sent is obtained, the source signal includes one or more communication protocol data frames;
S2, the source signal of acquisition is parsed, to parse the data segment information in the communication protocol data frame, the number Include source address, valid data section and destination address according to segment information;
S3, according to the mapping relations between pre-stored function code and destination address, determine that the corresponding target of destination address is set Standby function code, the function code are the byte of preset kind length, the data frame type for identifying target device support;
S4, the valid data section is parsed, obtains the corresponding access parameter of target device, the function based on target device Code converts the access parameter to the data frame format of target device support, and is sent to target device, the valid data Section includes the access parameter of target device.
7. data transmission method as claimed in claim 6, which is characterized in that described to described effective in the step S4 Data segment is parsed, the step of obtaining target device corresponding access parameter, including:
The valid data section is converted to corresponding frame class by the frame type for determining the valid data section according to determining frame type The Json data frames of type;
Call interface function corresponding with the frame type of Json data frames;
The Json attributes of the Json data frames generated are obtained according to the interface function of calling;
The Json attributes of generation are matched with preset Json fields access table, obtain the access ginseng of the target device Number.
8. data transmission method as claimed in claim 7, which is characterized in that described to be set based on target in the step S4 The step of standby function code converts the access parameter to the data frame format of target device support, including:
Convert the access parameter to the data format of default system;
The data format of the default system is converted to based on the function code of target device the data frame lattice of target device support Formula.
9. data transmission method as claimed in claim 6, which is characterized in that the step S2 further includes following steps:
Calculate the character information length of the valid data section parsed;
The character information length is analyzed according to the calculation of cyclic redundancy, obtains check code;
According to the check code of acquisition, the reliability of the source signal is determined.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has data distributing program, the number It can be executed by least one processor according to transmission program, so that at least one processor is executed as appointed in claim 6-9 The step of data transmission method described in one.
CN201810433385.9A 2018-05-08 2018-05-08 Gateway device, data transmission method and storage medium Pending CN108737259A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810433385.9A CN108737259A (en) 2018-05-08 2018-05-08 Gateway device, data transmission method and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810433385.9A CN108737259A (en) 2018-05-08 2018-05-08 Gateway device, data transmission method and storage medium

Publications (1)

Publication Number Publication Date
CN108737259A true CN108737259A (en) 2018-11-02

Family

ID=63938001

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810433385.9A Pending CN108737259A (en) 2018-05-08 2018-05-08 Gateway device, data transmission method and storage medium

Country Status (1)

Country Link
CN (1) CN108737259A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110381050A (en) * 2019-07-12 2019-10-25 中国人民解放军战略支援部队信息工程大学 The multi-protocols conversion method of calibration and device of data packet
CN112463662A (en) * 2020-12-16 2021-03-09 福州创实讯联信息技术有限公司 Method and terminal for controlling I2C equipment by user mode
CN112565031A (en) * 2020-11-30 2021-03-26 福州汇思博信息技术有限公司 Parameter configuration method and terminal for PPP connection
CN113422718A (en) * 2021-06-18 2021-09-21 河南力安测控科技有限公司 Configuration protocol-based internet of things gateway and method for docking equipment
CN113742407A (en) * 2021-08-31 2021-12-03 浙江惠瀜网络科技有限公司 Data conversion method and device
CN114500267A (en) * 2022-01-14 2022-05-13 深圳市汇川技术股份有限公司 Mapping relation configuration method, device, system, equipment and readable storage medium
CN115002231A (en) * 2022-05-27 2022-09-02 苏州联讯仪器有限公司 Communication protocol based on HEX format, communication device and medium
CN116684506A (en) * 2023-08-02 2023-09-01 浪潮电子信息产业股份有限公司 Data processing method, system, electronic device and computer readable storage medium
CN116708579A (en) * 2023-08-04 2023-09-05 浪潮电子信息产业股份有限公司 Data access method, device, electronic equipment and computer readable storage medium
CN117640783A (en) * 2024-01-25 2024-03-01 富瀚微电子(成都)有限公司 Data transmission method, system, electronic equipment and readable medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107124421A (en) * 2017-05-11 2017-09-01 珠海格力电器股份有限公司 Communication means based on multi-protocols, multi-protocol gateway equipment and can storage medium
CN107302528A (en) * 2017-06-12 2017-10-27 深圳市诺龙技术股份有限公司 A kind of transmission method of multi-protocol data and a kind of gateway apparatus
CN107888488A (en) * 2016-09-30 2018-04-06 西门子(中国)有限公司 Intelligent gateway and its method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107888488A (en) * 2016-09-30 2018-04-06 西门子(中国)有限公司 Intelligent gateway and its method
CN107124421A (en) * 2017-05-11 2017-09-01 珠海格力电器股份有限公司 Communication means based on multi-protocols, multi-protocol gateway equipment and can storage medium
CN107302528A (en) * 2017-06-12 2017-10-27 深圳市诺龙技术股份有限公司 A kind of transmission method of multi-protocol data and a kind of gateway apparatus

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110381050A (en) * 2019-07-12 2019-10-25 中国人民解放军战略支援部队信息工程大学 The multi-protocols conversion method of calibration and device of data packet
CN110381050B (en) * 2019-07-12 2022-01-21 中国人民解放军战略支援部队信息工程大学 Multi-protocol conversion and verification method and device for data packet
CN112565031B (en) * 2020-11-30 2023-05-05 福州汇思博信息技术有限公司 Parameter configuration method and terminal for PPP connection
CN112565031A (en) * 2020-11-30 2021-03-26 福州汇思博信息技术有限公司 Parameter configuration method and terminal for PPP connection
CN112463662A (en) * 2020-12-16 2021-03-09 福州创实讯联信息技术有限公司 Method and terminal for controlling I2C equipment by user mode
CN112463662B (en) * 2020-12-16 2024-04-05 福州创实讯联信息技术有限公司 Method and terminal for user mode control of I2C equipment
CN113422718A (en) * 2021-06-18 2021-09-21 河南力安测控科技有限公司 Configuration protocol-based internet of things gateway and method for docking equipment
CN113742407A (en) * 2021-08-31 2021-12-03 浙江惠瀜网络科技有限公司 Data conversion method and device
CN113742407B (en) * 2021-08-31 2024-04-30 浙江惠瀜网络科技有限公司 Data conversion method and device
CN114500267A (en) * 2022-01-14 2022-05-13 深圳市汇川技术股份有限公司 Mapping relation configuration method, device, system, equipment and readable storage medium
CN115002231A (en) * 2022-05-27 2022-09-02 苏州联讯仪器有限公司 Communication protocol based on HEX format, communication device and medium
CN116684506A (en) * 2023-08-02 2023-09-01 浪潮电子信息产业股份有限公司 Data processing method, system, electronic device and computer readable storage medium
CN116684506B (en) * 2023-08-02 2023-11-07 浪潮电子信息产业股份有限公司 Data processing method, system, electronic device and computer readable storage medium
CN116708579A (en) * 2023-08-04 2023-09-05 浪潮电子信息产业股份有限公司 Data access method, device, electronic equipment and computer readable storage medium
CN116708579B (en) * 2023-08-04 2024-01-12 浪潮电子信息产业股份有限公司 Data access method, device, electronic equipment and computer readable storage medium
CN117640783A (en) * 2024-01-25 2024-03-01 富瀚微电子(成都)有限公司 Data transmission method, system, electronic equipment and readable medium
CN117640783B (en) * 2024-01-25 2024-04-09 富瀚微电子(成都)有限公司 Data transmission method, system, electronic equipment and readable medium

Similar Documents

Publication Publication Date Title
CN108737259A (en) Gateway device, data transmission method and storage medium
CN108494771B (en) Electronic device, firewall opening verification method and storage medium
CN108062230B (en) Serial ports transparent transmission and program updating system and its method in a kind of Internet wide
CN110049059A (en) A kind of outer net equipment and Intranet communication between devices method and relevant apparatus
CN107426770B (en) Data communication method, data terminal and system based on data link layer
CN108199931A (en) A kind of household electric appliance control method and system
JP2005328427A (en) Packet generating method, communication method, packet processing method, and data structure
CN110933170A (en) Multi-device linkage control method and device of ZigBee gateway and storage medium
CN110134421A (en) Electric energy meter managing chip upgrade method, system and electronic equipment and storage medium
CN108306953A (en) A kind of strong compatible real time push method presented for Internet of Things application data
CN103314554B (en) DynamicHost configuration file for option mod
US20130074047A1 (en) Method for operating a household appliance and household appliance intended for use in such a method
US20050225426A1 (en) System and method for remote controlling and monitoring electric home appliances
CN111083447B (en) Network communication method, device and storage medium
JP4838096B2 (en) Home appliance communication control system
CN111682965A (en) FOTA controller
CN106303931A (en) A kind of data transmission method based on NFC and terminal
CN111885564B (en) Data transmission method, equipment upgrading method and computer readable storage medium
CN115499387A (en) Message processing method and device, electronic equipment and storage medium
JP2007036698A (en) Communication device, control method and control program of the same
CN114500158A (en) Computer resolvable Modbus-RTU universal standardized configuration method
CN110912717B (en) Broadcasting method and server of centerless multi-channel concurrent transmission system
CN112000644B (en) Data processing method and system, electronic equipment and storage medium
CN108108464A (en) Image processing method, device, electronic equipment and medium
CN114579166A (en) Component module upgrading method, component module and financial robot

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20181102

RJ01 Rejection of invention patent application after publication