aw_app.h

来自「AMLOGIC DPF source code」· C头文件 代码 · 共 400 行 · 第 1/2 页

H
400
字号
 * @brief Register an Application and it's customize code
 * Register an Application task and it's stub function to application manager(Amlogic Window Control Center[AWCC]), 
 * the Application can be called and receive message only it have been reigstered. The application
 * is associate with a media type,like DVD-Video, VCD, CDDA,etc. When user call this function to 
 * registed an application, that's means we should support the media type and get the customize 
 * function.
 * @param [in] media_type Define the media source type this application support, which told 
 * the Control Center to run this application when it detect the new source.Like MEDIA_DVD_VIDEO, MEDIA_CDDA.
 * @param [in] app_init_status The initial status of this application after register, should be 
 * APP_IDLE if this media need detected by system. Otherwise should be APP_READY, like meida 
 * MEDIA_TUNER, it's always ready if we support this application.
 * @param [in] auto_priority Define the run priority of this application, when there are two or 
 * more medias found at the same time, Control center will use this parameter to decide which 
 * application run first. 1 is lowest, 255 should be highest. 0 means this application 
 * don't support auto run feature.
 * @param [in] input_priority If there are two or more app running, this parameter decide the 
 * input message(like key_press) will send to which application stub first, 0 is lowest, 
 * 255 should be highest.	
 * @param [in] task_priority Control center will use this parameter as task priority to 
 * create a new task when running this application. 1 is highest, 64 should be lowest.
 * @param [in] memmap Control center will use this parameter get this application's memory map data.
 * @param [in] stack_size Control center will use this parameter to malloc stack_size * 4 
 * byte memory for this application as its stack.
 * @param [in] MsgProcess This application's customize code, the stub function of this 
 * application, which is a customize interface for this application, Control center will send 
 * input message(like key_press) to it and show some hint on screen.
 * @param [in] GetAppInfo A interface of application which will return some static information 
 * of this media type content when the application not running.
 * @param [in] AppTask The main function of this application, will used to created as a 
 * task when running this application.
 */
INT32S AWApplicationRegister(INT32U media_type,INT8U app_init_status, INT8U auto_priority, INT8U input_priority, INT8U task_priority,
         INT8U memmap, INT16U stack_size, APPMSGPROCESS MsgProcess, APPGETINFO GetAppInfo, APPTASKFUNCTION AppTask) ;

/**
 * @brief Call this function to get a special application ID.
 * Get application's ID according to the media type. Application which registered will 
 * assign a system ID, which is a unique number for message send and receive between Control 
 * Center and Applications.
 * @param [in] app_source_type AWGetAppID will seek the application according this parameter, 
 * which is a type of media we support.
 * @param [out] app_id return the ID of application if found, otherwise return 0xff.
 * @return Return success or fail.
 * @retval 0 success.
 * @retval 1 failure.
 */
INT32S AWGetAppID(INT32U app_source_type,INT8U *app_id) ;

/**
 * @brief Get the message queue of the application, which will receive all message which 
 * sended to this application.
 * @param [in] app_id it's the ID of application which you want to get its message queue.
 * @return Return the application's message queue if app_id is a legle, otherwise return NULL.
 */
OS_EVENT* AWGetAppMsgQueue(INT8U app_id) ;

/**
 * @brief Get the system Post Event handle of special application, which used to wake up 
 * a block event the application wait for.
 * @param [in] app_id it's the ID of application which you want to get its Event handle.
 * @return Return the application's Event handle if app_id is a legle, otherwise return NULL.
 */
AVSysEvent_t AWGetAppPostEventHandle(INT8U app_id) ;

