Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below by way of specific embodiment also by reference to the accompanying drawings, the present invention is described in detail.
In the present invention, Intranet equipment refers to need access outer net thus the various equipment obtained in the private network (Intranet) of the geographical location information of request, as personal computer, server, network management workstation etc., Intranet equipment at least includes a serial ports, intranet and extranet communicator is an Embedded network equipment, for access network, have that price is low, good stability, non-maintaining advantage.
Connected by serial ports (RS232 or RS422 or RS485) line between intranet and extranet communicator and Intranet equipment, and use request-response type communication protocol to carry out information interaction, network configuration as shown in Figure 3, Intranet equipment is sent to intranet and extranet communicator by needing the request obtaining geographical location information from outer net, intranet and extranet communicator is directly connected with outer net by Ethernet interface, receive the response message of outer net by communication request described in the process of intranet and extranet communicator, Intranet equipment obtains described response message by serial ports.
Request-response type communication protocol interactive information is used between Intranet equipment and intranet and extranet communicator, the equipment room of described use request-response type communication protocol alternately as shown in Figure 4, all communication is all initiated by Intranet equipment, intranet and extranet communicator processes request message after receiving the request of Intranet equipment transmission, then responds the request of Intranet equipment.
Because serial ports is exclusive equipment, and according to request-response type communication protocol, only have Intranet equipment could initiate to obtain the communication request of geographical location information, intranet and extranet communicator can only responding communication request, so ensure that intranet and extranet communicator cannot initiatively conduct interviews to Intranet equipment, while obtaining geographical location information, the communication security of intranet and extranet is also ensure that to outer net request realizing Intranet equipment by intranet and extranet communicator.
Described serial ports can be: any one in RS232, RS422 and RS485.According to the difference of transmission range, different serial ports can be selected, if select RS232, the distance within 15 meters can be transmitted, if select RS422 or RS485, the distance of about 1200 meters can be transmitted.
Because the transmission range of different its Serial Port Lines of serial ports has difference, in general device, the serial ports of default design is RS232, farther distance is transmitted if want, at this moment need to utilize serial converter RS232 to be converted to the level nature of RS422 or RS485, thus the effect of extending transmission distance can be reached.
The apparatus structure of the embodiment of the present invention as shown in Figure 1, a kind of intranet and extranet communicator, this device is connected with Intranet equipment by Serial Port Line, is connected with outer net by Ethernet interface, and described device comprises:
Serial ports Transmit-Receive Unit, for receiving the Geoposition Request message of Intranet equipment, and for the geographical position response message after message process unit process is sent to Intranet equipment;
Message process unit, for the required parameter encapsulation HTTP request message in the Geoposition Request message that receives according to serial ports Transmit-Receive Unit, and encapsulate geographical position response message for the response contents in the http response message that receives according to Ethernet interface Transmit-Receive Unit;
Ethernet interface Transmit-Receive Unit, provides equipment for the HTTP request message after message process unit process is sent to the corresponding location-based service of outer net, and for receiving the http response message that outer net location-based service provides equipment to send.
As preferred embodiment, the required parameter in described Geoposition Request message mainly comprises operator's base station information.
For base station that is mobile or UNICOM, described base station information mainly comprises base station cell numbering CID, base station location code LAC; For the base station of telecommunications, described base station information mainly comprises base station IDs, system identifier and network ID.
As preferred embodiment, the response contents in the response message of described geographical position comprises: location based service provider information, geographical location information feedback result.
As preferred embodiment, the form of described Geoposition Request message includes initial, type of message, message numbering, solicited message length, verification, requested content and trailer field, the format and content of described request information content field and type of message one_to_one corresponding and preset, the content of initial, message numbering and trailer field can customize.
The form of described geographical position response message includes initial, type of message, message numbering, response message length, verification, response message content and trailer field; Wherein, response message content generates according to described http response message, the format and content one_to_one corresponding of type of message and response message content field and presetting;
Described geographical position response message with in corresponding Geoposition Request message initial, terminate, message numbering field contents is identical.
Described geographical position response message and request message form schematic diagram are as Fig. 5, and each field meanings is as follows:
Starting and ending: for representing beginning and the end of a message; Such as, value 0x7E can be;
Type of message: the format and content determining request and response message, scope is 0 ~ 255;
Message numbering: for mating geographical location request message and response message; Message numbering is a numeral increased progressively by Intranet equipment, each message numbering is unique, intranet and extranet communicator uses the message numbering of described Geoposition Request message when responding the Geoposition Request message of Intranet equipment, be used for mating the geographical position response message corresponding with described Geoposition Request message, identical message numbering expression a pair message, namely each Geoposition Request message has the message of geographical position response one to one; Span is 0 ~ 65535;
Message length: the length of Geoposition Request information or response message; Span 0 ~ 1024;
Verification: to the verification of type of message, message numbering, message length and information field, various method of calibration can be adopted; Such as, CRC check can be used;
The information content: concrete Geoposition Request information or geographical position response message content, can determine different contents and form according to different application, with type of message one_to_one corresponding.
Wherein, form, the content one_to_one corresponding of type of message and the information content (comprising Geoposition Request information and geographical position response message content) field, this is pre-set.
Such as, when type of message is 0, represent UNICOM's base station position information query messages, the format and content of corresponding Geoposition Request information content field is as shown in table 1:
CID |
Separator |
LAC |
Separator |
Signal strength signal intensity |
|
: |
|
: |
|
Table 1
Wherein, CID represents the cell number of UNICOM base station;
LAC represents the position code of UNICOM base station;
The signal strength signal intensity of signal strength expression UNICOM base station.
Such as, when type of message is 1, represent UNICOM's position enquiring response message, the format and content of corresponding geographical position response message content field is as shown in table 2:
Table 2
Wherein, feedback states represents whether successful to location based service provider requesting query, if feedback states is 0, represent successful inquiring, at this moment, the content of geographical location information feedback result is the correct Query Result of outer net location based service provider; If feedback states is 1, represent and inquire about unsuccessfully, the content of geographical location information feedback result is error code;
Different location based service providers can by different coded representation, such as: 0 represents google; 1 represents lbs; 2 represent ant.
Length and the content of described geographical position response message and initial, the trailer field in corresponding Geoposition Request message all can be self-defined, but for the ease of routine processes, generally the content of starting and ending field is set to identical, and do not select the character identical with Geoposition Request information or geographical position response message content, such as, the value of starting and ending field can be set to 0x7E.
May occur initial and end mark 0x7E in Geoposition Request information or geographical position response message content, such as, so need to carry out escape to it, when sending data, if content is 0x7E, be then 0x7D0x5E by its escape; If content is 0x7D0x5E, then escape is 0x7D0x5D0x5E;
Correspondingly, when receiving data, if receive 0x7D0x5E, being then 0x7E by its escape, if receive 0x7D0x5D0x5E, is then 0x7D0x5E by its escape.
Existing intranet and extranet communicator generally adopts expensive server, and cost is higher and implement more complicated, and comparatively speaking, the intranet and extranet communicator in the present invention has the low and advantages such as good stability of cost is low, structure simple, implement complexity.
As shown in Figure 2, a kind of geographical position information acquisition method, comprises the following steps the method flow of the embodiment of the present invention:
Step 201: Intranet equipment is connected with intranet and extranet communicator by Serial Port Line, the Ethernet interface of described intranet and extranet communicator is connected with outer net;
Step 202: described Intranet equipment sends Geoposition Request message to described intranet and extranet communicator, described HTTP request message, according to the required parameter encapsulation HTTP request message in described Geoposition Request message, is sent to the corresponding location-based service of outer net and provides equipment by described intranet and extranet communicator;
Step 202: described intranet and extranet communicator receives after location-based service provides the http response message of equipment from outer net, according to the response contents encapsulation geographical position response message in http response message, and described geographical position response message is sent to Intranet equipment.
Preferably, the required parameter in described Geoposition Request message comprises operator's base station information.
Preferably, for base station that is mobile or UNICOM, described base station information mainly comprises base station cell numbering CID, base station location code LAC; For the base station of telecommunications, described base station information mainly comprises base station IDs, system identifier and network ID.
Preferably, the response contents in the response message of described geographical position comprises: location based service provider information, geographical location information feedback result.
Preferably, the form of described Geoposition Request message includes initial, type of message, message numbering, solicited message length, verification, requested content and trailer field, the format and content of described request information content field and type of message one_to_one corresponding and preset, the content of initial, message numbering and trailer field can customize.
The form of described geographical position response message includes initial, type of message, message numbering, response message length, verification, response message content and trailer field; Wherein, response message content generates according to described http response message, the format and content one_to_one corresponding of type of message and response message content field and presetting;
Described geographical position response message with in corresponding Geoposition Request message initial, terminate, message numbering field contents is identical.
Now be exemplified below:
If Intranet equipment needs the geographical position inquiry service utilized in public network, illustrate for geographical position inquiry service that is mobile and telecomm base station here:
First, the inside outbound communication device of Intranet equipment sends Geoposition Request message, intranet and extranet communicator passes through serial ports RS232 (to ask transmission range farther, RS422 or RS485 can be adopted), receive the geographical position inquiry request message from Intranet equipment, different type of messages, the format and content of information content fields different in corresponding message;
As being 2 when type of message, when representing telecomm base station position enquiring message, the form of Geoposition Request message is as shown in table 3:
Table 3
Wherein, Bsid represents the base station IDs of telecomm base station;
Sid represents the system identifier of telecomm base station;
Nid represents the network ID of telecomm base station;
The signal strength signal intensity of signal strength expression telecomm base station.
Described HTTP request message, according to the required parameter encapsulation HTTP request message in described Geoposition Request message, is sent to the corresponding location-based service of outer net and provides equipment by intranet and extranet communicator;
Such as, as the Geoposition Request message of table 3, required parameter is extracted from described Geoposition Request message, i.e. Bsid, Sid and Nid, and according to the HTTP interface requirement encapsulation HTTP request message of location based service provider as google, described HTTP request message comprises Bsid, Sid and Nid parameter;
Intranet and extranet communicator passes through Ethernet interface, above-mentioned HTTP request message is sent to google location server, when receiving the http response message from google location server, obtain the response contents in described http response message, comprise location based service provider information and geographical location information feedback result;
Again described response contents is encapsulated as geographical position response message, its form is as shown in table 4, similarly, the format and content of information content field and type of message one_to_one corresponding in the response message of geographical position, herein, as type of message be 3 time, represent telecomm base station position enquiring response message:
Table 4
When type of message is 4, when representing mobile base station position enquiring message, the form of Geoposition Request message is as shown in table 5:
Table 5
Wherein, CID represents the cell number of mobile base station;
LAC represents the position code of mobile base station;
The signal strength signal intensity of signal strength expression mobile base station.
Similarly, the geographical position response message form corresponding with the Geoposition Request message of table 5 is as shown in table 6, if type of message is 5, represents mobile base station position enquiring response message:
Table 6
Wherein, when feedback states is 0, represent that Query Result is correct, now, geographical location information feedback result by google provide the tram information of request base station; When feedback states is 1, represent and inquire about unsuccessfully, now, service feedback result is the error code that google location server returns.
Intranet and extranet communicator is according to the response contents in the http response message of location based service provider, i.e. position service provider information and geographical location information feedback result, be packaged into geographical position response message, such as shown in table 4 and table 6, all geographical position response messages are sent to Intranet equipment by serial ports.
The present invention program effectively can solve Intranet equipment and obtain the problem of geographical location information by intranet and extranet communicator directly to outer net request, simultaneously, also the secure communication problem that intranet and extranet need isolation is solved, even if intranet and extranet communicator is broken also cannot cause any threat to Intranet, can be widely used in, in the higher network of the fail safes such as bank, government, army, there is market application foreground widely.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, within the spirit and principles in the present invention all, any amendment made, equivalent replacement, improvement etc., all should be included within the scope of protection of the invention.