A kind of development approach of set-top box menu
Technical field
The present invention relates to digital TV field, relate in particular to a kind of menu development approach of digital TV set-top box.
Background technology
Flourish along with Digital Television, the individual demand of different operators is also more and more, and is also more and more to the set-top box menu structural modification.
The exploitation of set-top box software now all is based on the C language basically, and is lower in the modification efficient to menu structure.For the personalized menu demand that operator proposes, generally be to revise code, distinguish each operator with the most original macrodefinition in the C language.The present domestic operator that more than 200 independent operation arranged, the personalized menu demand is very many, makes a whole set of software systems become redundant numerous and diverse, easy care not, development efficiency is also very low simultaneously.
Fig. 1 (a) is the menu structure of giving tacit consent in a kind of set-top box, the one-level menu has program guide and program, video request program, TV programme and 3 submenus of broadcast program are arranged below the program guide, editing saving and 2 submenus of program searching are arranged below the program.The commercial city of various places operation now wishes to design menu by the actual conditions of own network, if operator wants video request program is put into below the program guide management, menu name with video request program changes home theater into simultaneously, and concrete menu format shows shown in Fig. 1 (b).By common development process, the software engineer will analyze menu structure, revises code by new menu structure then.Workload is big like this, and causes the software systems redundancy numerous and diverse easily, not easy care.
Summary of the invention
In view of this, be necessary to provide a kind of development process simple set-top box menu development approach.
The invention provides a kind of development approach of set-top box menu, it is characterized in that, adopt the XML file to represent menu information, attribute in the set-top box menu is defined with the XML label, make the XML label set up corresponding relation with the set-top box menu attribute, by this menu label attribute is made amendment, come the structure of menu is made amendment with this.
Compared with prior art, the present invention shows the menu information of set-top box with the XML form, the program of accomplishing is separated with menu structure, set-top box reads the XML file when starting, reduce set-top box menu structure and showing according to the respective labels value in the XML file again, when needs are adjusted the set-top box menu structure, as long as will represent the XML file of menu structure changes, and need not change program code, improved software development efficiency, system is become safeguard easily, compatible good.
Description of drawings
Fig. 1 is the menu structure schematic diagram in the set-top box.
Fig. 2 is the flow chart that set-top box of the present invention reads the XML menu file.
Embodiment
In the set-top box menu development approach of the present invention, set-top box menu information adopts XML (ExtensibleMarkup Language, extend markup language) representation of file, separates with menu structure with the program of accomplishing.At first define the XML file structure, the attribute in the set-top box menu is defined with the XML label, make the XML label set up corresponding relation with the set-top box menu attribute.For example, Menu_Depth represents the position of menu, Menu_TileChn represents Chinese title, Menu_TileEng represents English title, Menu_ExeTime represents that menu shows duration, Menu_Status represents whether menu activates, and Menu_Page represents the page of menu links, and Menu_Function represents the function that menu is carried out.Then, the coordinate in the definition menu properties and the relation of this menu position, as: the position Menu_Depth of Menu_Depth menu is expressed as { An}, its expression menu is in the position of an menu of n level menu, be the position of first coordinate representation in the ground floor menu in the attribute, second position of coordinate representation in second layer menu, and the like; The degree of depth of representing menu when coordinate is 0 this one deck of arriving is 2,1,0,0,0,0,0,0 as the coordinate attributes of Menu_Depth, is illustrated in second submenu in the one-level menu, is first submenu in the second-level menu.
Be the partial XML code of the menu of presentation graphs 1 (a) below:
……
-<channel?name=″1″>
<Menu_TileChn〉program guide</Menu_TileChn 〉
<Menu_Depth>1,0,0,0,0,0,0,0</Menu_Depth>
</channel>
-<channel?name=″2″>
<Menu_TileChn〉program</Menu_TileChn 〉
<Menu_Depth>2,0,0,0,0,0,0,0</Menu_Depth>
</channel>
-<channel?name=″3″>
<Menu_TileChn〉video request program</Menu_TileChn 〉
<Menu_Depth>1,1,0,0,0,0,0,0</Menu_Depth>
</channel>
……
When needs carried out the personalization modification to menu structure, an attribute that only needs to revise menu label got final product.As " video request program " menu among Fig. 1 a need be revised as " home theater " shown in Fig. 1 (b) time, as long as in the XML file will " video request program " and child node in attribute changes, change the Menu_TileChn attribute into home theater, change Menu_Depth into 2,1,0,0,0,0,0,0, can realize the modification of above-mentioned menu.Amended XML file is as follows:
……
-<channel?name=″3″>
<Menu_TileChn〉home theater</Menu_TileChn 〉
<Menu_Depth>2,1,0,0,0,0,0,0</Menu_Depth>
</channel>
……
Do not need to do any code during modification and change, make system be easy to safeguard, improved efficient simultaneously, even the right and wrong software developer also can carry out the personalized design of menu.
See also Fig. 2, set-top box of the present invention reads the flow chart of XML menu file.At first, set-top box is carried out initialization, read the XML menu file; Judge then whether XML menu file data are correct,, then call default menu, and on set-top box, show if incorrect; If correct, then read the tag attributes in the XML file, and each tag attributes value is composed to each submenu respective attributes, then each submenu is combined into complete set-top box menu structure, and on set-top box, shows.
Compared with prior art, the present invention shows the menu information of STB with the XML form, the program of accomplishing is separated with menu structure, STB reads the XML file when starting, come reducing machine top box menu structure according to the respective labels value in the XML file again and show, when needs are adjusted the set-top box menu structure, as long as will represent the XML file of menu structure changes, and need not change program code, improved software development efficiency, system is become safeguard easily, compatible good.
In addition, those skilled in the art also can do other variation in spirit of the present invention. The variation that these are done according to spirit of the present invention all should be included in the present invention's range required for protection.