/**
 * @brief Get the application's stauts.
 * @param [in] app_id it's the ID of application which you want to get its status.
 * @return If the app_id is a valid ID, return the application's status. Otherwise return 0xff.
 * @retval APP_IDLE The application not ready, cannot be run.
 * @retval APP_READY Application is ready(have the meida data), can be run anytime.
 * @retval APP_RUNNING Application running now.
 *
 * Example:
 *
 * //call this function to run DVD-Video disc 
 *INT32S PlayDVDVideo(AWMSG *pMsg)
 *{
 *	INT8U app_id ;
 *	if(!AWGetAppID("MEDIA_DVD_VIDEO", &app_id)) //get the DVD-Video application's ID
 *	{
 *		if(AWGetAppStatus(app_id) == APP_READY){ //DVD-Video is ready
 *			AWAppRunning(app_id) ; //run the DVD-Video
 *			return 0;
 *		}
 *	}
 *	return 1;
 *}
 *
 * See Also
 * AWAppReady, AWAppRunning, AWAppSchedule
 */
INT8U AWGetAppStatus(INT8U app_id) ;

/**
 * @brief The main function of application manager(Application control center).
 */
void AWWinMain(void *opt) ;                     

/**
 * @brief Call this function to run a aplication which status is APP_READY.
 * Call this function to run a special application if there are not any application running
 * and some application support auto run feature(the auto_priority is non-zero when you register
 * the application). It will select an application to run which is ready and have highest 
 * auto_priority in all ready applications.
 */
void AWAppSchedule(void) ;

/**
 * @brief Call this function to set application's stauts.
 * @param [in] app_id It's the ID of application which you want to set its status.
 * @param [in] new_status The new status of application.
 * @return Return success or fail.
 * @retval 0 success.
 * @retval 1 failure.
 */
void AWSetAppStatus(INT8U app_id, INT8U new_status);

/**
 * @brief Call this function to set the application's status to APP_READY when we found a new media data.
 * @param [in] app_id It's the ID of application which you want to set its status.
 * @return Return success or fail.
 * @retval 0 success.
 * @retval 1 failure.
 */
INT32S AWAppReady(INT8U app_id) ;

/**
 * @brief Call this function to run the application and set its status to APP_RUNNING.
 * @param [in] app_id It's the ID of application which you want to run it.
 * @return Return success or fail.
 * @retval 0 success.
 * @retval 1 failure.
 */
INT32S AWAppRunning(INT8U app_id) ;

/**
 * @brief Get the application's argument. 
 * You should call this function at the begining of your application, and set some private 
 * parameters to the application's argument member.
 * @param [in] media_type we seek the application argument according it.
 * @return Return the point of application's argument if we support the media,
 * otherwise return NULL.
 */
PAPPTASKARG AWGetAppArg(INT32U media_type) ;

/**
 * @brief Call this function to told the application quit.
 * @param [in] app_id It's the ID of application which will quit.
 */
void AWCloseRunningApp(INT8U app_id);

/**
 * @brief Call this function to told all running application quit before power off or sleep.
 */
void AWCloseAllRunningApp() ;

/**
 * @brief Call this function to add a system event to application manager's event subscriber.
 * @param [in] event_id the event ID which will connect to the cb.
 * @param [in] cb the call back function if the event ID is posted by some task.
 * @param [in] cb_arg the argument of cb.
 * @return Return success or fail.
 * @retval 0 success.
 * @retval 1 failure. 
 */
INT32S AWAddGUIEvent(INT32U event_id,void (*cb)(INT32U), INT32U cb_arg);

/**
 * @brief Call this function to get all running media type.
 * @return Return all running media.
 */
INT32U AWGetCurrentRunningMedia(void);

/**
 * @brief According input media types to close the corresponding applications if the 
 * applcation is running.
 * @param [in] media_type the medias which want to close.
 * @return Return success or fail.
 * @retval 0 success.
 * @retval 1 failure. 
 */
INT32S AWCloseRunningMedia(INT32U media_type) ;

void AWSetDevUpdateStatus(INT8U enable_flag) ;

extern INT8U gStopFordwordInput ;
extern INT8U gAWGUIAppID ;
extern APPTASKARG gAppAgrs[MAX_APP_NUM] ;

#define STOP_FORDWARD_INPUT_KEY    { gStopFordwordInput =1 ; }

/**
 * @brief Create application control task. The first task we should create which will control whole 
 * system.
 * @return Return created task id.
 */
unsigned short AWWinMainStart(void) ;

#endif //end of _AW_APP_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?