Summary of the invention
The object of this invention is to provide a kind of radio data transmission method, Apparatus and system based on CDMA or GPRS wireless public network, the mode that adopts short message and get online without being tethered to a cable and combine, is initiatively initiated to connect by server unit and sets up communication channel.Server unit is without being used fixing public network IP address, also without using dynamic domain name server provider; Towards the application demand of small distributed purpose monitoring system, can provide convenient, flexibly, wireless data transmission function cheaply.
For achieving the above object, according to an aspect of the present invention, a kind of radio data transmission method based on CDMA or GPRS wireless public network has been proposed, the communicating pair of described Wireless Data Transmission is equipment end unit and server unit, communicating pair inside all comprises CDMA or GPRS wireless communication module and corresponding Mobile phone card, it is characterized in that, the method comprises the following steps:
Step 1, sets up the communication channel between described equipment end unit and described server unit;
Step 2, described server unit and described equipment end unit carry out the transmitted in both directions of data in the communication channel establishing with Socket communication mode;
Wherein, described step 1 is further comprising the steps:
Step 1.1, after described server unit is received the order connecting that server computer sends, to its inner CDMA or GPRS wireless communication module Sending dialled number link order, foundation is connected with the PPP of CDMA or GPRS wireless public network;
Step 1.2, described server unit sends and obtains address instruction and obtain its IP address in public network to its inner CDMA or GPRS wireless communication module;
Step 1.3, described server unit sends and sets up TCP server instruction and set up TCP server to its inner CDMA or GPRS wireless communication module, and opens a certain network port and enter the state of intercepting, and waiting facilities end unit connects;
Step 1.4, the information that described server unit structure comprises its public network IP address, and send SMS message transmission instruction so that the mode with short message sends on the Mobile phone card of described equipment end unit by this information to its inner CDMA or GPRS wireless communication module;
Step 1.5, described equipment end unit receives after the short message that comprises server unit public network IP address, parsed, and to its inner CDMA or GPRS wireless communication module Sending dialled number link order, foundation is connected with the PPP of CDMA or GPRS wireless public network;
Step 1.6, described equipment end unit is set up the instruction of TCP client and is set up TCP client by sending to its inner CDMA or GPRS wireless communication module, and connects the TCP server that is in the state of intercepting that described server unit is set up;
Step 1.7, after establishing TCP between described equipment end unit and described server unit and being connected, all can receive that TCP communication channel is successfully established instruction from CDMA or GPRS wireless communication module separately, represent that the TCP communication channel between described equipment end unit and described server unit is successfully established.
According to a further aspect in the invention, a kind of wireless system for transmitting data based on CDMA or GPRS wireless public network has also been proposed, it is characterized in that, this system comprises Yi Ge service centre, a plurality of field apparatus and the equipment end unit for Wireless Data Transmission being connected respectively with a plurality of field apparatuss, wherein
Described service centre comprises server computer and for the server unit of Wireless Data Transmission;
Between described server computer and described server unit, pass through RS232 interface communication;
Each field apparatus in described a plurality of field apparatus comprises device controller and the external functional part for image data and control with it thereof;
Described device controller is connected with the equipment end unit for Wireless Data Transmission by RS232 interface;
Described equipment end unit and described server unit are set up Wireless Data Transmission channel by CDMA or GPRS wireless public network, to carry out the transparent transmission between described device controller and described server computer.
According to a further aspect in the invention, a kind of wireless data transmission device based on CDMA or GPRS wireless public network has also been proposed, as equipment end, it is characterized in that, this device comprise arm processor, CDMA or GPRS wireless communication module, with described CDMA or the corresponding UIM of GPRS wireless communication module or SIM Mobile phone card and communication antenna and power transfer module, wherein
Described UIM or SIM Mobile phone card connect as described CDMA or GPRS wireless communication module the subscriber identification card that enters described CDMA or GPRS wireless public network;
Described arm processor is used for from described CDMA or GPRS wireless communication module reading out data, receive and short message that resolution server end sends, also for sending instruction to described CDMA or GPRS wireless communication module to set up and being connected or carrying out transfer of data of being connected of described CDMA or GPRS wireless public network, foundation and described server end;
The instruction for sending according to described arm processor of described CDMA or GPRS wireless communication module, being connected or carrying out transfer of data of being connected of foundation and CDMA or GPRS wireless public network, foundation and described server end;
The periphery of described arm processor is connected with clock circuit, reset circuit and DLL (dynamic link library);
Described arm processor expands two RS232 interface modules, and one of them is for communicating by letter with host computer, and another is communicated by letter with described CDMA or GPRS wireless communication module;
Described power transfer module is connected with described arm processor, for the direct voltage of input being converted to described arm processor and described CDMA or the required voltage of GPRS wireless communication module.
Distinguishing feature of the present invention is short message mode to be applied in the process of establishing of the Wireless Data Transmission channel based on CDMA or GPRS wireless public network, by server end unit, obtain dynamic public network IP address, mode with short message sends to equipment end unit, thereby enter in conventional wireless Socket communication connection flow process, not only avoided wireless system for transmitting data to there is the fixedly harsh requirement of public network IP address for server unit, also without utilizing third party's dynamic territory analyzing provider, also make simultaneously communication pattern by equipment end unit all the time line model change into the pattern of being waken up by short message by server unit, improved the flexibility of system, saved communications cost.
The mode that the present invention is based on short message and get online without being tethered to a cable and combine, adopt embedded software hardware design technique to realize embedded radio data transmission device, comprise common SIM or UIM Mobile phone card, can get online without being tethered to a cable easily and flexibly and receiving short message operation, there is standard RS232 interface, can be connected and carry out data communication with computer or equipment end controller, can build neatly the distributed small-sized purpose monitoring system based on CDMA or GPRS wireless public network, be particularly suitable for the purpose monitoring of the node device that the Regional Distribution such as outlying district or maritime area are wider.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with specific embodiment, and with reference to accompanying drawing, the present invention is described in more detail.
Radio data transmission method based on CDMA or GPRS wireless public network, it is the effective settling mode that builds small low-cost distributed wireless purpose monitoring system, the mode that adopts short message and get online without being tethered to a cable and combine, effectively solve server unit for the fixing dependence of public network IP address, improved the flexibility of wireless system for transmitting data in concrete application process.Below in conjunction with accompanying drawing, the embodiment of this invention is described.It is pointed out that embodiment provided by the present invention is a kind of execution mode in summary of the invention, its summary of the invention comprises but is not limited only to this embodiment.
Fig. 1 is the composition frame chart of wireless system for transmitting data.The main You Yige of this system service centre, a plurality of field apparatus and the equipment end unit for Wireless Data Transmission being connected respectively with a plurality of field apparatuss form, and form thus the distributed monitoring monitoring network based on CDMA/GPRS wireless public network.Wherein service centre mainly forms by server computer with for the server unit of Wireless Data Transmission, between server computer and server unit by RS232 interface communication.Each field apparatus comprises device controller and the external functional part for image data and control with it thereof, such as (only showing device controller in figure) such as transducer, motor, electromagnetically operated valve, relays.Device controller is connected with the equipment end unit for Wireless Data Transmission by RS232 interface.Equipment end unit and server unit are set up Wireless Data Transmission channel by CDMA/GPRS wireless public network, and then realize the data transparent transmission between device controller and server computer.
Described server unit and equipment end unit adopt identical structure constituted mode, all by CDMA or GPRS wireless communication module, Mobile phone card, power transfer module, ARM controller module, two RS232 interface modules form, wherein ARM controller module is the control core of server unit or equipment end unit, between ARM controller module and device controller or server computer, by RS232 interface module, communicate, between ARM controller module and CDMA or GPRS wireless communication module, adopt RS232 interface to communicate, power transfer module is for being converted to ARM controller module and required 5V and the 3.3V voltage of wireless communication module by 9~30V direct voltage of input.
In the present invention, usining the cell-phone number of equipment end unit as the outstanding feature of distinguishing distinct device end unit, is the basis of setting up wireless data transmission; The cell-phone number of equipment end unit is stored in server unit with the form of list, and equipment end unit does not need any information of storage server unit; Equipment end unit can not be subject to the restriction in server unit IP address and geographical position when communicating by letter with server unit, while there is a plurality of server unit in system, can not carry out Wireless Data Transmission from different server units respectively in the same time.
Radio data transmission method of the present invention mainly comprises following step:
Step 1, the communication channel between apparatus for establishing end unit and server unit;
Fig. 2 is the communication channel process of establishing flow chart of radio data transmission method.All the setting of wireless communication module and the standard A T instruction of reading all by CDMA/GPRS are realized.
Before communication channel is set up, server unit and equipment end unit are all in resting state; Setting up of described communication channel is further comprising the steps:
Step 1.1, after server unit is received the order connecting that server computer sends, to its inner CDMA or GPRS wireless communication module Sending dialled number link order (AT+ZPPPOPEN), carry out dial-up connection, the PPP of foundation and CDMA or GPRS wireless public network (Peer to Peer Protocol, end-to-end protocol) connects;
Step 1.2, then server unit sends and obtains address instruction (AT+ZIPGETIP) and obtain its IP address in public network to its inner CDMA or GPRS wireless communication module;
Step 1.3, server unit sends and sets up TCP server instruction (AT+ZIPSERVER) and set up TCP server to its inner CDMA or GPRS wireless communication module, and opens a certain network port and enter the state of intercepting, and waiting facilities end unit connects;
Step 1.4, information (the ServerIPAddr:xxx.xxx.xxx.xxx that server unit structure comprises its public network IP address, Port:xxxx), and to its inner CDMA or GPRS wireless communication module send SMS message and send instruction (AT+CMGS) this information is sent on the Mobile phone card number that equipment end unit comprised in the mode of short message;
Step 1.5, equipment end unit receives after the short message that comprises server unit public network IP address, parsed, and carry out dial-up connection to its inner CDMA or GPRS wireless communication module Sending dialled number link order (AT+ZPPPOPEN), foundation is connected with the PPP of CDMA or GPRS wireless public network;
Step 1.6, equipment end unit is set up TCP client instruction (AT+ZIPSETUP) and is set up TCP client by sending to its inner CDMA or GPRS wireless communication module, and the TCP server that is in the state of intercepting set up of connection server unit;
Step 1.7, after establishing TCP between equipment end unit and server unit and being connected, to all can receive that TCP communication channel is successfully established instruction (ZTCPESTABLISHED) from CDMA or GPRS wireless communication module separately, represent that now the TCP communication channel between equipment end unit and server unit is successfully established, next just can adopt the mode of Socket communication to carry out data double-way and transmit.
Step 2, server unit and equipment end unit carry out the transmitted in both directions of data in the communication channel establishing with Socket communication mode.
Fig. 3 is the flow chart that radio data transmission method data transmission procedure is controlled.
As shown in Figure 3, after establishing communication channel, server unit adopts following communication process:
A1. server unit starts heartbeat timer, turns B1;
B1. detect heartbeat timer and whether arrive set point, if arrived, turn C1, otherwise turn D1;
C1. to equipment end unit, by TCP communication channel, send heartbeat message data, restart heartbeat timer, turn D1;
D1. the data that the server computer that server unit detection is attached thereto sends, have data need to send to equipment end unit if detected, and by TCP communication channel, to equipment end unit, send the data that server computer sends over, and turn E1;
E1. detect TCP communication channel and whether receive data, if the data of receiving, by the data retransmission receiving to server computer, turn F1, if the data of not receiving continue to wait for;
F1. detect the state that TCP connects, if TCP connects, keep normal, turn G1, otherwise turn H1;
Whether the server computer that G1. server unit detection is attached thereto sends is closed bind command, if it is turns H1, otherwise turns B1;
H1. close TCP and connect, close PPP and connect, finish wireless data transmission.
Equipment end unit adopts following communication process:
A2. equipment end unit starting communication overtime timer, turns B2;
B2. judge whether overtime timer arrives set point, if arrived, turn H2, otherwise turn C2;
C2. detect TCP communication channel and whether receive data, if the data of receiving, by overtime timer zero clearing, turn D2, otherwise turn F2;
Whether the data that D2. judgement receives are heartbeat message data, if it is turn F2, otherwise turn E2;
E2. by the data retransmission of receiving, give the device controller being connected with equipment end unit, turn F2;
F2. whether checkout equipment controller sends data to equipment end unit, if had, data are sent to server unit by TCP communication channel, and by overtime timer zero clearing, turn G2, if without, continue to wait for;
G2. detect the state that TCP connects, if connected, keep normal, turn B2, otherwise turn H2;
H2. close TCP and connect, close PPP and connect, finish wireless data transmission.
Fig. 4 is that the hardware of a kind of embodiment of wireless data transmission device connects block diagram.This wireless data transmission device comprise arm processor, CDMA/GPRS wireless communication module, with described CDMA or the corresponding UIM of GPRS wireless communication module or SIM Mobile phone card and communication antenna and power transfer module.
Described UIM or SIM Mobile phone card connect as described CDMA or GPRS wireless communication module the subscriber identification card that enters described CDMA or GPRS wireless public network;
It is core that this wireless data transmission device be take arm processor (adopting the LPC2129 chip of NXP company in this embodiment), and operational communications control program on arm processor, for realizing the whole Control on Communication flow process of aforesaid equipment end unit.Specifically, described arm processor is used for from described CDMA or GPRS wireless communication module reading out data, receive and short message that resolution server end sends, also for sending instruction to described CDMA or GPRS wireless communication module to set up and being connected or carrying out transfer of data of being connected of described CDMA or GPRS wireless public network, foundation and described server end;
The instruction for sending according to described arm processor of described CDMA or GPRS wireless communication module, being connected or carrying out transfer of data of being connected of foundation and CDMA or GPRS wireless public network, foundation and described server end;
In arm processor periphery, provide clock circuit, reset circuit and DLL (dynamic link library), form arm processor minimum system.On this basis, utilize the UART of arm processor self to expand two RS232 interface modules, one of them RS232 interface module is for communicating by letter with host computer (being server computer or device controller), and another RS232 interface module is communicated by letter with CDMA/GPRS wireless communication module.
CDMA/GPRS wireless communication module adopts the communication module (adopting the MC8331A module of ZTE company in this embodiment) of mobile phone dedicated manufacturer, and for this module is equipped with corresponding UIM or SIM Mobile phone card, and communication antenna.
This device also comprises the power transfer module being connected with arm processor, and 9~30V direct voltage of input is converted to arm processor and required 5V and the 3.3V voltage of wireless communication module.
Whether the operation principle of the wireless data transmission device shown in Fig. 4 is: after input power powers on, arm processor starts normal operation, first to wireless communication module, sends AT order, working properly in order to detect wireless communication module; Then to wireless communication module, send AT+CSQ order, in order to Sampling network signal strength signal intensity, whether within can guaranteeing the scope of proper communication, whether the while also detects Mobile phone card and has been linked in this device.After this arm processor constantly scans the communication data of two RS232 interfaces, receives the order from device controller or server computer, and correspondingly according to the flow process of Fig. 1 and Fig. 2, connects and carry out Wireless Data Transmission.
The present invention adopts the radio data transmission method based on CDMA/GPRS wireless public network, the pattern that adopts short message and get online without being tethered to a cable and combine, solved the limited problem of fixed ip address of server end, make server unit can be applied in neatly in the building process of system, be not subject to the restriction of region and Internet network condition, greatly facilitate the application of small distributed wireless monitor monitoring system.
Above-described specific embodiment; object of the present invention, technical scheme and beneficial effect are further described; institute is understood that; the foregoing is only specific embodiments of the invention; be not limited to the present invention; within the spirit and principles in the present invention all, any modification of making, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.