A kind of method for upgrading software based on short message protocolAffiliated technical field
The present invention relates to a kind of method for upgrading software based on short message protocol.
Background technology
Early stage terminal software upgrading need adopt artificial upgrading, needs to adopt direct, wired upgrading mode.Adopt direct, wired upgrading mode, have the deficiency of upgrading inconvenience, this deficiency is especially outstanding in remote local mountain area.Have the people to propose to adopt note to carry out the solution of wireless remote upgrading terminals to this deficiency, for example the Chinese patent database is at CN200510098761.6, and denomination of invention is for carrying out the method that active inquiry is safeguarded to portable terminal.Existing employing note is upgraded needs following deficiency: every note of upgrade data can only be loaded a parameter, and upgrade data need send many notes, sends loaded down with trivial details, the upgrade cost height.
Summary of the invention
The present invention provides a kind of method for upgrading software based on short message protocol, its note that has overcome background technology high deficiency of existing upgrade cost of upgrading.
The technical solution adopted for the present invention to solve the technical problems is:
A kind of method for upgrading software based on short message protocol, it comprises:
Step 10, platform are obtained needs the upgrading terminals telephone number, and platform reads the upgrade data that is used for the terminal, and this upgrade data is made up of a plurality of parameters;
Step 20; Platform is loaded in a plurality of notes according to short message protocol with upgrade data; This each note all is mounted with a plurality of parameters; Wherein, this note includes note sum, note sequence number, this note command number and many orders corresponding to parameter, and this order comprises the parameter of this order data amount, this command sequence number and this order;
Step 30, platform sends those upgrade datas to the terminal;
Step 40, the terminal receives those upgrade datas;
Step 50, platform are resolved those notes to obtain those parameters, obtain this upgrade data;
Step 60, the terminal disposes upgrading terminals according to upgrade data.
In one preferred embodiment, this order also includes this command execution mode.
In one preferred embodiment, in this step 20, it comprises:
Step 21 according to the data capacity of note and the data volume of the parameter in the upgrade data, calculates this note and can load what parameters, and reads this a few parameters;
Step 22 is all formed an order with each parameter in these a few parameters that read;
Step 23 is formed note with those orders;
Step 24 judges whether all parameters of upgrade data all have been loaded into note, and if not execution in step 21 forming next note, otherwise execution in step 30.
In one preferred embodiment, this step 30, it comprises:
Step 31, platform is formed a task with a plurality of notes;
Step 32, whether the time of judging adding of task is greater than predetermined interval, if then this task is delivered to task queue to be sent;
Step 33 judges whether task queue to be sent is empty, if then finish, otherwise execution in step 34;
Step 34 reads a task of task queue to be sent;
Whether step 35 judge sends number of times greater than maximum number of times of transmission, if execution in step 33 then, otherwise execution in step 36;
Step 36 is sent a plurality of notes of this task;
Step 37 judges whether note sends success, if execution in step 38 then, otherwise execution in step 39;
Step 38, prompting is sent successfully, and execution in step 33;
Step 39, failure is sent in prompting, and execution in step 33.
In one preferred embodiment, this step 50, it comprises:
Step 51, platform is resolved note, all orders of obtaining every note;
Step 52, platform accurately read out each bar parameter of every note according to the data volume of order, obtain this upgrade data.
The present technique scheme is compared with background technology: because every note can be loaded a plurality of parameters; Therefore it to have overcome background technology not enoughly and have following advantage existing: 1, reduce the note amount; Practice thrift note data; Reduce note and send total cost, reduce upgrade cost, improve the efficient of upgrading terminal parameter; 2, can carry out parameter combinations flexibly, can make full use of the capacity of every note, single note multi-parameter has so just reduced interaction times, so also just improves success rate for upgrading; 3, utilize the order data amount of every order in the note to limit this parameter, during parsing accurately fast resolving go out supplemental characteristic, can avoid in every note a plurality of parameters to obscure.Because order also includes this command execution mode; Therefore the terminal can be confirmed executive mode in view of the above; For example upgrade parameter reply (replying this parameter configuration success), upgrade parameter to platform do not reply, remove structure after configuration, inquiry, inquiry return, dispose and return etc.; Therefore the border situation is upgraded flexibly factually, can reduce alternately, also reduces upgrade cost.。The a plurality of parameters of the combination of this method become the step of note, can make full use of the capacity of every note.The platform forwarding step of this method can send fast, accurately sends.
Description of drawings
Below in conjunction with accompanying drawing and embodiment the present invention is further specified.
Fig. 1 is the flow chart of the collocation method of the present invention's one preferred embodiment.
Fig. 2 is the flow chart that the platform of the collocation method of the present invention's one preferred embodiment sends.
Embodiment
A kind of method for upgrading software based on short message protocol is please referred to Fig. 1, and it comprises:
Step 10, platform are obtained needs the upgrading terminals telephone number, and platform reads the upgrade data that is used for the terminal, and this upgrade data is made up of a plurality of parameters;
Step 20; Platform is loaded in a plurality of notes according to short message protocol with upgrade data; This each note all is mounted with a plurality of parameters; Wherein, this note includes note sum, note sequence number, this note command number and many orders corresponding to parameter, and this order comprises the parameter of this order data amount, this command execution mode, this command sequence number and this order;
This note structure is as shown in the table:
| Abbreviation | Title |
| ID | Identifier |
| OP | Command code |
| SN | Serial number |
| MN | The short message number |
| MID | The short message sequence number |
| CC | Command number |
| DATA1 | The first command data |
| …… | |
| DATAn | N bar order data |
These imperative structures are as shown in the table:
| Abbreviation | Title |
| DL | Data length |
| CM | Command number |
| CT | Command type |
| DATA | Order data |
Step 30, platform sends those upgrade datas to the terminal;
Step 40, the terminal receives those upgrade datas;
Step 50, platform are resolved those notes to obtain those parameters, obtain this upgrade data;
Step 60, the terminal disposes upgrading terminals according to upgrade data;
Step 70, terminal are sent the note of informing of configuration successful or failure to platform;
Step 80, platform receives this and informs note.
This step 20, it comprises:
Step 21 according to the data capacity of note and the data volume of the parameter in the upgrade data, calculates this note and can load what parameters, and reads this a few parameters;
Suppose the terminal parameter of need upgrading:
| Parameter command number (No.n) | The parameter title | Value |
| No.1 | PARA1 | V1 |
| No.2 | PARA2 | V2 |
| No.3 | PARA3 | V3 |
Step 22 is all formed an order with each parameter in these a few parameters that read;
Above three parameters can produce three order datas according to agreement:
DATA1=DL1+No.1+X1+V1
DATA2=DL2+No.2+X2+V2
DATA3=DL3+No.3+X3+V3
Step 23 is formed note with those orders;
Generate the data of a parameter upgrading order: DATA=ID+OP+SN+MN+MID+03+DATA1+DATA2+DATA3;
Step 24 judges whether all parameters of upgrade data all have been loaded into note, and if not execution in step 21 forming next note, otherwise execution in step 30.
Wherein: upgrade parameter (X1), upgrade parameter do not dispose (X3), inquiry (X4) after not replying (X2), removing structure, inquiry is returned (X5), disposed and return (X6).
Please refer to Fig. 2, this step 30, it comprises:
Step 31, platform is formed a task with a plurality of notes;
Step 32, whether the time of judging adding of task is greater than predetermined interval, if then this task is delivered to task queue to be sent;
Step 33 judges whether task queue to be sent is empty, if then finish, otherwise execution in step 34;
Step 34 reads a task of task queue to be sent;
Whether step 35 judge sends number of times greater than maximum number of times of transmission, if execution in step 33 then, otherwise execution in step 36;
Step 36 is sent a plurality of notes of this task;
Step 37 judges whether note sends success, if execution in step 38 then, otherwise execution in step 39;
Step 38, prompting is sent successfully, and execution in step 33;
Step 39, failure is sent in prompting, and execution in step 33.
Adopt the transmission of this step, can handle the transmission timeout issue, for example: current task T1, if do not handle successfully, just no longer handle current task T1, begin to handle next task T2, current task T1 just waits for that next round handles again.It has advantage: whether current task handles success can not influence the back task handling.
This step 50, it comprises:
Step 51, platform is resolved note, all orders of obtaining every note;
Step 52, platform accurately read out each bar parameter of every note according to the data volume of order, obtain this upgrade data.
This method is simple and easy to usefulness, and is safe and reliable, makes full use of the advantage of note, as required, can also partly carry out encryption to parameter command.
Can be to switch shape parameter (parameter of bool value type), character string and integer type parameter, number section tabulation line parameter, be exactly that blocks of files parameter etc. is carried out the parameter upgrading processing in addition, these parameters fully can mix and match.
The method of upgrading can be handled single terminal, also can be to a plurality of terminal processes.
If simultaneously many station terminals are carried out the parameter upgrading, can send to each terminal that to upgrade to the data of " termination number+DATA "; So just can realize simultaneously many station terminals being carried out the parameter upgrading.
The above is merely preferred embodiment of the present invention, so can not limit the scope that the present invention implements with this, the equivalence of promptly doing according to claim of the present invention and description changes and modifies, and all should still belong in the scope that patent of the present invention contains.