The means of communication of a kind of GPS locating terminal and background server
Technical field
The present invention relates to mobile communication technology field, particularly the means of communication of a kind of GPS locating terminal and server.
Background technology
Along with the development of science and technology, Internet-related communicating terminal application is more and more extensive, current mobile terminal product generally needs to connect with background server, to realize the data timing of mobile terminal and background service to hand over mutually, communication mainly by GPRS between general mobile terminal and corresponding background server, such as between locating terminal with background server by after setting up GPRS and being connected, locator data bag etc. could be sent to background server by locating terminal, and locating terminal is generally arranged on and needs to be located and on the equipment monitored (such as automobile etc.), so, realize carrying out monitoring location etc. to locating terminal place equipment by background server, its concrete means of communication are: locating terminal first asks solicited message to connect to described background server request by transmission, background server responds after receiving solicited message, send a reply bag to locating terminal, realize GPRS to connect, the transmission of locator data bag is carried out after successful connection, often upload a packet, background server all must once be replied, to confirm that packet receives, this communication modes, be suitable for the situation that the less load of background server connection device is less and data transmission time interval is longer, if the equipment for background server connection sees many or data transmission frequency is high, and the packet etc. that each equipment sends is replied one by one, then background server burden is heavier, easily cause very background server fault, also higher to the requirement of background server, in addition, in communication process, if locating terminal and background server disconnect because of other faults, then cause data transmission fails, background server cannot carry out communication with locating terminal, can not realize monitoring locating terminal place equipment and locating.
Summary of the invention
Main purpose of the present invention is, for above-mentioned deficiency of the prior art, the means of communication of a kind of GPS locating terminal and background server are provided, the method regularly can confirm GPS locating terminal and background server connection status, ensure GPS locating terminal and background server connection status normal, meanwhile, the burden of background server can be reduced.
The present invention solves the technical scheme that prior art problem adopts: the means of communication of a kind of GPS locating terminal and background server, and it comprises the following steps:
S1, GPS locating terminal and background server connect;
S2, GPS locating terminal transmits locator data bag and state bag to described background server timing;
S3, background server respond described state bag, send the reply bag corresponding with described state bag to described GPS locating terminal;
According to whether receiving described reply bag, S4, GPS locating terminal judges that current connection state is for normally or disconnection;
If so, be then judged as that GPS locating terminal is connected with background server normally, continue to transmit locator data bag;
Otherwise be then judged as that GPS locating terminal is connected with background server and disconnect, and transmission request information is to described background server again, request reconnects.
Below technique scheme is set forth further:
Further, in described step S4, GPS locating terminal is connected disconnection times when reaching set point number with described background server, module is restarted in the timing that GPS locating terminal starts its inside automatically, also do not re-establish with described background server in setting-up time and be connected, then after restarting, transmission request information is to background server again for GPS locating terminal, and request reconnects.
Further, in described step S4, when GPS locating terminal and background server disconnect, GPS locating terminal by current position determination data bag buffer memory in 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 judges by described GPS locating terminal ID the GPS locating terminal position sending described locator data bag and state bag.
Means of communication for GPS locating terminal and background server, it comprises the following steps:
S1, GPS locating terminal and background server connect;
S2, GPS locating terminal sends logon information bag to described background server;
S3, background server respond described logon information bag, send the reply bag A corresponding with described logon information bag to described GPS locating terminal;
According to whether receiving described reply bag A, S4, GPS locating terminal judges that current connection state is for normally or exception;
If so, be then judged as that GPS locating terminal is connected with background server normally, continue step S5-S7;
Otherwise be then judged as that GPS locating terminal is connected with background server abnormal, and transmission request information is to described background server again, request reconnects;
S5, GPS locating terminal transmits locator data bag and state bag to described background server timing;
S6, background server respond described state bag, send the reply bag B corresponding with described state bag to described GPS locating terminal;
According to whether receiving described reply bag B, S7, GPS locating terminal judges that current connection state is for normally or disconnection;
If so, be then judged as that GPS locating terminal is connected with background server normally, continue to transmit locator data bag;
Otherwise be then judged as that GPS locating terminal is connected with background server and disconnect, and transmission request information is to described background server again, request reconnects.
Further, in described step S4, when described GPS locating terminal to be connected after frequency of abnormity reaches set point number with described background server, module is restarted in the timing that GPS locating terminal starts its inside automatically, also do not re-establish with described background server in setting-up time and be connected, then after restarting, transmission request information is to background server again for GPS locating terminal, and request reconnects.
Further, in described step S7, when described GPS locating terminal to be connected after disconnection times reaches set point number with background server, module is restarted in the timing that GPS locating terminal starts its inside automatically, also do not re-establish with described background server in setting-up time and be connected, then after restarting, transmission request information is to background server again for GPS locating terminal, and request reconnects.
Further, when GPS locating terminal internal alarm module triggers, described step S5 also comprises: GPS locating terminal sends to described background server bag of reporting to the police.
Further, described logon information handbag is containing corresponding GPS locating terminal ID, and described background server judges by described GPS locating terminal ID the GPS locating terminal position sending described locator data bag and state bag.
Further, described GPS locating terminal and background server disconnect or abnormal time, this locator data bag in its internal storage, and after described GPS locating terminal and background server reconnect, to be reissued to background server by GPS locating terminal by current position determination data bag buffer memory.
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, the state (whether receive and reply bag) of being replied bag by background server feedback judges that GPS locating terminal and background server current connection state are normal or disconnect, if be in off-state, then GPS locating terminal again transmission request information reconnect, so, the connection status that GPS locating terminal and background server keep good can be ensured, so that communication between the two, in addition, the locator data bag being sent to background server due to GPS locating terminal does not need background server to make reply, therefore, significantly can reduce the burden of background server, ensure the good working state of background server, be applicable to continuous transmission time interval short, background server connects the many systems of load.
Accompanying drawing explanation
Fig. 1 is the flow chart of the embodiment of the present invention one;
Fig. 2 is the flow chart of the embodiment of the present invention two;
The realization of the object of the invention, functional characteristics and advantage will in conjunction with the embodiments, are described further with reference to accompanying drawing.
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 Fig. 1, present embodiments provide the means of communication of a kind of GPS locating terminal and background server, it comprises the following steps:
S1, GPS locating terminal and background server connect; Concrete, GPS locating terminal starts initialization, transmission request information is 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, sets up GPRS connect after GPS locating terminal receives described return information in described background server.
S2, GPS locating terminal transmits locator data bag and state bag to described background server timing; In this step, after confirmation GPS locating terminal and background server successful connection, GPS locating terminal just starts to transmit locator data bag, just starts to send state bag after certain hour, such as, namely start after successful connection to send locator data bag, start compartment of terrain after 3 minutes again and send state bag.
S3, background server respond described state bag, send the reply bag corresponding with described state bag to described GPS locating terminal; In this step, background server is not replied the locator data bag received, and only the state bag that GPS locating terminal sends is replied, state bag is for confirming the connection status between GPS locating terminal and described background server, and be generally connected under normal circumstances at GPS locating terminal with background server, background server then can receive the locator data bag that GPS locating terminal transmits, and therefore, can reply locator data bag simultaneously.
According to whether receiving described reply bag, S4, GPS locating terminal judges that current connection state is for normally or disconnection; If so, be then judged as that GPS locating terminal is connected with background server normally, continue to transmit locator data bag; Otherwise be then judged as that GPS locating terminal is connected with background server and disconnect, and transmission request information is to described background server again, request reconnects, and reconnects rear and background server normal communication, timed sending locator data bag and state bag.
Concrete, in this step, when GPS locating terminal to be connected with described background server disconnection times reach set point number time, module is restarted in the timing that then GPS locating terminal starts its inside automatically, also do not re-establish with described background server in setting-up time and be connected, GPS locating terminal does not receive the reply bag that background server returns in setting-up time always, then after restarting, transmission request information is to background server again for GPS locating terminal, and request reconnects; Such as, reconnect 3 times still not connect, it is 10 minutes that module setting reboot time is restarted in timing, if GPS locating terminal and background server successfully connect and receive the reply bag that background server responds in 10 minutes, timing timing is restarted module and is closed, GPS locating terminal is not restarted, otherwise GPS locating terminal autoboot after 10 minutes.
In addition, when GPS locating terminal and background server disconnect, this locator data bag in its internal storage, and after described GPS locating terminal and background server reconnect, to be reissued to background server by GPS locating terminal by current position determination data bag buffer memory.
In the present embodiment, described state bag and locator data Bao Jun comprise corresponding GPS locating terminal ID, and by described GPS locating terminal ID, described background server judges that described locator data bag and state bag by which GPS locating terminal are sent, and determine its position.
Because GPS locating terminal timed sending state bag is to background server, the state (whether receive and reply bag) of being replied bag by background server feedback judges that GPS locating terminal and background server current connection state are normal or disconnect, if be in off-state, then GPS locating terminal again transmission request information reconnect, so, the connection status that GPS locating terminal and background server keep good can be ensured, so that communication between the two, in addition, the locator data bag being sent to background server due to GPS locating terminal does not need background server to make reply, therefore, significantly can reduce the burden of background server, ensure the good working state of background server, be applicable to continuous transmission time interval short, background server connects the many systems of load.
Embodiment two
With reference to shown in Fig. 2, present embodiments provide the means of communication of a kind of GPS locating terminal and background server, it comprises the following steps:
S1, GPS locating terminal and background server connect; Concrete, GPS locating terminal starts initialization, transmission request information is 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, sets up GPRS connect after GPS locating terminal receives described return information in described background server.
S2, GPS locating terminal sends logon information bag to described background server; This logon information can send Article 1 logon information bag after wrapping in described GPS locating terminal and background server successful connection.
S3, background server respond described logon information bag, and send the reply bag A corresponding with described logon information bag to described GPS locating terminal, this logon information bag is for confirming the connection status between GPS locating terminal and background server.
According to whether receiving described reply bag A, S4, GPS locating terminal judges that current connection state is for normally or exception, if so, be then judged as that GPS locating terminal is connected with background server normally, continue step S5-S7, otherwise, then be judged as that GPS locating terminal is connected with background server abnormal, and again transmission request information to described background server, request reconnects, such as, if do not receive the correspondence reply bag A that background server sends after GPS locating terminal sends logon information bag 5S, then illustrate that the output transmission speed of background server and GPS locating terminal is abnormal, be judged as connecting extremely, if GPS locating terminal receives the correspondence reply bag A that background server sends in 5S, then illustrate that background server is connected normally with GPS locating terminal, the transmission of follow-up locator data bag and state bag can be carried out.
In this step, when described GPS locating terminal to be connected after frequency of abnormity reaches set point number with described background server, module is restarted in the timing that GPS locating terminal starts its inside automatically, also do not re-establish with described background server in setting-up time and be connected, then after restarting, transmission request information is to background server again for GPS locating terminal, and request reconnects.Such as, extremely, reconnect 3 failures, then start timing and restart module, after 20 minutes still not with background server successful connection, then GPS locating terminal autoboot, after restarting, resend solicited message to background server, request and background server connect; After 20 minutes with background server successful connection, then module closedown is restarted in timing, and GPS locating terminal continues to transmit locator data bag to background server.
S5, GPS locating terminal transmits locator data bag and state bag to described background server timing, in this step, the transmission of locator data bag and state bag be GPS locating terminal be connected with background server normal after just send, such as, the correspondence reply bag A that background server sends is received in GPS locating terminal 5S, illustrate that background server is connected normally with GPS locating terminal, just transmission locator data bag is to background server thereupon, and after 3 minutes, timed sending state bag is to background server.
S6, background server responds described state bag, the reply bag B corresponding with described state bag is sent to described GPS locating terminal, in this step, background server is not replied the locator data bag received, and only the state bag that GPS locating terminal sends is replied, equally, described state bag is used for judging in data transfer procedure, normal connection status whether is kept between GPS locating terminal and background server, and be generally connected under normal circumstances at GPS locating terminal with background server, background server then can receive the locator data bag that GPS locating terminal transmits, therefore, can reply locator data bag simultaneously.
According to whether receiving described reply bag B, S7, GPS locating terminal judges that current connection state is for normally or disconnection; If so, be then judged as that GPS locating terminal is connected with background server normally, continue to transmit locator data bag; Otherwise be then judged as that GPS locating terminal is connected with background server and disconnect, and transmission request information is to described background server again, request reconnects, and reconnects rear and background server normal communication, timed sending locator data bag and state bag.
Concrete, in this step, when GPS locating terminal to be connected with described background server disconnection times reach set point number time, module is restarted in the timing that then GPS locating terminal starts its inside automatically, also do not re-establish with described background server in setting-up time and be connected, GPS locating terminal does not receive the reply bag B that background server returns in setting-up time always, then after restarting, transmission request information is to background server again for GPS locating terminal, and request reconnects, such as, GPS locating terminal did not receive reply bag B corresponding to state bag in continuous 5 minutes, then illustrate GPS locating terminal and described background server malunion normal, GPS locating terminal immediately transmission request information to background server, request reconnects, reconnect 3 times still not connect, it is 20 minutes that module setting reboot time is restarted in timing, if GPS locating terminal and background server successfully connect and receive the reply bag B that background server responds in 20 minutes, timing is restarted module and is closed, GPS locating terminal is not restarted, otherwise GPS locating terminal autoboot after 20 minutes.
In addition, described GPS locating terminal and background server disconnect or abnormal time, this locator data bag in its internal storage, and after described GPS locating terminal and background server reconnect, to be reissued to background server by GPS locating terminal by current position determination data bag buffer memory.
Further, alarm module is provided with in GPS locating terminal, when GPS locating terminal internal alarm module triggers, be connected under normal circumstances at GPS locating terminal with background server, GPS locating terminal sends to described background server bag of reporting to the police, background server can know the warning message that corresponding GPS locating terminal occurs after receiving bag of reporting to the police, and realizes reporting to the police.
In the present embodiment, described logon information handbag is containing corresponding GPS locating terminal ID, and described background server judges by described GPS locating terminal ID the GPS locating terminal position sending described locator data bag and state bag.
Adopt said method, first, because GPS locating terminal sends logon information bag to background server, by logon information bag confirm GPS locating terminal be connected between background server whether normal, so, can ensure that GPS locating terminal is connected normally with setting up between background server, namely the transmission etc. occurring connecting the problems affect locator data bags such as exception is avoided, secondly, GPS locating terminal timed sending state bag is to background server, the state (whether receive and reply bag) of being replied bag by background server feedback judges that GPS locating terminal and background server current connection state are normal or disconnect, if be in off-state, then GPS locating terminal again sends state bag and reconnects, so, the connection status that GPS locating terminal and background server keep good can be ensured, so that communication between the two, again, the locator data bag being sent to background server due to GPS locating terminal does not need background server to make reply, therefore, significantly can reduce the burden of background server, ensure the good working state of background server, be applicable to continuous transmission time interval short, background server connects the many systems of load.
The foregoing is only the preferred embodiments of the present invention; not thereby its scope of the claims is limited; every utilize specification of the present invention and accompanying drawing content to do equivalent structure or equivalent flow process conversion; directly or indirectly be used in the technical field that other are relevant, be all in like manner included in scope of patent protection of the present invention.