Middleware device, Middleware implementation method and television set
Technical field
The present invention relates to intelligent television field more particularly to a kind of middleware devices, Middleware implementation method and television set.
Background technique
Traditional intelligence television system provides the service logic on respective bottom layer driving and upper layer by each chip supplier, together
The different television types of one TV manufacturer are due to bottom layer driving code and upper-layer service logic disunity, it is therefore desirable to respectively
Safeguard a whole set of television system code, this is the great inconvenience of TV manufacturer bring: same or like problem may
It is repetitively appearing in different television types, needs to put into a large amount of manpower and material resources and go to debug and develop;And different TV
The otherness of type is also that the knowledge of developer continues and technological accumulation brings many difficulties.
Summary of the invention
The embodiment of the present invention provides a kind of middleware device, Middleware implementation method and television set, for solving bottom
Drive code set and the skimble-scamble problem of upper-layer service logic.
In order to achieve the above objectives, the embodiment of the present invention adopts the following technical scheme that
In a first aspect, providing a kind of middleware device, comprising:
Television applications interface unit, for calling television interface unit to provide conversion function for upper level applications,
And merge according to functional module systematic function module id and the first parameter set to the television interface unit and the function
The corresponding interface of energy module sends the functional module mark and the first parameter sets, wherein the functional module mark refers to
Show that the functional module for calling the middleware device, first parameter sets include all ginsengs relevant to the functional module
Number, the programming language of the upper level applications are different from the programming language of the television interface unit;
Television interface unit, for providing calling interface to the television applications interface unit according to functional module,
The second parameter sets are extracted from first parameter sets according to functional module mark, and according to the functional module mark
The instruction of knowledge sends second parameter sets to the corresponding interface of middleware unit, wherein the functional module mark and institute
State the service logic of the second parameter sets indication function module;
The middleware unit, the interface for being called according to the television interface unit carry out service logic movement,
And second parameter sets are sent to the corresponding interface of hardware abstraction unit;
The hardware abstraction unit, the interface for being called in conjunction with second parameter sets and the middleware unit
Driving for different chip manufacturers provides interface, realizes corresponding function by the driving of the different chips manufacturer, and according to volume
The configuration of script is translated to compile the driving of the different chips manufacturer.
Second aspect provides a kind of Middleware implementation method, applied to middleware device described in first aspect, packet
It includes:
Television interface unit is called to provide conversion function for upper level applications, and according to functional module systematic function mould
Block identification and the first parameter set merge to described in the transmission of the interface corresponding with the functional module of the television interface unit
Functional module mark and the first parameter sets, wherein the Middleware implementation method is called in the functional module mark instruction
Functional module, first parameter sets include all parameters relevant to the functional module, the upper level applications
Programming language is different from the programming language of the television interface unit;
Calling interface is provided to the television applications interface unit according to functional module, according to the functional module mark
The second parameter sets are extracted in knowledge from first parameter sets, and according to the instruction of functional module mark to middleware list
The corresponding interface of member sends second parameter sets, wherein the functional module mark and second parameter sets instruction
The service logic of functional module;
The interface called according to the television interface unit carries out service logic movement, and to pair of hardware abstraction unit
Interface is answered to send second parameter sets;
The interface called in conjunction with second parameter sets and the middleware unit is the driving of different chip manufacturers
Interface is provided, corresponding function is realized by the driving of the different chips manufacturer, and according to the configuration of compilation script to compile
State the driving of different chip manufacturers.
The third aspect provides a kind of television set, including middleware device described in first aspect.
Middleware device, Middleware implementation method and the television set that the embodiment of the present invention provides are upper level applications
It calls television interface unit to provide conversion function, and merges according to functional module systematic function module id and the first parameter set
To the interface sending function module id corresponding with functional module of television interface unit and the first parameter sets, wherein function
The functional module of middleware is called in energy module id instruction, and the first parameter sets include all parameters relevant to functional module,
The programming language of upper level applications and the programming language of television interface unit are different;According to functional module to television applications
Interface unit provides calling interface, is identified according to functional module and extracts the second parameter sets from the first parameter sets, and according to
Functional module mark instruction to the corresponding interface of middleware unit send the second parameter sets, wherein functional module mark and
The service logic of second parameter sets indication function module;It is dynamic that service logic is carried out according to the interface that television interface unit is called
Make, and sends the second parameter sets to the corresponding interface of hardware abstraction unit;In conjunction with the second parameter sets and middleware unit institute
The interface of calling provides interface for the driving of different chip manufacturers, realizes corresponding function by the driving of different chip manufacturers, and
The driving of different chip manufacturers is compiled according to the configuration of compilation script.Different function module is divided first, takes out each function
The interface of service logic is supplied to chip factory quotient for realizing bottom layer driving, solves bottom layer driving by the service logic of module
Code and the skimble-scamble problem of upper-layer service logic.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is the structural schematic diagram for the television set that the embodiment of the present invention provides;
Fig. 2 is the structural schematic diagram for the middleware device that the embodiment of the present invention provides;
Fig. 3 is the flow diagram for the Middleware implementation method that the embodiment of the present invention provides.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
The present invention provides a kind of television sets, referring to fig. 1, comprising: upper level applications 101, middleware device
102, bottom layer application program 103.User's operation is sent to middleware device 102 by upper level applications 101, by middleware device
102 call bottom layer application program 103, and the response results of bottom layer application program 103 are fed back to upper layer by middleware device 102
Application program 101.
Embodiment 1:
The present invention provides a kind of middleware devices, as the middleware device 102 in television set shown in Fig. 1, ginseng
According to shown in Fig. 2, comprising:
Television applications interface (English abbreviation: TV API, full name in English: television application
Program interface) unit 201, for being connect for upper layer Android (Chinese: Android) application call TV
Mouth unit 202 provides conversion function, and merges according to functional module systematic function module id and the first parameter set to TV
The interface sending function module id corresponding with functional module of interface unit 202 and the first parameter sets, wherein function mould
The functional module of middleware of the invention is called in block identification instruction, and the first parameter sets include all ginsengs relevant to functional module
Number, the programming language of upper level applications are different from the programming language of television interface unit 202.
Illustratively, by taking tuning as an example, tuning is directed not only to image, further relates to sound, searching television signal etc..Therefore first
First mark off different functional modules, wherein functional module according to function include 3D, sound, image, data, factory parameters with
And the modules such as channel management, each module are successively called all in accordance with Middleware implementation method provided by the invention.Each module with
And each layer all uses the singleton pattern in design pattern to be operated, and creates and calls to avoid the illegal of object in this way,
Also contribute to the stability and robustness of system.
Illustratively, it such as corresponding sound module, can be identified with the functional module of different numerical value to divide
Sound, setting sound audio etc. Zhi Shi not be adjusted, but calls television interface unit 202 in television applications interface 201
The sound module interface of unified call television interface unit 202, therefore TV applications journey are all identified when interface according to functional module
Sequence interface 201 can be accumulated multiple calling of upper level applications to television interface unit 202 in a manner of many-to-one
One calling.
First parameter sets include all relevant parameters of the functional module, such as the first parameter set for sound module
Conjunction may include volume, equilibrium, audio, channel (channel includes earphone, coaxial or TV loudspeaker etc.) etc..The technology of this field
Personnel are understood that the first parameter sets can be structural body, and the data in structural body can be integer, array, character string etc.
Type, the first parameter sets can also be pointer, be directed toward the home address space of above-mentioned all relevant parameters.
Preferably, the programming language of upper layer Android application program is Java, television interface unit 202 and from TV
The programming language of other downward each layers of interface unit 202 is C or C++, then television applications interface unit 201 passes through JNI
(full name in English: java native interface, Chinese: java local interface) mechanism is upper layer Android application journey
Sequence calls television interface unit 202 to provide conversion function.
Television interface (English abbreviation: TV interface, full name in English: television interface) unit 202,
For providing calling interface to television applications interface unit 201 according to functional module, identified according to functional module from first
Extract the second parameter sets in parameter sets, and according to the instruction of functional module mark to the corresponding interface of middleware unit 203
Send the second parameter sets, wherein the service logic of functional module mark and the second parameter sets indication function module.
Television interface unit 202 is that television applications interface unit 201 provides tune for functional module as described above
By taking sound module as an example, the first parameter set illustratively will not be used when being configured volume or setting sound audio with interface
All data in conjunction, the function of the sound module interface of television interface unit 202 to television applications interface unit 201
After energy module id and the first parameter sets, according to functional module mark, sound sound is still arranged in the indicated volume that is configured
Effect, critical data is extracted from the first parameter sets becomes the second parameter sets, functional module mark and the unification of the second parameter set
It rises and indicates the functional module service logic to be carried out, such as just extract volume number from the first parameter sets when setting volume
According to, as the second parameter sets, the setting volume of the middleware unit 203 indicated to functional module mark connects with channel data
Mouth sends the second parameter sets, and middleware unit 203 is acted according to the service logic that these data can be configured volume.
Optionally, referring to fig. 2, television interface unit 202 can also include adaptation module 2021, adaptation module
2021 include client class corresponding with functional module mark, and adaptation module 2021 is used as IPC (English name: inter-
Process communication, Chinese: interprocess communication) communication client by IPC communication mode to middleware
The corresponding interface of unit 203 sends the second parameter sets.All calling to middleware unit 203, pass through each functional module
Adaptation module 2021 in correspondence client class be called, it is therefore an objective to reduce coupling and facilitate later maintenance.
It is further to note that the interface of adaptation module 2021 calls the corresponding interface of middleware unit 203, for example,
The setting volume interface of adaptation module 2021 calls the setting volume interface of middleware unit 203;The setting of adaptation module 2021
The setting sound audio interface of sound audio interface calling middleware unit 203.
The interface that middleware (English name: midware) unit 203 is used to be called according to television interface unit 202 into
Industry business logical action, and the second parameter sets are sent to the corresponding interface of hardware abstraction unit 204
Middleware unit 203 services (English name: service) when communicating with television interface unit 202 by IPC
Mode run.
Optionally, referring to fig. 1, middleware unit 203 further includes data separating module 2031, data separating module
2031 are used to access to the data of the middleware unit 203 of different function module, for example, when being configured volume in order under
Current volume is kept to need to store volume data when secondary booting.Data separating module 2031 utilizes singleton system database
Class is unified to access to the data of modules.The data separating module shield difference of different chip business, and to data into
It has gone data separating, has reduced the coupling of data and code.
It should be noted that the interface of middleware unit 203 calls the corresponding interface of hardware abstraction unit 204, for example, in
Between part unit 203 setting volume interface call hardware abstraction unit 204 setting volume interface;Middleware unit 203 is set
Set the setting sound audio interface that sound audio interface calls hardware abstraction unit 204.
Hardware abstraction unit (English abbreviation: HAL, full name in English: hardware abstract layer) 204 is for tying
The driving that the interface that the second parameter sets and middleware unit 203 are called is closed as different chip manufacturers provides interface, by difference
Corresponding function is realized in the driving of chip manufacturer, and the driving of different chip manufacturers is compiled according to the configuration of compilation script.
Hardware abstraction unit 204 provides the sheet that the second parameter sets and middleware unit are called to following driving unit
The interface of layer is realized the program code of driving layer by different chip manufacturers, in addition, compiling not also according to the configuration of compilation script
With the driving of chip manufacturer.
Illustratively, by taking the setting volume of sound module as an example, the setting volume interface of middleware unit 203 calls hardware
After the setting volume interface of abstraction unit 204, hardware abstraction unit 204 to driving layer provide volume data and channel data with
And setting volume interface, as long as the program code for the driving layer that chip manufacturer realizes can realize basis in setting volume interface
The function of volume data and channel data setting volume.
Provided Middleware implementation method of the invention not only can clearly comb television architecture by being layered to call
Logic is more conducive to position and find the problem.Each layer has respective test interface use-case, may not need upper layer UI, directly
Call each layer of interface by the test of serial ports tool, quickly to position and investigation problem where logical layer.Code architecture
Every layer is all write test program interface using gtest frame, without relying on the calling on upper layer, is directly individually surveyed by test command
Each layer of key interface is tried, to find and module position where orientation problem.
The middleware device that the embodiment of the present invention provides, comprising: television applications interface unit, for being answered for upper layer
Conversion function is provided with routine call television interface unit, and according to functional module systematic function module id and the first parameter
Collection merges to the interface sending function module id corresponding with functional module of television interface unit and the first parameter sets,
In, the functional module of middleware is called in functional module mark instruction, and the first parameter sets include relevant to functional module all
Parameter, the programming language of upper level applications and the programming language of television interface unit are different;Television interface unit is used for basis
Functional module provides calling interface to television applications interface unit, is mentioned from the first parameter sets according to functional module mark
The second parameter sets are taken, and send the second parameter set to the corresponding interface of middleware unit according to the instruction of functional module mark
It closes, wherein the service logic of functional module mark and the second parameter sets indication function module;Middleware unit is used for basis
The interface that television interface unit is called carries out service logic movement, and sends the second ginseng to the corresponding interface of hardware abstraction unit
Manifold is closed;Hardware abstraction unit, the interface for combining the second parameter sets and middleware unit to be called are different chip factories
The driving of quotient provides interface, realizes corresponding function by the driving of different chip manufacturers, and compile according to the configuration of compilation script
Translate the driving of different chip manufacturers.Different function module is divided first, takes out the service logic of each functional module, business is patrolled
The interface collected is supplied to chip factory quotient for realizing bottom layer driving, solves bottom layer driving code and upper-layer service logic disunity
The problem of.
Embodiment 2:
The present invention provides a kind of Middleware implementation methods, are applied to middleware device shown in Fig. 2, referring in Fig. 3
It is shown, comprising:
S301, it calls television interface unit to provide conversion function for upper level applications, and is generated according to functional module
Functional module mark and the first parameter set merge the interface sending function mould corresponding with functional module to television interface unit
Block identification and the first parameter sets, wherein the functional module of Middleware implementation method, the first ginseng are called in functional module mark instruction
Manifold conjunction includes all parameters relevant to functional module, the programming of the programming language and television interface unit of upper level applications
Language is different.
Optionally, the programming language of upper level applications is Java;The programming language of television interface unit is C or C++;For
Upper level applications call television interface unit to provide conversion function, comprising: call electricity by JNI mechanism for upper level applications
Conversion function is provided depending on interface unit.
Optionally, television interface unit further includes adaptation module, and adaptation module includes visitor corresponding with functional module mark
Family end class;
The second parameter sets are sent to the corresponding interface of middleware unit according to the instruction of functional module mark, comprising: visitor
Family end class sends the second parameter sets to the corresponding interface of middleware unit by IPC communication mode.
S302, calling interface is provided to television applications interface unit according to functional module, is identified according to functional module
The second parameter sets are extracted from the first parameter sets, and are connect according to the instruction that functional module identifies to the correspondence of middleware unit
Mouth sends the second parameter sets, wherein the service logic of functional module mark and the second parameter sets indication function module.
Optionally, middleware unit further includes data separating module, and data separating module is used for different function module
The data of middleware unit access.
S303, the interface called according to television interface unit carry out service logic movement, and to hardware abstraction unit
Corresponding interface sends the second parameter sets.
S304, the interface called in conjunction with the second parameter sets and middleware unit provide for the driving of different chip manufacturers
Interface realizes corresponding function by the driving of different chip manufacturers, and compiles different chip factories according to the configuration of compilation script
The driving of quotient.
The Middleware implementation method that the embodiment of the present invention provides calls television interface unit to provide for upper level applications
Conversion function, and merge to television interface unit and function according to functional module systematic function module id and the first parameter set
The corresponding interface sending function module id of energy module and the first parameter sets, wherein during functional module mark instruction is called
Between part functional module, the first parameter sets include all parameters relevant to functional module, the programming language of upper level applications
It says different from the programming language of television interface unit;It provides to call to television applications interface unit according to functional module and connect
Mouthful, the second parameter sets, and the instruction identified according to functional module are extracted from the first parameter sets according to functional module mark
The second parameter sets are sent to the corresponding interface of middleware unit, wherein functional module mark and the second parameter sets indicated work
The service logic of energy module;The interface called according to television interface unit carries out service logic movement, and to hardware abstraction list
The corresponding interface of member sends the second parameter sets;The interface called in conjunction with the second parameter sets and middleware unit is not same core
The driving of piece manufacturer provides interface, realizes corresponding function by the driving of different chip manufacturers, and according to the configuration of compilation script
To compile the driving of different chip manufacturers.Different function module is divided first, the service logic of each functional module is taken out, by industry
The interface of business logic is supplied to chip factory quotient for realizing bottom layer driving, solves bottom layer driving code and upper-layer service logic not
Unified problem.
It should be understood that in various embodiments of the present invention, magnitude of the sequence numbers of the above procedures are not meant to execute suitable
Sequence it is successive, the execution of each process sequence should be determined by its function and internal logic, the implementation without coping with the embodiment of the present invention
Process constitutes any restriction.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure
Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
It is implemented in hardware or software, the specific application and design constraint depending on technical solution.Professional technician
Each specific application can be used different methods to achieve the described function, but this realization is it is not considered that exceed
The scope of the present invention.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed system, apparatus and method, it can be with
It realizes by another way.For example, apparatus embodiments described above are merely indicative, for example, the unit
It divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components
It can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown or
The mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of equipment or unit
It closes or communicates to connect, can be electrical property, mechanical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent product
It is stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially in other words
The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter
Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a
People's computer, server or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention.
And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (full name in English: read-only memory, English letter
Claim: ROM), random access memory (full name in English: random access memory, English abbreviation: RAM), magnetic disk or light
The various media that can store program code such as disk.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can easily think of the change or the replacement, and should all contain
Lid is within protection scope of the present invention.Therefore, protection scope of the present invention should be based on the protection scope of the described claims.