Summary of the invention
The invention provides the method that a kind of state reports, make the electronic product terminal can in the process of executing the task, report the state of self.Specifically comprise:
The method that a kind of state reports comprises:
The log-on message that receiving terminal sends;
According to described log-on message to described terminal distribution session id;
Receive the state information of described terminal to report, described state information is carried the state and the described session id of the current task execution of described terminal.
The method that a kind of state reports comprises:
Send log-on message to service end;
Receive the session id that service end is distributed;
To service end uploaded state information, carry state and described session id that current task is carried out in the described state information.
A kind of terminal comprises:
Registering modules: be used for obtaining session id to the service end registration
Monitoring module: be used to monitor the state that self task is carried out.
The state reporting module: be used for according to described session id, and the execution status of task monitored out of described monitoring module, generate state information and also report.
A kind of service end comprises:
The registration analysis module: be used for the log-on message that receiving terminal sends, and according to log-on message to the terminal distribution session id and send to described terminal.
State receiver module: be used for the state information that receiving terminal reports, comprise state that described terminal is executed the task and described session id in this state information.
The invention solves the state of electronic product terminal in the process of executing the task and report problem, can be so that service end be accurately learnt the state of terminal, a plurality of terminals can also be simultaneously to a service end uploaded state among the present invention, and service end can be a plurality of Terminal Service simultaneously.
Embodiment
In order to make those skilled in the art person understand the present invention better, the present invention is described in further detail below in conjunction with accompanying drawing.
The state that the method that accompanying drawing 1 reports for a kind of state of the present invention, terminal equipment report it to execute the task and carry out to service end in the process of executing the task
The performed task of terminal equipment can comprise multiple, such as the upgrading of terminal equipment hardware, and the self check of terminal equipment, the terminal equipment file is downloaded or the like.
Terminal described in the present invention also comprises multiple terminal type, such as the MP3 player, and PMP player, home gateway, mobile phone etc.
Terminal equipment reports the state that carries out that it executes the task to service end in the process of executing the task, as shown in Figure 1, and wherein:
Step 101. is registered by communicating to connect to service end transmission log-on message for terminal of the present invention, its mode that sends log-on message can be by sending certain message registration, described communicating to connect can be based on various communications protocols or communication mode, such as, can connect communication by ICP/IP protocol, also can connect communication, can also pass through TLS by the UDP mode, serial ports, modes such as USB connect.The process that terminal is registered to service end can be that above-mentioned log-on message is sent to service end by concrete communication protocol by terminal in the mode of message.The facility information that can comprise terminal self in the log-on message, such as the title of equipment, the numbering of equipment, the sequence number of product etc.A service end can receive the log-on message of one or more terminal equipments simultaneously in the present invention, so that provide service to a plurality of terminals simultaneously.The embodiment of the invention provides a kind of message of log-on message, and its concrete form is as follows:
REG?SEQ_NUM?DEVICE_ID
Wherein REG represents that it is a log-in command, and SEQ_NUM is the sequence number of order, and DEVICE_ID is the device numbering of terminal self.Need to prove that above-mentioned message format only is a kind of embodiment that realizes registration, other can realize that terminal also is fine to the mode of service end registration.
Step 102. service end sends feedback message to terminal after receiving the log-on message of terminal, feedback message can carry a session id in this step, and after this this session id can be used for terminal to the service end uploaded state.The embodiment of the invention provides a kind of message of service end to terminal transmission feedback message that be used to finish, and its concrete form is as follows:
STATUS_CODE?SEQ_NUM?SESS?ION_ID?TIMEOUT
Wherein STATUS_CODE is the conditional code of response, the concrete value of this conditional code can be used to show the responsive state of registration this time, for example: when the STATUS_CODE value is 200, normal response is this time registered in expression, value is to represent that this equipment registered at 201 o'clock, and value is to represent that this time registration made mistakes at 500 o'clock.SEQ_NUM is the sequence number of order.SESSION_ID is a session id, and service end will be returned a session id to terminal when normal registration, and after this this session id can be used for terminal to the service end uploaded state.TIMEOUT is an additional parameter, can be used to represent the time-out time of its session id before.For example the TIMEOUT value is 300 o'clock, and the time-out time of the session id before can representing is 300 minutes.Need to prove the message of above introduction, and value, be a kind of concrete mode of service end that be used for to terminal transmission feedback information, other can realize that service end also is fine to the mode that terminal sends feedback information.
After step 103. terminal is received the service end feedback information, if it is normal that feedack has been represented registration, or carried a session id in the feedack, terminal just can report the state information of himself to service end, comprises the state that its task is carried out, for example: download state, write the Flash state, the self check state, rebooting status etc., the session id that can also comprise the service end distribution in this state information is so which terminal is service end can distinguish this state information from.Terminal is at the state that can repeatedly report himself after the service end registration to service end, and its mode that reports can be regularly to report automatically, also can be to report when its state of service end acquisition request.Service end can receive the state information of one or more terminal to report simultaneously simultaneously.The embodiment of the invention provides a kind of message that completion status information reports that is used for, and its concrete form is as follows:
STATUS?SEQ_NUM?SESSION_ID?STATE_NAME
Wherein STATUS is the order of uploaded state information, and SEQ_NUM is the sequence number of order, and SESSION_ID is that service end is distributed to terminal and is used for the session id that state reports.Service end receives at the same time on the state of a plurality of terminals and gives the correct time, and such session id just can show the state which terminal its state that reports specifically is.STATE_NAME is the state of present terminal, its value can be according to different terminals, different task is gone definition, for example: UPDATING represents to upgrade, DOWNLOADING represents download state, FLASHROM-WRITING represents to write the Flash state, and RESTARTING represents rebooting status, and EXAMING represents detected state etc.
Step 104. terminal can also further report its state progress msg to service end after service end uploaded state information, and for example the terminal downloads state has finished 40%, and terminal reports service end with this progress as the state progress msg.Can comprise service end in the state progress msg and come from which terminal so that service end is distinguished this state progress msg to the session id of terminal distribution.Simultaneously, terminal can repeatedly report its state progress msg to service end, and its mode that reports can be regularly to report automatically, also can be to report when its state progress of service end acquisition request.Service end also can receive the state progress msg from different terminals simultaneously, distinguishes this state information by the session id that is comprised in the state progress msg and comes from which terminal.The embodiment of the invention provides a kind of message that the completion status progress msg reports that is used for, and its concrete form is as follows:
INFO?SEQ_NUM?SESSION_ID?PROGRESS
Wherein its state progress msg of terminal to report is represented in the INFO order, SEQ_NUM is the sequence number of order, SESSION_ID is a session id, PROGRESS is the progress msg of state, its value can be according to the different terminals type, and the different conditions definition, for example: the PROGRESS value is that the overall progress of 84 its states of expression is 84%, and the PROGRESS value is that S5 represents that its state has entered five-stage etc.
Step 105. SOT state of termination changes, and for example, after terminal is restarted, changes detected state over to by rebooting status; Terminal enters Flash write state etc. after finishing download.
Step 106. terminal reports service end with new state, and its detailed process is identical with the description in the step 203.
Step 107. terminal reports service end with the progress of state, and its concrete process is identical with the description in the step 204.
Step 108. terminal detects its task and finishes, and terminal will be nullified to service end, and it has finished all operations to inform service end.The embodiment of the invention provides a kind of message that terminal is nullified to service end that is used for, and its concrete form is as follows:
BYE?SEQ_NUM?SESSION_ID
Wherein BYE represents the cancellation order of terminal to service end, and SEQ_NUM is the sequence number of order, and SESSION_ID is a session id, and this ID is that terminal is distributed by service end in service end registration back.
Service end cancellation again after step 109. terminal is finished the work.
Above process need explanation be can finish such as ICP/IP protocol, UDP mode, TLS mode, USB mode, serial mode etc. by various communications protocols or communication mode alternately between terminal and the service end.Can accurately learn the state of terminal by above embodiment service end, a plurality of terminals can also be simultaneously to a service end uploaded state among the present invention, and session id is used to distinguish different terminals, and service end can be a plurality of Terminal Service simultaneously.
Accompanying drawing 2 can be used for the terminal 200 that state reports for the present invention is a kind of, and this terminal comprises: Registering modules 201 monitoring modules 202, state reporting module 203.
Registering modules 201: be used for sending log-on message to service end, application is used for the session id that state reports.The facility information that can comprise terminal self in the log-on message, the title of equipment for example, the numbering of equipment, the sequence number of product etc.This module will receive the session id of service end to its distribution after succeeding in registration.Terminal sends log-on message and receives the session id communication mode or communication protocol can be multiple from service end, for example: connect communication by the TCP/IP mode, connect communication by the UDP mode, connect communication etc. by the USB mode.
Monitoring module 202: be used for the state that monitor terminal is executed the task, such as: terminal is when carrying out downloading task, and the result of monitoring module monitoring is a download state, and terminal is when carrying out the self check task, and the result of monitoring module monitoring is the self check state.This module can also be used to be further used for the progress that the monitor task state is finished, such as terminal when the download state, the progress that this module immediately monitoring is downloaded, for example: download and finished 63%, download and entered five-stage etc.When terminal is finished the work, monitoring module will monitor task and finish in addition.。
State reporting module 203: this module is used for according to session id, the execution status of task that reports monitoring module to monitor out, the state of the terminal of monitoring out such as monitoring module is a download state, the state reporting module is with the session id that distributes, and download state sends to service end as the state information that reports.Service end can receive the state information that the state reporting module of one or more terminals reports simultaneously, can comprise the session id of service end to its distribution in the state information that reports, and comes from which terminal so that service end is distinguished this state information that reports.The communication mode of uploaded state information or communication protocol also can be multiple, for example: connect communication by the TCP/IP mode, connect communication by the UDP mode, connect communication etc. by the USB mode, state reporting module 203 can also be further used for the state progress msg that reporting terminal is executed the task, and can comprise the session id of service end to its distribution in the state information.For example the download state progress of terminal is 30%, then terminal feeds back to service end as the state progress msg for its session id this state progress and server-assignment, the download state progress of terminal has proceeded to the phase III, then terminal feeds back to service end as the state progress msg for its session id this state and server-assignment, represent that its download state has proceeded to the phase III, service end can receive the state progress msg of one or more terminal to report simultaneously, can determine this state progress msg is to come from which terminal according to the session id that comprises in the state progress msg.
Accompanying drawing 3 is a kind of service end 300 that is used for the receiving terminal uploaded state of the present invention, and this service end comprises: registration analysis module 301, and state receiver module 302:
Registration analysis module 301: be used for the log-on message that receiving terminal sends, to this terminal distribution session id, and session ID sent to this terminal according to this log-on message.The registration analysis module is at first analyzed its log-on message, the facility information that can comprise terminal in this log-on message, the title of terminal equipment for example, the numbering of equipment, the sequence numbers of end product etc., registration analysis module can judge whether registration is successful according to the facility information in the log-on message after receiving log-on message, judge that such as the registration analysis module product ID in the log-on message exists in service end, then the registration failure of this terminal.Registration when the registration analysis module in service end can receive one or more terminal simultaneously so as service end so that simultaneously to one or more Terminal Service, can also be simultaneously to the different session id of one or more terminal distribution, so that distinguish mutual between different terminals and this service end.This module can send session id by the log-on message of multiple different communication protocol or communication mode and terminal interaction receiving terminal and to terminal.For example: connect communication by the TCP/IP mode, connect communication, connect communication, connect communication etc. by serial mode by the USB mode by the UDP mode.
State receiver module 302: be used for the state information that receiving terminal reports, can comprise the state of executing the task in this state information, and session id.For example terminal reports service end with the state information-download state of self, and this module will receive the state information that this terminal to report is represented download state.The state receiver module can receive the state information of one or more terminal to report simultaneously, the state receiver module can determine which terminal is this state information that reports come from by the session id in the uploaded state information, for example terminal A receives the session 1D-123 that service end is distributed after succeeding in registration, the state receiver module receives that to comprise session id be 123 state information, so just, represent the state information that this state information reports for terminal A, the state receiver module can also be further used for the progress msg of the state that receiving terminal reports, the state receiver module can receive the progress msg of the state of one or more terminal to report simultaneously, and which terminal can distinguish this state progress msg by the session id in these state progress msgs that report is from.The state receiver module can receive state information or state progress msg from different terminals by different communication modes or communication protocol, for example: ICP/IP protocol, USB mode, UDP mode, serial mode etc.
By the description of above embodiment, those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential general hardware platform, can certainly pass through hardware, but the former is better execution mode under a lot of situation.Based on such understanding, the part that the technical scheme of the embodiment of the invention contributes to prior art in essence in other words can embody with the form of software product, this software product is stored in the storage medium, comprise that some instructions are with so that mobile device (can be a mobile phone, personal computer, media player etc.) the described method of execution each embodiment of the present invention.Here alleged storage medium, as: ROM/RAM, disk, CD etc.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.