CN102541549B - The method of integration television application module and device - Google Patents
The method of integration television application module and device Download PDFInfo
- Publication number
- CN102541549B CN102541549B CN201110437438.2A CN201110437438A CN102541549B CN 102541549 B CN102541549 B CN 102541549B CN 201110437438 A CN201110437438 A CN 201110437438A CN 102541549 B CN102541549 B CN 102541549B
- Authority
- CN
- China
- Prior art keywords
- key
- event
- key event
- communication
- application module
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 106
- 230000010354 integration Effects 0.000 title description 2
- 238000004891 communication Methods 0.000 claims description 77
- 230000008569 process Effects 0.000 claims description 75
- 238000012546 transfer Methods 0.000 claims description 13
- 238000012545 processing Methods 0.000 claims description 5
- 238000001914 filtration Methods 0.000 claims description 4
- 230000005540 biological transmission Effects 0.000 claims description 3
- 238000011161 development Methods 0.000 abstract description 14
- 230000006870 function Effects 0.000 description 27
- 230000009191 jumping Effects 0.000 description 4
- 230000002708 enhancing effect Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000002054 transplantation Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
Landscapes
- Input From Keyboards Or The Like (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
本发明公开了一种集成电视应用模块的方法,包括以下步骤:创建获取按键事件的线程;按所述线程获取按键事件;判断所述按键事件的类型,所述类型包括有效按键事件和有效按键事件;根据判断结果过滤无效按键事件,将有效按键事件传递给应用模块,以供应用模块执行相应操作。本发明还公开了一种集成电视应用模块的装置,本发明可以提高产品的开放性和可移植性,从而提高开发效率。
The invention discloses a method for integrating a TV application module, which comprises the following steps: creating a thread for acquiring a key event; acquiring the key event according to the thread; judging the type of the key event, and the type includes an effective key event and an effective key event; filter the invalid key event according to the judgment result, and pass the valid key event to the application module, so that the application module can perform the corresponding operation. The invention also discloses a device for integrating TV application modules, which can improve the openness and portability of products, thereby improving the development efficiency.
Description
技术领域 technical field
本发明属于电视技术领域,特别涉及一种集成电视应用模块的方法及装置。The invention belongs to the technical field of televisions, in particular to a method and device for integrating television application modules.
背景技术 Background technique
随着电视技术的发展,功能越来越强大,如浏览器、widget应用、在线教育、音乐欣赏等功能应用模块相应实现。现有技术中,将所有系统功能,按键获取和分发都糅杂在同一应用模块中,将应用模块集成到电视的过程中,需要针对某一具体的嵌入式操作系统和某一特定的硬件平台定制应用,因此当有多个嵌入式操作系统时,则不能实现应用模块的跨平台移植集成而需要定制多个应用模块,而这些应用模块需要不同厂商的支持,这样必然增加开发难度,产品的开放性及可移植性较差,在一定程度上增加了开发成本,产品的实用性不强。With the development of TV technology, the functions are becoming more and more powerful, such as browsers, widget applications, online education, music appreciation and other functional application modules are correspondingly realized. In the existing technology, all system functions, key acquisition and distribution are mixed in the same application module, and the process of integrating the application module into the TV needs to target a specific embedded operating system and a specific hardware platform Customized applications, so when there are multiple embedded operating systems, the cross-platform porting and integration of application modules cannot be realized and multiple application modules need to be customized, and these application modules need the support of different manufacturers, which will inevitably increase the difficulty of development, and the product The openness and portability are poor, which increases the development cost to a certain extent, and the practicability of the product is not strong.
发明内容 Contents of the invention
本发明的主要目的在于提供一种集成电视应用模块的方法,旨在提高电视机的开放性和可移植性,减小电视机的开发难度,增强产品的实用性。The main purpose of the present invention is to provide a method for integrating TV application modules, aiming at improving the openness and portability of the TV, reducing the development difficulty of the TV, and enhancing the practicability of the product.
为了实现发明目的,本发明提供一种集成电视应用模块的方法,包括以下步骤:In order to achieve the purpose of the invention, the present invention provides a method for integrating TV application modules, comprising the following steps:
创建获取按键事件的线程;Create a thread to get the key event;
按所述线程获取按键事件;Obtain the button event according to the thread;
判断所述按键事件的类型,所述类型包括有效按键事件和有效按键事件;Judging the type of the key event, the type includes an effective key event and an effective key event;
根据判断结果过滤无效按键事件,将有效按键事件传递给应用模块,以供应用模块执行相应操作。The invalid key event is filtered according to the judgment result, and the valid key event is delivered to the application module for the application module to perform corresponding operations.
优选地,所述创建获取按键事件的线程之前还包括:设置通信方式,其中,所述通信方式至少包括以下的一种:有名管道通信、共享内存通信和socket通信;Preferably, before creating the thread for obtaining the button event, it also includes: setting a communication method, wherein the communication method includes at least one of the following: well-known pipe communication, shared memory communication and socket communication;
所述将有效按键事件传递给应用模块具体为:将所述有效按键事件按所设置的通信方式传递至应用模块。The transmitting the effective key event to the application module specifically includes: transmitting the effective key event to the application module according to the set communication mode.
优选地,所述根据判断结果过滤无效按键事件,将有效按键事件传递给应用模块包括:Preferably, said filtering the invalid key event according to the judgment result, and passing the valid key event to the application module includes:
当所述按键事件的类型为无效按键时,传递空值给应用模块;When the type of the button event is an invalid button, pass a null value to the application module;
当所述按键事件的类型为有效按键时,传递键值给应用模块。When the type of the key event is a valid key, the key value is passed to the application module.
优选地,在执行所述将有效按键事件传递给应用模块的步骤后还包括:Preferably, after performing the step of delivering the valid key event to the application module, the method further includes:
当退出应用进程或者待机按键按下时,退出获取按键事件的线程。When exiting the application process or pressing the standby button, exit the thread that gets the button event.
优选地,所述应用进程为浏览器,所述通信方式为有名管道通信;所述根据判断结果过滤无效按键事件,将有效按键事件传递给应用模块具体包括:Preferably, the application process is a browser, and the communication method is well-known channel communication; the filtering of invalid key events according to the judgment result, and passing the valid key events to the application module specifically includes:
在写管道成功打开前,当按键事件为待机按键时,进入待机状态;Before the write pipe is successfully opened, when the key event is a standby key, enter the standby state;
在写管道成功打开后,把有效按键事件写入所述有名管道,以供浏览器从所述有名管道接收有效按键事件。After the write pipe is successfully opened, write the effective key event into the well-known pipe, so that the browser can receive the effective key event from the well-known pipe.
本发明还提供一种集成电视应用模块的装置,用于实现上述方法,所述装置包括后台管理进程模块,所述后台管理进程模块包括:The present invention also provides a device for integrating TV application modules, which is used to implement the above method, the device includes a background management process module, and the background management process module includes:
按键事件线程创建单元,用于创建获取按键事件的线程;The button event thread creation unit is used to create a thread for obtaining the button event;
按键事件获取单元,用于按所述线程获取按键事件;A key event acquiring unit, configured to acquire key events according to the thread;
判断单元,用于判断所述按键事件的类型,所述类型包括有效按键事件和有效按键事件;A judging unit, configured to judge the type of the key event, the type including a valid key event and a valid key event;
键值传递单元,用于根据判断结果过滤无效按键事件,将有效按键事件传递给应用模块,以供应用模块执行相应操作。The key-value transmission unit is used for filtering invalid key-press events according to the judgment result, and transmitting valid key-press events to the application module for the application module to perform corresponding operations.
优选地,所述后台管理进程模块还包括通信单元,用于设置通信方式,其中,所述通信方式至少包括以下的一种:有名管道通信、共享内存通信和socket通信;Preferably, the background management process module further includes a communication unit for setting a communication mode, wherein the communication mode includes at least one of the following: well-known pipe communication, shared memory communication and socket communication;
所述键值传递单元具体用于将有效按键事件按所设置的通信方式传递至应用模块。The key-value transfer unit is specifically configured to transfer valid key-press events to the application module according to the set communication mode.
优选地,所述键值传递单元具体用于:Preferably, the key-value transfer unit is specifically used for:
当所述按键事件的类型为无效按键时,传递空值给应用模块;When the type of the button event is an invalid button, pass a null value to the application module;
当所述按键事件的类型为有效按键时,传递键值给应用模块。When the type of the key event is a valid key, the key value is passed to the application module.
优选地,所述后台管理进程模块还包括:Preferably, the background management process module also includes:
按键事件控制单元,用于当退出应用进程或者待机按键按下时,退出获取按键事件的线程。The key event control unit is used for exiting the thread for obtaining the key event when the application process is exited or the standby key is pressed.
优选地,所述应用进程为浏览器,所述通信方式为有名管道通信;所述键值传递单元包括浏览器处理子单元,该浏览器处理子单元具体用于:Preferably, the application process is a browser, and the communication method is a well-known pipe communication; the key-value transfer unit includes a browser processing subunit, and the browser processing subunit is specifically used for:
在写管道成功打开前,当按键事件为待机按键时,进入待机状态;Before the write pipe is successfully opened, when the key event is a standby key, enter the standby state;
在写管道成功打开后,把有效按键事件写入所述有名管道,以供浏览器从所述有名管道接收有效按键事件。After the writing pipeline is successfully opened, the effective key event is written into the well-known pipeline, so that the browser can receive the effective key event from the well-known pipeline.
本发明通过后台管理进程来管理电视终端应用模块的应用进程,由后台创建获取按键事件的线程,通过该线程实时获取按键事件,并过滤无效按键,将有效按键传递给应用进程。保持应用进程独立性,使应用的开发变得更加简捷,产品的开放性和可移植性更强,从而提高了开发效率,有效的降低了开发成本。本发明通过获取按键事件的线程为应用进程屏蔽无效按键,只转发有效按键,节省了资源利用,提高程序的运行速度,便于修改、移植,增强了产品的实用性。The present invention manages the application process of the TV terminal application module through the background management process, creates a thread for obtaining button events in the background, obtains the button events in real time through the thread, filters invalid buttons, and passes valid buttons to the application process. Maintaining the independence of the application process makes the development of the application easier, and the product is more open and portable, thereby improving the development efficiency and effectively reducing the development cost. The invention shields the invalid keys for the application process by acquiring the thread of the key event, and only forwards the valid keys, which saves resource utilization, improves the running speed of the program, facilitates modification and transplantation, and enhances the practicability of the product.
附图说明 Description of drawings
图1为本发明集成电视应用模块的方法一实施例流程示意图;Fig. 1 is a schematic flow chart of an embodiment of a method for integrating a TV application module according to the present invention;
图2为本发明集成电视应用模块的装置一实施例结构示意图。FIG. 2 is a schematic structural diagram of an embodiment of a device for integrating a TV application module according to the present invention.
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization of the purpose of the present invention, functional characteristics and advantages will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
具体实施方式 Detailed ways
本发明实施例中,应用模块包括浏览器、widget和播放器。以下将以浏览器这一应用模块为例,详细说明本发明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In the embodiment of the present invention, the application module includes a browser, a widget and a player. The following will take the application module of the browser as an example to describe the present invention in detail. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.
参照图1,图1为本发明集成电视应用模块的方法一实施例流程示意图,具体包括以下步骤:Referring to Fig. 1, Fig. 1 is a schematic flow chart of an embodiment of a method for integrating a TV application module according to the present invention, which specifically includes the following steps:
步骤S10,创建获取按键事件的线程;本发明实施例中,首先用户通过点击系统软件平台的图标后,后台启动管理进程browser_daemon,并且后台将该图标所代表的应用模块的信息参数argv传递至管理进程browser_daemon。其中,该管理进程browser_daemon包括一获取按键事件的线程,当遥控器有按键事件产生时,后台可通过该线程获取到对应的按键键值。具体的,可调用函数pthread_create(&eventThreaId,NULL,key_event,NULL),其中,第一个参数为指向线程标识符的指针,第二个参数用来设置线程属性,第三个参数是线程运行函数的起始地址,最后一个参数是运行函数的参数。应当说明的是,在执行步骤S10之前,还需配置相关的系统参数,例如,后台在管理进程browser_daemon创建获取按键事件的线程前设置相关环境变量。具体的,在开始进入browser_daemon进程,接收上述参数argv后,根据该argv参数在setConfig函数中调用setenv函数,设置相关环境变量。环境变量包括浏览器的字体库路径、lib库路径、分辨率以及鼠标模式还是焦点模式等。通过设置环境变量,浏览器启动的时候,会去相关的路径下寻找库,呈现对应的分辨率和模式状态,建立软连接,获取当前电视的UserID等信息。Step S10, create a thread for obtaining key press events; in the embodiment of the present invention, firstly, after the user clicks the icon of the system software platform, the background starts the management process browser_daemon, and the background transmits the information parameter argv of the application module represented by the icon to the management Process browser_daemon. Wherein, the management process browser_daemon includes a thread for obtaining key event, when the remote controller has a key event, the background can obtain the corresponding key value through this thread. Specifically, the function pthread_create(&eventThreaId, NULL, key_event, NULL) can be called, where the first parameter is a pointer to the thread identifier, the second parameter is used to set the thread attribute, and the third parameter is the thread running function The starting address, and the last parameter is the parameter to run the function. It should be noted that, before step S10 is performed, relevant system parameters need to be configured, for example, relevant environment variables are set in the background before the management process browser_daemon creates a thread for acquiring key press events. Specifically, after starting to enter the browser_daemon process and receiving the above parameter argv, call the setenv function in the setConfig function according to the argv parameter to set the relevant environment variables. Environment variables include the browser's font library path, lib library path, resolution, and mouse mode or focus mode. By setting the environment variable, when the browser starts, it will search for the library in the relevant path, display the corresponding resolution and mode status, establish a soft connection, and obtain the UserID and other information of the current TV.
步骤S20,按所述线程获取按键事件;当遥控按键,或者是电视机上的按键按下时,由后台按所创建的按键事件的线程获取按键的键值。Step S20, obtain the button event according to the thread; when the remote control button or the button on the TV is pressed, the key value of the button is obtained by the background according to the created button event thread.
步骤S30,判断上述按键事件的类型是否为有效按键,如判断结果为是,则转向步骤S40,否则转向步骤S50;判断所述按键事件的类型,所述类型包括有效按键事件和有效按键事件;具体的,该按键事件的类型包括有效按键和无效按键,并且按键的有效性是相对于应用模块来定义的,根据应用模块的不同按键的有效性则不同。例如,本实施例中,应用模块为浏览器,对于浏览器而言,有效按键就是对浏览器起作用的按键,如方向键、待机键或者菜单键,而颜色键、信源等相关不起作用的按键则为无效按键。Step S30, judging whether the type of the above-mentioned key event is an effective key, if the judgment result is yes, then turn to step S40, otherwise turn to step S50; judge the type of the key event, the type includes an effective key event and an effective key event; Specifically, the type of the key event includes a valid key and an invalid key, and the validity of the key is defined relative to the application module, and the validity of the key varies according to the application module. For example, in this embodiment, the application module is a browser. For the browser, effective keys are keys that work on the browser, such as direction keys, standby keys or menu keys, and color keys, information sources, etc. are not relevant. The active key is an invalid key.
步骤S40,当上述按键事件的类型为有效按键时,将所述按键事件传递给应用模块,以供应用模块执行相应操作;Step S40, when the type of the above-mentioned key event is a valid key, transfer the key event to the application module for the application module to perform corresponding operations;
步骤S50,当上述按键事件的类型为无效按键时,过滤所述按键事件。Step S50, when the type of the above key event is an invalid key, filter the key event.
具体地,对于浏览器而言,当后台获取到相关的按键事件后,首先判断按键的键值对浏览器是否能起作用,如果起作用,则将按键的键值传递给浏览器,如果不起作用,则直接将按键屏蔽。Specifically, for the browser, after the relevant key event is acquired in the background, it first judges whether the key value of the key can work for the browser, and if it works, then passes the key value of the key to the browser, if not If it works, then directly shield the button.
本发明通过后台来管理电视终端应用模块的应用进程,由后台创建获取按键事件的线程,通过该线程实时获取按键事件,并过滤无效按键,将有效按键传递给应用进程。保持应用进程独立性,使应用的开发变得更加简捷,产品的开放性和可移植性更强,从而提高了开发效率,增强了产品的实用性,并有效的降低了开发成本。The present invention manages the application process of the TV terminal application module through the background, creates a thread for obtaining button events in the background, obtains the button events in real time through the thread, filters invalid buttons, and passes valid buttons to the application process. Maintaining the independence of the application process makes the development of the application easier, and the product is more open and portable, thereby improving the development efficiency, enhancing the practicability of the product, and effectively reducing the development cost.
具体的,在执行步骤S10之前还包括:Specifically, before performing step S10, it also includes:
设置通信方式;该通信方式为应用模块与后台之间的通信方式,该通信方式可包括有名管道通信、共享内存通信和socket通信,所述应用模块包括:浏览器、widget应用及播放器,此外还可包括其他应用软件,此处对此不作限制。其中,有名管道通信应用于浏览器与后台的通信;共享内存通信用于widget应用与后台;socket通信用于播放器与后台。Set the communication mode; the communication mode is the communication mode between the application module and the background, the communication mode may include well-known pipeline communication, shared memory communication and socket communication, and the application module includes: browser, widget application and player, in addition Other application software may also be included, which is not limited here. Among them, the well-known pipeline communication is used for the communication between the browser and the background; the shared memory communication is used for the widget application and the background; the socket communication is used for the player and the background.
将所述有效按键事件按所设置的通信方式传递至应用模块;优选地,所述应用模块为浏览器,所述通信方式为有名管道通信,即后台通过设置有名管道的通信方式与浏览器进行通信,将获取的有效按键键值传递给浏览器,浏览器将根据该键值执行跳转、加载或退出等操作。The effective button event is delivered to the application module according to the set communication method; preferably, the application module is a browser, and the communication method is a well-known channel communication, that is, the background communicates with the browser by setting a well-known channel communication mode. Communication, pass the obtained effective key value to the browser, and the browser will perform operations such as jumping, loading or exiting according to the key value.
上述步骤S40具体包括:Above-mentioned step S40 specifically comprises:
当所述按键事件的类型为有效按键时,传递键值给应用模块;即当按键事件为有效按键时,后台传递按键的键值至应用模块,以供应用模块根据键值调整应用进程的进程状态。例如,相对于浏览器而言的有效按键,包括方向按键、数字按键及待机按键,浏览器根据键值执行相应移动焦点、页面跳转或退出浏览器等操作。When the type of the key event is a valid key, transfer the key value to the application module; that is, when the key event is a valid key, the background transfers the key value of the key to the application module, so that the application module can adjust the process of the application process according to the key value state. For example, the effective keys relative to the browser include direction keys, number keys, and standby keys, and the browser performs corresponding operations such as moving the focus, page jump, or exiting the browser according to the key values.
进一步的,当退出应用进程或者待机按键按下时,退出获取按键事件的线程;如在执行退出浏览器或待机操作时,获取按键事件线程中的线程退出标志的值改为真值,退出获取按键事件的线程,并使电视机返回主菜单界面或者退出所有进程进入待机状态。Further, when the application process is exited or the standby button is pressed, exit the thread that obtains the button event; if the exit browser or standby operation is performed, the value of the thread exit flag in the thread that obtains the button event is changed to a true value, and the exit obtains The thread of the button event, and make the TV return to the main menu interface or exit all processes and enter the standby state.
当所述按键事件的类型为无效按键时,传递空值给应用模块。即相对于浏览器而言,当按键事件的类型为无效按键时,传递一个空值给浏览器,继续获取按键信息。When the type of the key event is an invalid key, a null value is passed to the application module. That is, relative to the browser, when the type of the key event is an invalid key, a null value is passed to the browser to continue obtaining key information.
以下结合浏览器,对前述通信方式作进一步的说明。本发明实施例中,对于浏览器采用的是有名管道通信的通信方式,那么后台创建获取按键事件的线程将把遥控按键事件写入管道,浏览器进程从管道读取DFB(distributedfeedback,分布反馈)事件并转换为SDL(Digital Simulation Language,数字仿真语言)事件,执行相应移动焦点、页面跳转、或退出浏览器等操作。有名管道是以FIFO(First In First Out,先进先出)的文件形式存在于文件系统中的,其通信是半双工的(一端只写不读,另一端只读不写),写入的内容每次都添加在管道缓冲区的末尾,并且每次都是从缓冲区的头部读出数据。其读管道与写管道存在依赖性,必须先打开读管道,才能成功打开写管道。一旦读管道关闭,打开写管道就会失败。例如,可调用open函数打开管道,获取open函数返回值,如果返回是0,则表示管道已经成功打开,如果小于0,则管道打开失败,当管道成功打开后再调用write函数往管道写数据。The aforementioned communication methods will be further described below in conjunction with the browser. In the embodiment of the present invention, what adopt for browser is the communication mode of well-known pipeline communication, then the background creates the thread that obtains the button event and will write the remote control button event into the pipeline, and the browser process reads DFB (distributedfeedback, distributed feedback) from the pipeline Events are converted into SDL (Digital Simulation Language, digital simulation language) events, and operations such as moving the focus, page jumping, or exiting the browser are performed accordingly. The well-known pipe exists in the file system in the form of FIFO (First In First Out) file, and its communication is half-duplex (one end can only write but not read, and the other end can only read but not write). Content is added to the end of the pipe buffer each time, and data is read from the head of the buffer each time. There is a dependency between the read pipe and the write pipe, and the read pipe must be opened before the write pipe can be successfully opened. Once the read pipe is closed, opening the write pipe fails. For example, the open function can be called to open the pipe, and the return value of the open function can be obtained. If the return value is 0, it means that the pipe has been successfully opened. If it is less than 0, the pipe has failed to open. After the pipe is successfully opened, call the write function to write data to the pipe.
具体的,在写管道成功打开前,将除待机按键外的所有按键均视为无效按键,等待写管道的打开。当待机按键按下时,将退出标志的值改为1,并直接退出所有进程,电视机进入待机状态。Specifically, before the write pipeline is successfully opened, all keys except the standby key are regarded as invalid keys, and the write pipeline is waited for to be opened. When the standby button is pressed, the value of the exit flag is changed to 1, and all processes are directly exited, and the TV enters the standby state.
在写管道成功打开后,判断按键类型,将有效按键的键值写入有名管道中,浏览器从有名管道接收有效按键事件,执行相应移动焦点、页面跳转、或退出浏览器等操作。即当浏览器启动完成,在写管道成功打开后,将进入循环获取遥控按键事件,过滤无效按键,并将有效按键的键值写入上述有名管道中。该有效键可包括待机键、方向键、数字键。为保证事件的完整性,将遥控按键的按下和弹起两个事件都写入管道,设置标志位,启动浏览器后,标志位初始化为0,进入获取按键事件循环函数。一旦浏览器退出或者待机的时候,退出标志为1。获取按键事件循环函数循环判断标志的是否为1,如果是1,则退出事件循环并退出获取按键事件的线程,关闭写管道,释放创建获取按键事件的线程时的dfb和buffer资源。例如,当浏览器为退出操作或按键为待机按键时,将退出标志的值改为1,退出获取按键事件的线程,并直接退出所有进程,使电视机进入待机状态;当判断其为其他有效按键时,将通过调用write函数往有名管道写入按键的键值;当其为无效按键时,将通过调用write函数往有名管道写入空白值。浏览器从有名管道接收有效按键事件,执行相应移动焦点、页面跳转操作,并继续获取相关的按键事件。After the writing pipeline is successfully opened, determine the key type, write the key value of the valid key into the well-known pipeline, and the browser receives the valid key event from the well-known pipeline, and performs corresponding operations such as moving the focus, jumping to the page, or exiting the browser. That is, when the browser is started, after the write pipeline is successfully opened, it will enter a loop to obtain remote control key events, filter invalid keys, and write the key values of valid keys into the above-mentioned well-known pipeline. The effective keys may include a standby key, an arrow key, and a number key. In order to ensure the integrity of the event, both the press and pop-up events of the remote control button are written into the pipeline, and the flag bit is set. After starting the browser, the flag bit is initialized to 0, and enters the get button event loop function. Once the browser exits or is on standby, the exit flag is 1. Obtain the button event loop function loop to judge whether the flag is 1, if it is 1, exit the event loop and exit the thread for obtaining the key event, close the writing pipeline, and release the dfb and buffer resources when creating the thread for obtaining the key event. For example, when the browser is an exit operation or the button is a standby button, change the value of the exit flag to 1, exit the thread that obtains the button event, and directly exit all processes, so that the TV enters the standby state; when it is judged to be other effective When a key is pressed, the key value of the key will be written to the well-known pipe by calling the write function; when it is an invalid key, a blank value will be written to the well-known pipe by calling the write function. The browser receives valid key events from the well-known channel, performs corresponding operations of moving the focus and page jump, and continues to obtain related key events.
应当说明的是,在本发明实施例中,有效按键和无效按键的区分是根据实际应用模块而定的,比如说,当打开的应用模块是浏览器的时颜色键可定义为无效键,而打开的应用模块是播放器的时候颜色键则定义为有效键。It should be noted that, in the embodiment of the present invention, the distinction between valid keys and invalid keys depends on the actual application module. For example, when the opened application module is a browser, the color key can be defined as an invalid key, while When the opened application module is a player, the color key is defined as an effective key.
本发明实施例可以为应用进程屏蔽无效按键且与应用进程相互独立,只转发有效按键,便于修改、移植,保持了应用进程的独立性。The embodiment of the present invention can shield invalid keys for the application process and is independent of the application process, and only forwards valid keys, which is convenient for modification and transplantation, and maintains the independence of the application process.
本发明还提供一种集成电视应用模块的装置,可以实现上述方法。参照图2,图2为本发明集成电视应用模块的装置一实施例结构示意图,包括后台管理进程模块10和应用模块20。该后台进程模块10包括按键事件线程创建单元101、按键事件获取单元102、判断单元103及键值传递单元104。上述方法的后台可以为本发明实施例中的后台管理进程模块10。其中,The present invention also provides a device for integrating TV application modules, which can realize the above method. Referring to FIG. 2 , FIG. 2 is a structural diagram of an embodiment of a device integrating TV application modules according to the present invention, including a background management process module 10 and an application module 20 . The background process module 10 includes a key event thread creation unit 101 , a key event acquisition unit 102 , a judgment unit 103 and a key value transfer unit 104 . The background of the above method may be the background management process module 10 in the embodiment of the present invention. in,
按键事件线程创建单元101,用于创建获取按键事件的线程;本发明实施例中,首先用户通过点击系统软件平台的图标后,后台启动管理进程browser_daemon,并且后台将该图标所代表的应用模块的信息参数argv传递至管理进程browser_daemon。其中,该管理进程browser_daemon包括由按键事件线程创建单元101创建的获取按键事件的线程,当遥控器有按键事件产生时,后台管理进程模块10可通过该线程获取到对应的按键键值。具体的,可调用函数pthread_create(&eventThreaId,NULL,key_event,NULL),其中,第一个参数为指向线程标识符的指针,第二个参数用来设置线程属性,第三个参数是线程运行函数的起始地址,最后一个参数是运行函数的参数。应当说明的是,在按键事件线程创建单元101创建获取按键事件的线程之前,还需配置相关的系统参数,例如,按键事件线程创建单元101在管理进程browser_daemon中创建获取按键事件的线程前设置相关环境变量。具体的,在开始进入browser_daemon进程,接收上述参数argv后,根据该argv参数在setConfig函数中调用setenv函数,设置相关环境变量。环境变量包括浏览器的字体库路径、lib库路径、分辨率以及鼠标模式还是焦点模式等。通过设置环境变量,浏览器启动的时候,会去相关的路径下寻找库,呈现对应的分辨率和模式状态,建立软连接,获取当前电视的UserID等信息。The button event thread creation unit 101 is used to create a thread for obtaining the button event; in the embodiment of the present invention, firstly, after the user clicks the icon of the system software platform, the background starts the management process browser_daemon, and the background starts the management process browser_daemon, and the background of the application module represented by the icon The information parameter argv is passed to the management process browser_daemon. Wherein, the management process browser_daemon includes a key event acquisition thread created by the key event thread creation unit 101. When a key event occurs on the remote control, the background management process module 10 can obtain the corresponding key value through this thread. Specifically, the function pthread_create(&eventThreaId, NULL, key_event, NULL) can be called, where the first parameter is a pointer to the thread identifier, the second parameter is used to set the thread attribute, and the third parameter is the thread running function The starting address, and the last parameter is the parameter to run the function. It should be noted that before the key event thread creation unit 101 creates the thread for obtaining the key event, related system parameters need to be configured. For example, the key event thread creation unit 101 sets the related environment variables. Specifically, after starting to enter the browser_daemon process and receiving the above parameter argv, call the setenv function in the setConfig function according to the argv parameter to set the relevant environment variables. Environment variables include the browser's font library path, lib library path, resolution, and mouse mode or focus mode. By setting the environment variable, when the browser starts, it will search for the library in the relevant path, display the corresponding resolution and mode status, establish a soft connection, and obtain the UserID and other information of the current TV.
按键事件获取单元102,用于按所述线程获取按键事件;当遥控按键,或者是电视机上的按键按下时,由后台按所创建的按键事件的线程获取案件的键值。The button event acquisition unit 102 is used to acquire the button event according to the thread; when the remote control button or the button on the TV is pressed, the key value of the case is obtained by the thread of the button event created by the background.
判断单元103,用于判断所述按键事件的类型是否为有效按键;即判断单元103判断所述按键事件的类型,所述类型包括有效按键事件和有效按键事件;具体的,该按键事件的类型包括有效按键和无效按键,并且按键的有效性是相对于应用模块20来定义的,根据应用模块20的不同按键的有效性则不同。例如,对于浏览器而言,有效按键就是对浏览器起作用的按键,如方向键、待机键或者菜单键,而颜色键、信源等相关不起作用的按键则为无效按键。The judging unit 103 is used to judge whether the type of the key event is a valid key; that is, the judging unit 103 judges the type of the key event, and the type includes an effective key event and an effective key event; specifically, the type of the key event It includes valid keys and invalid keys, and the validity of the keys is defined relative to the application module 20, and the validity of different keys according to the application module 20 is different. For example, for a browser, valid keys are keys that have an effect on the browser, such as direction keys, standby keys or menu keys, while color keys, information sources and other related keys that do not work are invalid keys.
键值传递单元104,当判断单元103判断所述按键事件的类型为有效按键时,将有效按键事件传递给应用模块20,以供应用模块20执行相应操作;当判断单元103判断所述按键事件的类型为无效按键时,过滤此无效按键事件。具体的,对于浏览器而言,当后台获取到相关的按键事件后,首先判断按键的键值对浏览器是否能起作用,如果起作用,则将按键的键值传递给浏览器,如果不起作用,则直接将按键屏蔽。The key value transfer unit 104, when the judging unit 103 judges that the type of the key event is a valid key, the valid key event is passed to the application module 20, so that the application module 20 performs a corresponding operation; when the judging unit 103 judges that the key event When the type of is an invalid key, filter this invalid key event. Specifically, for the browser, when the relevant key event is obtained in the background, it first judges whether the key value of the key can work for the browser. If it works, the key value of the key is passed to the browser. If it works, then directly shield the button.
本发明通过后台管理进程模块10来管理电视终端应用模块20的应用进程,由按键事件线程创建单元101创建获取按键事件的线程,通过该线程实时获取按键事件,并过滤无效按键,将有效按键传递给应用进程。保持应用进程独立性,应用的开发变得更加简捷,使产品的开放性和可移植性更强,从而提高了开发效率,增强了产品的实用性,并有效的降低了开发成本。The present invention manages the application process of the TV terminal application module 20 through the background management process module 10, creates a thread for obtaining the key event by the key event thread creation unit 101, obtains the key event in real time through the thread, and filters invalid keys, and passes valid keys to the application process. Maintaining the independence of the application process makes the application development easier and makes the product more open and portable, thereby improving the development efficiency, enhancing the practicability of the product, and effectively reducing the development cost.
进一步的,台管理进程模块10包中还包括:Further, the platform management process module 10 package also includes:
通信单元105,用于设置通信方式。该通信方式为应用模块20与后台管理进程模块10之间的通信方式,该通信方式包括有名管道通信、共享内存通信和socket通信,所述应用模块包括:浏览器、widget应用及播放器,此外还可包括其他应用软件,此处对此不作限制。其中,有名管道通信应用于浏览器与后台管理进程模块的通信;共享内存通信用于widget应用与后台管理进程通信模块;socket通信用于播放器与后台管理进程模块通信。The communication unit 105 is configured to set a communication mode. The communication method is the communication method between the application module 20 and the background management process module 10, and the communication method includes well-known pipeline communication, shared memory communication and socket communication, and the application module includes: browser, widget application and player, in addition Other application software may also be included, which is not limited here. Among them, the well-known pipeline communication is used for the communication between the browser and the background management process module; the shared memory communication is used for the communication between the widget application and the background management process module; the socket communication is used for the communication between the player and the background management process module.
按键传递单元104具体是通过通信单元105所设置的通信方式将有效按键事件传递给应用模块20。优选地,所述应用模块为浏览器,所述通信方式为有名管道通信。本发明实施例中,后台管理进程模块10通过通信单元105设置的有名管道通信方式与浏览器进行通信,将获取的有效按键键值传递给浏览器,浏览器将根据该键值执行跳转、加载或退出等操作。The key transmission unit 104 specifically transmits the effective key event to the application module 20 through the communication mode set by the communication unit 105 . Preferably, the application module is a browser, and the communication method is well-known channel communication. In the embodiment of the present invention, the background management process module 10 communicates with the browser through the well-known channel communication mode provided by the communication unit 105, and passes the obtained valid key value to the browser, and the browser will execute jump, operations such as loading or exiting.
键值传递单元104具体用于:The key-value transfer unit 104 is specifically used for:
当所述按键事件的类型为有效按键时,传递键值给应用模块20;即当按键事件为有效按键时,后台管理进程模块10将按键的键值传递给应用模块20,应用模块20根据键值调整应用进程的进程状态。例如,相对于浏览器而言的有效按键,包括方向按键、数字按键及待机按键,浏览器根据键值执行相应移动焦点、页面跳转或退出浏览器等操作。When the type of the key event is an effective key, the key value is passed to the application module 20; that is, when the key event is an effective key, the background management process module 10 passes the key value of the key to the application module 20, and the application module 20 according to the key The value adjusts the process state of the application process. For example, the effective keys relative to the browser include direction keys, number keys, and standby keys, and the browser performs corresponding operations such as moving the focus, page jump, or exiting the browser according to the key values.
进一步的,后台管理进程模块10还包括按键事件控制单元106,用于当退出应用进程或者待机按键按下时,退出获取按键事件的线程。如在执行退出浏览器或待机操作时,获取按键事件线程中的线程退出标志的值改为真值退出获取按键事件的线程,并使电视机返回主菜单界面或者退出所有进程进入待机状态。Further, the background management process module 10 also includes a key event control unit 106, configured to exit the thread for obtaining the key event when the application process is exited or the standby key is pressed. For example, when exiting the browser or standby operation, change the value of the thread exit sign in the key event thread to a true value to exit the thread for key event acquisition, and make the TV return to the main menu interface or exit all processes and enter the standby state.
当所述按键事件的类型为无按键时,传递空值给应用模块20。即相对于浏览器而言,当按键事件的类型为无效按键时,传递一个空值给浏览器,继续获取按键信息。When the type of the key event is no key, a null value is passed to the application module 20 . That is, relative to the browser, when the type of the key event is an invalid key, a null value is passed to the browser to continue obtaining key information.
以下结合浏览器,对按键传递单元104中的浏览器处理子单元具体的作用作进一步说明。本发明实施例中,对于浏览器采用的是有名管道通信的通信方式,那么后台创建获取按键事件的线程将把遥控按键事件写入管道,浏览器进程从管道读取DFB事件并转换为SDL事件,执行相应移动焦点、页面跳转、或退出浏览器等操作。有名管道是以FIFO的文件形式存在于文件系统中的,其通信是半双工的(一端只写不读,另一端只读不写),写入的内容每次都添加在管道缓冲区的末尾,并且每次都是从缓冲区的头部读出数据。其读管道与写管道存在依赖性,必须先打开读管道,才能成功打开写管道。一旦读管道关闭,打开写管道就会失败。例如,可调用open函数打开管道,获取open函数返回值,如果返回是0,则表示管道已经成功打开,如果小于0,则管道打开失败,当管道成功打开后再调用write函数往管道写数据。The specific function of the browser processing subunit in the key transfer unit 104 will be further described below in combination with the browser. In the embodiment of the present invention, what the browser adopts is the communication mode of well-known pipe communication, then the background creates and obtains the thread of button event and will write the remote control button event into the pipe, and the browser process reads the DFB event from the pipe and converts it into an SDL event , perform operations such as moving the focus, page jump, or exiting the browser. The well-known pipe exists in the file system in the form of a FIFO file, and its communication is half-duplex (one end can only write but not read, and the other end can only read but not write), and the written content is added to the pipe buffer every time. At the end, and each time the data is read from the head of the buffer. There is a dependency between the read pipe and the write pipe, and the read pipe must be opened before the write pipe can be successfully opened. Once the read pipe is closed, opening the write pipe fails. For example, the open function can be called to open the pipe, and the return value of the open function can be obtained. If the return value is 0, it means that the pipe has been successfully opened. If it is less than 0, the pipe has failed to open. After the pipe is successfully opened, call the write function to write data to the pipe.
具体的,在写管道成功打开前,将除待机按键外的所有按键均视为无效按键,等待写管道打开。当待机按键按下时,将退出标志的值改为1,并直接退出所有进程,并且电视机进入待机状态。Specifically, before the write pipe is successfully opened, all keys except the standby key are regarded as invalid keys, and the write pipe is waited for to be opened. When the standby button is pressed, the value of the exit flag is changed to 1, and all processes are directly exited, and the TV enters the standby state.
在写管道成功打开后,判断按键类型,将有效按键的键值写入有名管道中,浏览器从有名管道接收有效按键事件,执行相应移动焦点、页面跳转、或退出浏览器等操作。即当浏览器启动完成,在写管道成功打开后,将进入循环获取遥控按键事件,过滤无效按键,并将有效按键的键值写入上述有名管道中。该有效键可包括待机键、方向键、数字键。为保证事件的完整性,将遥控按键的按下和弹起两个事件都写入管道,设置标志位,启动浏览器后,标志位初始化为0,进入获取按键事件循环函数。一旦浏览器退出或者待机的时候,退出标志为1。获取按键事件循环函数循环判断标志的是否为1,如果是1,则退出事件循环并退出获取按键事件的线程,关闭写管道,释放创建获取按键事件的线程时的dfb和buffer资源。例如,当浏览器为退出操作或按键为待机按键时,由按键事件控制单元106将退出标志的值改为1,退出获取按键事件的线程,并直接退出所有进程,使电视机进入待机状态;当判断其为其他有效按键时,将通过调用write函数往有名管道写入按键的键值;当其为无效按键时,将通过调用write函数往有名管道写入空白值。浏览器从有名管道接收有效按键事件,执行相应移动焦点、页面跳转操作,并继续获取相关按键事件。After the writing pipeline is successfully opened, determine the key type, write the key value of the valid key into the well-known pipeline, and the browser receives the valid key event from the well-known pipeline, and performs corresponding operations such as moving the focus, jumping to the page, or exiting the browser. That is, when the browser is started, after the write pipeline is successfully opened, it will enter a loop to obtain remote control key events, filter invalid keys, and write the key values of valid keys into the above-mentioned well-known pipeline. The effective keys may include a standby key, an arrow key, and a number key. In order to ensure the integrity of the event, both the press and pop-up events of the remote control button are written into the pipeline, and the flag bit is set. After starting the browser, the flag bit is initialized to 0, and enters the get button event loop function. Once the browser exits or is on standby, the exit flag is 1. Obtain the button event loop function loop to judge whether the flag is 1, if it is 1, exit the event loop and exit the thread for obtaining the key event, close the writing pipeline, and release the dfb and buffer resources when creating the thread for obtaining the key event. For example, when the browser is an exit operation or the key is a standby key, the key event control unit 106 changes the value of the exit flag to 1, exits the thread for obtaining the key event, and directly exits all processes, so that the TV enters the standby state; When it is judged to be another valid key, the key value of the key will be written to the well-known pipe by calling the write function; when it is an invalid key, a blank value will be written to the well-known pipe by calling the write function. The browser receives valid key events from the well-known channel, performs corresponding operations of moving the focus and page jump, and continues to obtain related key events.
本发明实施例可以为应用进程屏蔽无效按键且与应用进程相互独立,只转发有效按键,便于修改、移植,保持了应用进程的独立性。The embodiment of the present invention can shield invalid keys for the application process and is independent of the application process, and only forwards valid keys, which is convenient for modification and transplantation, and maintains the independence of the application process.
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process conversion made by using the description of the present invention and the contents of the accompanying drawings, or directly or indirectly used in other related technical fields , are all included in the scope of patent protection of the present invention in the same way.
Claims (8)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110437438.2A CN102541549B (en) | 2011-12-23 | 2011-12-23 | The method of integration television application module and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110437438.2A CN102541549B (en) | 2011-12-23 | 2011-12-23 | The method of integration television application module and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102541549A CN102541549A (en) | 2012-07-04 |
CN102541549B true CN102541549B (en) | 2015-08-19 |
Family
ID=46348523
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110437438.2A Expired - Fee Related CN102541549B (en) | 2011-12-23 | 2011-12-23 | The method of integration television application module and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102541549B (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103384348B (en) * | 2013-05-29 | 2016-09-14 | 深圳市艾龙电子有限公司 | A kind of GINGA digital TV middleware implementation method on embedded digital TV platform |
CN103488486B (en) * | 2013-09-25 | 2017-11-03 | 深圳Tcl新技术有限公司 | browser button processing method and device |
CN105812859B (en) * | 2014-12-29 | 2019-02-26 | Tcl集团股份有限公司 | A data processing method and system for a module TV input event |
CN105812948B (en) * | 2014-12-30 | 2019-04-02 | 深圳Tcl数字技术有限公司 | Response control method and device for input event |
CN105681862A (en) * | 2016-03-11 | 2016-06-15 | 四川长虹电器股份有限公司 | Television system multifunctional application and remote-control key operation compatible method |
CN106101837B (en) * | 2016-07-15 | 2019-07-12 | 四川长虹电器股份有限公司 | The method of more applications keys distribution and processing for Linux smart television |
CN106162282B (en) * | 2016-07-26 | 2020-02-07 | Tcl集团股份有限公司 | Method and device for forbidding keys of intelligent television input equipment |
CN111049975A (en) * | 2019-11-27 | 2020-04-21 | 厦门亿联网络技术股份有限公司 | Key operation processing method and device of SIP phone and terminal equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101212604A (en) * | 2007-12-25 | 2008-07-02 | 康佳集团股份有限公司 | Invalid TV set control instruction prompting method |
CN101645023A (en) * | 2009-09-14 | 2010-02-10 | 青岛海信宽带多媒体技术有限公司 | Method and device for solving the delayed response of embedded system |
CN101729414A (en) * | 2009-11-24 | 2010-06-09 | 北京雷霆万钧网络科技有限责任公司 | Data transmission method and system based on response of user request information |
CN101753880A (en) * | 2008-12-08 | 2010-06-23 | 深圳创维数字技术股份有限公司 | Digital TV terminal and button locking/unlocking method and system thereof |
-
2011
- 2011-12-23 CN CN201110437438.2A patent/CN102541549B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101212604A (en) * | 2007-12-25 | 2008-07-02 | 康佳集团股份有限公司 | Invalid TV set control instruction prompting method |
CN101753880A (en) * | 2008-12-08 | 2010-06-23 | 深圳创维数字技术股份有限公司 | Digital TV terminal and button locking/unlocking method and system thereof |
CN101645023A (en) * | 2009-09-14 | 2010-02-10 | 青岛海信宽带多媒体技术有限公司 | Method and device for solving the delayed response of embedded system |
CN101729414A (en) * | 2009-11-24 | 2010-06-09 | 北京雷霆万钧网络科技有限责任公司 | Data transmission method and system based on response of user request information |
Also Published As
Publication number | Publication date |
---|---|
CN102541549A (en) | 2012-07-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102541549B (en) | The method of integration television application module and device | |
CN101699405B (en) | Method and device for interaction between host program and plug-in and interaction between plug-ins | |
US20150067536A1 (en) | Gesture-based Content Sharing Between Devices | |
CN103345405A (en) | Application program starting method and device and client | |
CN102915113A (en) | Method and apparatus for supporting data input | |
CN109308241A (en) | Method, device, terminal device and storage medium for monitoring application startup process | |
CN114860205B (en) | Application extension system, method and device of low-code development platform | |
CN103796058A (en) | Method for achieving control over Android smart television based on virtual input equipment | |
CN111143017B (en) | Cloud operation system interaction processing method, client and cloud operation system | |
US20150138085A1 (en) | Electronic apparatus for simulating or interfacing a backward compatible human input device by means or control of a gesture recognition system | |
CN108347452A (en) | Method and device for remotely obtaining screenshots | |
CN110442819A (en) | Data processing method, device, storage medium and terminal | |
CN106843975B (en) | Method and device for extending HTML5 application function | |
CN101673194B (en) | Device and method for processing user notification message by using same | |
CN113325980B (en) | Control method, control device, electronic equipment and readable storage medium | |
CN105657551A (en) | Method and apparatus used by smart television to respond to analog key | |
US9753741B2 (en) | Remote inking | |
CN108984024A (en) | Touch operation method and device, storage medium and electronic equipment | |
CN114490323A (en) | Test method, device and electronic equipment for terminal equipment | |
CN114070892A (en) | Data transmission method and device | |
CN108737337A (en) | Equipment processing method, device, server and system | |
CN107391354A (en) | The method and system of automatic monitoring terminal performance, storage device | |
CN106095741B (en) | Control the method and system of PPT insertion object | |
CN100419711C (en) | A service debugging command transmitter and its processing method | |
TW201537441A (en) | Method for changing user interface to be a Skype dedicated interface and computer program product thereof and handheld electronic device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20150819 |