Summary of the invention
Main purpose of the present invention is, at above-mentioned deficiency of the prior art, the means of communication of a kind of GPS locating terminal and background server are provided, this method can regularly be confirmed GPS locating terminal and background server connection status, guarantee that GPS locating terminal and background server connection status are normal, simultaneously, can reduce the burden of background server.
The present invention solves the technical scheme that the prior art problem adopts: the means of communication of a kind of GPS locating terminal and background server, and it may further comprise the steps:
S1, GPS locating terminal and background server connect;
S2, GPS locating terminal regularly transmit locator data bag and state bag to described background server;
S3, background server respond described state bag, send the answer bag corresponding with described state bag to described GPS locating terminal;
Whether S4, GPS locating terminal basis receive described answer bag is judged that current connection status is normal or disconnection;
If, then be judged as the GPS locating terminal and be connected with background server normally, continue to transmit the locator data bag;
Otherwise, then being judged as the GPS locating terminal and being connected disconnection with background server, the New Development of laying equal stress on is referred to and is asked information to described background server, and request reconnects.
Below technique scheme is further set forth:
Further, among the described step S4, when GPS locating terminal and described background server are connected disconnection times and reach set point number, module is restarted in the timing that the GPS locating terminal starts its inside automatically, in setting-up time, also do not rebulid with described background server and be connected, send solicited message again to background server after then the GPS locating terminal restarts, request reconnects.
Further, among the described step S4, when GPS locating terminal and background server disconnect, the GPS locating terminal with current locator data bag buffer memory to its internal storage, and after described GPS locating terminal and background server reconnect, this locator data bag is reissued to background server.
Further, described state bag and locator data Bao Jun comprise corresponding GPS locating terminal ID, and described background server is judged the GPS locating terminal position that sends described locator data bag and state bag by described GPS locating terminal ID.
The means of communication of a kind of GPS locating terminal and background server, it may further comprise the steps:
S1, GPS locating terminal and background server connect;
S2, GPS locating terminal send the logon information bag to described background server;
S3, background server respond described logon information bag, send the answer bag A corresponding with described logon information bag to described GPS locating terminal;
Whether S4, GPS locating terminal basis receive described answer bag A is judged that current connection status is for normal or unusual;
If, then be judged as the GPS locating terminal and be connected with background server normally, continue step S5-S7;
Otherwise, then being judged as the GPS locating terminal and being connected unusually with background server, the New Development of laying equal stress on is referred to and is asked information to described background server, and request reconnects;
S5, GPS locating terminal regularly transmit locator data bag and state bag to described background server;
S6, background server respond described state bag, send the answer bag B corresponding with described state bag to described GPS locating terminal;
Whether S7, GPS locating terminal basis receive described answer bag B is judged that current connection status is normal or disconnection;
If, then be judged as the GPS locating terminal and be connected with background server normally, continue to transmit the locator data bag;
Otherwise, then being judged as the GPS locating terminal and being connected disconnection with background server, the New Development of laying equal stress on is referred to and is asked information to described background server, and request reconnects.
Further, among the described step S4, after described GPS locating terminal is connected unusual number of times with described background server and reaches set point number, module is restarted in the timing that the GPS locating terminal starts its inside automatically, in setting-up time, also do not rebulid with described background server and be connected, send solicited message again to background server after then the GPS locating terminal restarts, request reconnects.
Further, among the described step S7, after described GPS locating terminal is connected disconnection times with background server and reaches set point number, module is restarted in the timing that the GPS locating terminal starts its inside automatically, in setting-up time, also do not rebulid with described background server and be connected, send solicited message again to background server after then the GPS locating terminal restarts, request reconnects.
Further, when GPS locating terminal internal alarm module triggered, described step S5 also comprised: the GPS locating terminal sends the bag of reporting to the police to described background server.
Further, described logon information bag comprises corresponding GPS locating terminal ID, and described background server is judged the GPS locating terminal position that sends described locator data bag and state bag by described GPS locating terminal ID.
Further, described GPS locating terminal and background server disconnect or when unusual, the GPS locating terminal to its internal storage, and after described GPS locating terminal and background server reconnect, is reissued current locator data bag buffer memory to background server with this locator data bag.
The invention has the beneficial effects as follows: the means of communication of GPS locating terminal provided by the invention and server; because GPS locating terminal timed sending state bag is to background server; reply the state (whether receive and reply bag) of bag by the background server feedback and judge that GPS locating terminal and the current connection status of background server are normally or disconnect; if be in off-state; then the GPS locating terminal sends solicited message again and reconnects; so; can guarantee that GPS locating terminal and background server keep good connection status; so that communication between the two; in addition; because being sent to the locator data bag of background server, the GPS locating terminal do not need background server to make answer; therefore; can reduce the burden of background server significantly; guarantee the works fine state of background server, be applicable to that continuous transmission time interval is short; background server connects the many systems of load.
Embodiment
Describe technical scheme of the present invention in detail below with reference to drawings and the specific embodiments, so as clearer, understand invention essence of the present invention intuitively.
Embodiment one
With reference to shown in Figure 1, present embodiment provides the means of communication of a kind of GPS locating terminal and background server, and it may further comprise the steps:
S1, GPS locating terminal and background server connect; Concrete, the GPS locating terminal starts initialization, send solicited message to described background server, request connects, after background server receives solicited message, response described request information sends the return information corresponding with described request information, and the GPS locating terminal is set up the GPRS connection in described background server after receiving described return information.
S2, GPS locating terminal regularly transmit locator data bag and state bag to described background server; In this step, after confirming GPS locating terminal and background server successful connection, the GPS locating terminal just begins to transmit the locator data bag, just begins to send the state bag after the certain hour, for example namely begin to send the locator data bag after the successful connection, begin the compartment of terrain after 3 minutes again and send the state bag.
S3, background server respond described state bag, send the answer bag corresponding with described state bag to described GPS locating terminal; In this step, background server is not replied the locator data bag that receives, and the state bag that only the GPS locating terminal is sent is replied, the state bag is used for the connection status between affirmation GPS locating terminal and the described background server, and generally be connected under the normal condition with background server at the GPS locating terminal, background server then can be received the locator data bag that the GPS locating terminal transmits, and therefore, can reply the locator data bag simultaneously.
Whether S4, GPS locating terminal basis receive described answer bag is judged that current connection status is normal or disconnection; If, then be judged as the GPS locating terminal and be connected with background server normally, continue to transmit the locator data bag; Otherwise, then being judged as the GPS locating terminal and being connected disconnection with background server, the New Development of laying equal stress on is referred to and is asked information to described background server, and request reconnects, and reconnects back and background server normal communication, timed sending locator data bag and state bag.
Concrete, in this step, when GPS locating terminal and described background server are connected disconnection times and reach set point number, then module is restarted in the timing that starts its inside automatically of GPS locating terminal, in setting-up time, also do not rebulid with described background server and be connected, the GPS locating terminal is not received the answer bag that background server returns always in setting-up time, send solicited message again to background server after then the GPS locating terminal restarts, and request reconnects; For example, reconnecting 3 times does not still connect, regularly restarting module setting reboot time is 10 minutes, if GPS locating terminal and background server successfully connect and receive the answer bag of background server response then regularly restart module and close in 10 minutes, the GPS locating terminal is not restarted, otherwise the GPS locating terminal is restarted automatically after 10 minutes.
In addition, when GPS locating terminal and background server disconnected, the GPS locating terminal to its internal storage, and after described GPS locating terminal and background server reconnect, was reissued current locator data bag buffer memory to background server with this locator data bag.
In the present embodiment, described state bag and locator data Bao Jun comprise corresponding GPS locating terminal ID, and described background server judges by described GPS locating terminal ID described locator data bag and state bag are by which GPS locating terminal to be sent, and determine its position.
Because GPS locating terminal timed sending state bag is to background server; reply the state (whether receive and reply bag) of bag by the background server feedback and judge that GPS locating terminal and the current connection status of background server are normally or disconnect; if be in off-state; then the GPS locating terminal sends solicited message again and reconnects; so; can guarantee that GPS locating terminal and background server keep good connection status; so that communication between the two; in addition; because being sent to the locator data bag of background server, the GPS locating terminal do not need background server to make answer; therefore; can reduce the burden of background server significantly; guarantee the works fine state of background server, be applicable to that continuous transmission time interval is short; background server connects the many systems of load.
Embodiment two
With reference to shown in Figure 2, present embodiment provides the means of communication of a kind of GPS locating terminal and background server, and it may further comprise the steps:
S1, GPS locating terminal and background server connect; Concrete, the GPS locating terminal starts initialization, send solicited message to described background server, request connects, after background server receives solicited message, response described request information sends the return information corresponding with described request information, and the GPS locating terminal is set up the GPRS connection in described background server after receiving described return information.
S2, GPS locating terminal send the logon information bag to described background server; This logon information can send article one logon information bag after wrapping in described GPS locating terminal and background server successful connection.
S3, background server respond described logon information bag, send the answer bag A corresponding with described logon information bag to described GPS locating terminal, and this logon information bag is used for the connection status between affirmation GPS locating terminal and the background server.
Whether S4, GPS locating terminal basis receive described answer bag A is judged that current connection status is for normal or unusual; If, then be judged as the GPS locating terminal and be connected with background server normally, continue step S5-S7; Otherwise, then being judged as the GPS locating terminal is connected with background server unusually, the New Development of laying equal stress on is referred to and is asked information to described background server, request reconnects, for example, do not reply bag A if after the GPS locating terminal sends logon information bag 5S, receive the correspondence that background server sends, the output transmission speed that background server and GPS locating terminal then are described is undesired, be judged as and connect unusually, if the GPS locating terminal is received the correspondence that background server sends and is replied bag A in 5S, illustrate that then background server is connected normally with the GPS locating terminal, can carry out the transmission of follow-up locator data bag and state bag.
In this step, after described GPS locating terminal is connected unusual number of times with described background server and reaches set point number, module is restarted in the timing that the GPS locating terminal starts its inside automatically, in setting-up time, also do not rebulid with described background server and be connected, send solicited message again to background server after then the GPS locating terminal restarts, request reconnects.For example, reconnect 3 failures after unusual, then start timing and restart module, after 20 minutes still not with the background server successful connection, then the GPS locating terminal is restarted automatically, after restarting, resend solicited message to background server, request connects with background server; With the background server successful connection, then regularly restarted module and close after 20 minutes, the GPS locating terminal continues to transmit the locator data bag to background server.
S5, GPS locating terminal regularly transmit locator data bag and state bag to described background server, in this step, the transmission of locator data bag and state bag is to be connected with background server to finish at the GPS locating terminal just to send after normal, for example, receive the correspondence answer bag A that background server sends in the GPS locating terminal 5S, illustrate that background server is connected normally with the GPS locating terminal, just transmit the locator data bag to background server, timed sending state bag is to background server after 3 minutes thereupon.
S6, background server responds described state bag, send the answer bag B corresponding with described state bag to described GPS locating terminal, in this step, background server is not replied the locator data bag that receives, and the state bag that only the GPS locating terminal is sent is replied, equally, described state bag is used for judging at data transfer procedure, whether keep normal connection status between GPS locating terminal and the background server, and generally be connected under the normal condition with background server at the GPS locating terminal, background server then can be received the locator data bag that the GPS locating terminal transmits, and therefore, can reply the locator data bag simultaneously.
Whether S7, GPS locating terminal basis receive described answer bag B is judged that current connection status is normal or disconnection; If, then be judged as the GPS locating terminal and be connected with background server normally, continue to transmit the locator data bag; Otherwise, then being judged as the GPS locating terminal and being connected disconnection with background server, the New Development of laying equal stress on is referred to and is asked information to described background server, and request reconnects, and reconnects back and background server normal communication, timed sending locator data bag and state bag.
Concrete, in this step, when GPS locating terminal and described background server are connected disconnection times and reach set point number, then module is restarted in the timing that starts its inside automatically of GPS locating terminal, in setting-up time, also do not rebulid with described background server and be connected, the GPS locating terminal is not received the answer bag B that background server returns always in setting-up time, send solicited message again to background server after then the GPS locating terminal restarts, and request reconnects; For example, the GPS locating terminal was not received the answer bag B of state bag correspondence in continuous 5 minutes, illustrate that then GPS locating terminal and described background server malunion are normal, the GPS locating terminal sends solicited message immediately to background server, request reconnects, reconnecting 3 times does not still connect, regularly restarting module setting reboot time is 20 minutes, if GPS locating terminal and background server successfully connect and receive the answer bag B of background server response then regularly restart module and close in 20 minutes, the GPS locating terminal is not restarted, otherwise the GPS locating terminal is restarted automatically after 20 minutes.
In addition, described GPS locating terminal and background server disconnect or when unusual, the GPS locating terminal to its internal storage, and after described GPS locating terminal and background server reconnect, is reissued current locator data bag buffer memory to background server with this locator data bag.
Further, be provided with alarm module in the GPS locating terminal, when GPS locating terminal internal alarm module triggers, be connected under the normal condition with background server at the GPS locating terminal, the GPS locating terminal sends the bag of reporting to the police to described background server, background server can be known the warning message that corresponding GPS locating terminal occurs after receiving the bag of reporting to the police, and realizes reporting to the police.
In the present embodiment, described logon information bag comprises corresponding GPS locating terminal ID, and described background server is judged the GPS locating terminal position that sends described locator data bag and state bag by described GPS locating terminal ID.
Adopt said method; at first; because the GPS locating terminal sends the logon information bag to background server; whether normally confirm to be connected between GPS locating terminal and the background server by the logon information bag; so; can guarantee to set up between GPS locating terminal and the background server and be connected normally; namely avoid occurring connecting the transmission of problems affect locator data bag such as unusual etc.; secondly; GPS locating terminal timed sending state bag is to background server; reply the state (whether receive and reply bag) of bag by the background server feedback and judge that GPS locating terminal and the current connection status of background server are normally or disconnect; if be in off-state; then the GPS locating terminal sends the state bag again and reconnects; so; can guarantee that GPS locating terminal and background server keep good connection status; so that communication between the two; again; because being sent to the locator data bag of background server, the GPS locating terminal do not need background server to make answer; therefore; can reduce the burden of background server significantly; guarantee the works fine state of background server, be applicable to that continuous transmission time interval is short; background server connects the many systems of load.
The above only is the preferred embodiments of the present invention; be not so limit its claim; every equivalent structure or equivalent flow process conversion that utilizes specification of the present invention and accompanying drawing content to do; directly or indirectly be used in other relevant technical fields, all in like manner be included in the scope of patent protection of the present invention.