Summary of the invention
The invention provides a kind of method of state reporting, make the electronic product terminal can in the process of executing the task, report the state of self.Specifically comprise:
A kind of method of state reporting comprises:
The log-on message that receiving terminal sends;
According to said log-on message to said terminal distribution session id;
Receive the state information of said terminal to report, said state information is carried the state and the described session id of the current task execution at said terminal.
A kind of method of state reporting 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 said 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 said session id, and the execution status of task monitored out of said 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 said terminal.
State receiver module: be used for the state information that receiving terminal reports, comprise state of executing the task in said terminal and said session id in this state information.
The invention solves the state reporting problem of electronic product terminal in the process of executing the task; Can be so that service end be accurately learnt the state at 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 done further detailed description below in conjunction with accompanying drawing.
Accompanying drawing 1 is the method for a kind of state reporting of the present invention, the state that terminal equipment reports 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, shown in accompanying drawing 1, wherein:
Step 101. is sent log-on message to service end and is registered for terminal of the present invention connects through communication, its mode of sending log-on message can be through sending certain message registration, and described communication connects can be based on various communications protocols or communication mode; Such as; Can connect communication through ICP/IP protocol, also can connect communication, can also pass through TLS through the UDP mode; Serial ports, modes such as USB connect.The process that register to service end at the terminal can be that above-mentioned log-on message is sent out to service end by the terminal through concrete communication protocol with 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 to a plurality of terminals service is provided simultaneously.The embodiment of the invention provides a kind of message of log-on message, and its concrete form is following:
REG?SEQ_NUM?DEVICE_ID
Wherein REG representes that it is a log-in command, and SEQ_NUM is the sequence number of order, and DEVICE_ID is the device numbering at terminal self.Need to prove that above-mentioned message format only is a kind of embodiment that realizes registration, other can realize that the terminal also is fine to the mode of service end registration.
Step 102. service end is sent feedback message to the terminal after receiving the log-on message at terminal, feedback message can carry a session id in this step, and after this this session id can be used for the 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 accomplish, and its concrete form is following:
STATUS_CODE?SEQ_NUM?SESSION_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, and 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 the terminal when normal registration, and after this this session id can be used for the terminal to the service end uploaded state.TIME0UT 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 modes that can realize that service end is sent feedback information to the terminal also are fine.
After the service end feedback information is received at step 103. terminal, normal if feedack has been represented registration, or carried a session id in the feedack; The 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 in this state information, can also comprise the service end distribution is so that which terminal is service end can distinguish this state information from.The terminal is at the state that after the service end registration, can repeatedly report himself to service end, and its mode that reports can be regularly to report automatically, also can be when its state of service end acquisition request, to report.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 is used for the completion status information reporting, and its concrete form is following:
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 the session id that the terminal is used for state reporting.When service end received the state reporting at a plurality of terminals at the same time, such session id just can show the state which terminal its state that reports specifically is.STATE_NAME is the state at present terminal; Its value can be according to different terminals, and different task is gone definition, and for example: UPDATI NG representes to upgrade; DOWNLOADING representes download state; FLASHROM-WRITING representes to write the Flash state, and RESTARTING representes rebooting status, and EXAMING representes 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 accomplished 40%, and the 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, the 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 when its state progress of service end acquisition request, to report.Service end also can receive the state progress msg from different terminals simultaneously, distinguishes this state information through 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 following:
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, and SESSION_ID is a session id, and 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 representes that its state has got into five-stage etc.
Step 105. SOT state of termination changes, and for example, after restart at the terminal, changes detected state over to by rebooting status; The terminal is accomplished and is downloaded back entering Flash write state etc.
Service end is given with new state reporting in step 106. terminal, 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 accomplishes, and the terminal will be nullified to service end, and it has accomplished all operations to inform service end.The embodiment of the invention provides a kind of message that nullify to service end at the terminal that is used for, and its concrete form is following:
BYE?SEQ_NUM?SESSION_ID
Wherein BYE representes 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 the terminal is distributed by service end in service end registration back.
Service end cancellation again after finishing the work in step 109. terminal.
The explanation of above process need be can accomplish such as ICP/IP protocol, UDP mode, TLS mode, USB mode, serial mode etc. through various communications protocols or communication mode alternately between terminal and the service end.Can accurately learn the state at terminal through 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 terminal, and service end can be a plurality of terminal service simultaneously.
Accompanying drawing 2 is a kind of terminal 200 that can be used for state reporting of the present invention, 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 of state reporting.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.The terminal is sent log-on message and is received the session id communication mode or communication protocol can be multiple from service end, for example: connect communication through the TCP/IP mode, connect communication through the UDP mode, connect communication etc. through the USB mode.
Monitoring module 202: be used for the state that monitor terminal is executed the task, such as: the terminal is when carrying out downloading task, and the result of monitoring module monitoring is a download state, and the 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 accomplished, such as the terminal when the download state, the progress that this module immediately monitoring is downloaded, for example: download and accomplished 63%, download and got into five-stage etc.When finish the work in the terminal, monitoring module will monitor task and accomplish 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 at 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 at 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 through the TCP/IP mode; Connect communication through the UDP mode; Connect communication etc. through 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 at terminal is 30%; Then the 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 at terminal has proceeded to the phase III; Then the 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 confirm 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, can comprise the facility information at terminal in this log-on message, for example the title of terminal equipment; 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 at 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 be sent session id through the log-on message of multiple different communication protocol or communication mode and terminal interaction receiving terminal and to the terminal.For example: connect communication through the TCP/IP mode, connect communication, connect communication, connect communication etc. through serial mode through the USB mode through 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 the 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 confirm which terminal is this state information that reports come from through 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, and the state receiver module can receive the progress msg of the state of one or more terminal to report simultaneously, can distinguish which terminal this state progress msg be from through the session id in these state progress msgs that report.The state receiver module can receive state information or state progress msg from different terminals through different communication modes or communication protocol, for example: ICP/IP protocol, USB mode, UDP mode, serial mode etc.
Through 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 be come out with the embodied of software product; This software product is stored in the storage medium; Comprise that some instructions are with so that mobile device (can be mobile phone, personal computer, media player etc.) is carried out the described method of 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, belong within the scope of claim of the present invention and equivalent technologies thereof if of the present invention these are revised with modification, then the present invention also is intended to comprise these changes and modification interior.