/***************************************************************************** ** File: sysapp_if.c ** ** Description: ** ** Copyright(c) 2008 Sunmedia Technologies - All Rights Reserved ** ** Author : qin.he ** ** $Id: $ *****************************************************************************/ #ifndef _SYSTEM_APPLICATION_IF_UTILITIES_H #define _SYSTEM_APPLICATION_IF_UTILITIES_H /*header file*/ #include #include #include #include #include "gobj_datastruct.h" #include "gl_types.h" /*macro define*/ #define SYSTEM_APP_STACK_SIZE 6144 #define SYSTEM_APP_INSTANCE_NOT_EXISTS 1 /*System Status*/ #define SYSTEM_IDLE 0 #define SYSTEM_RUNNING 1 /*System app clear queue flag*/ #define SYSTEM_QUEUE_COUNT (5+1)/*Urgent(5)+Normal(1)*/ #define SYSTEM_CLEAR_UI_EVENT (1<<0) #define SYSTEM_CLEAR_TIMER_EVENT (1<<1) #define SYSTEM_CLEAR_GLOBLE_OTHER_EVENT (1<<2) #define SYSTEM_CLEAR_FW_EVENT (1<<3) #define SYSTEM_CLEAR_SYSAPP2_CLEAN_EVENT (1<<4) #define SYSTEM_CLEAR_GLOBLE_MASK_EVENT \ SYSTEM_CLEAR_UI_EVENT|\ SYSTEM_CLEAR_TIMER_EVENT|\ SYSTEM_CLEAR_GLOBLE_OTHER_EVENT|\ SYSTEM_CLEAR_FW_EVENT|\ SYSTEM_CLEAR_SYSAPP2_CLEAN_EVENT #define SYSTEM_CLEAR_RELEASE_UI_EVENT (1<<5) #define SYSTEM_CLEAR_RELEASE_TIMER_EVENT (1<<6) #define SYSTEM_CLEAR_RELEASE_GLOBLE_OTHER_EVENT (1<<7) #define SYSTEM_CLEAR_RELEASE_MASK_EVENT \ SYSTEM_CLEAR_RELEASE_UI_EVENT|\ SYSTEM_CLEAR_RELEASE_TIMER_EVENT|\ SYSTEM_CLEAR_RELEASE_GLOBLE_OTHER_EVENT #define SYSTEM_CLEAR_INTERNAL_EVENT (1<<8) #define SYSTEM_CLEAR_MASK_EVENT \ SYSTEM_CLEAR_GLOBLE_MASK_EVENT|\ SYSTEM_CLEAR_RELEASE_MASK_EVENT|\ SYSTEM_CLEAR_INTERNAL_EVENT /*End*/ /*Message definition*/ #define SYSTEM_APP_ACTIVATE_ACK 0x1020 #define SYSTEM_APP_TERMINATE_ACK 0x1040 #define SYSTEM_APP_TRANSITION_FAILED 0x1080 #define SYSTEM_APP_TRANSITION_TIMEOUT 0x1090 #define SYSTEM_APP_DISCPLAYER_PRIORITY (APP_SYSTEM_OS_PRIORITY_BASE) #define SYSTEM_APP_FILEPLAYER_PRIORITY (APP_SYSTEM_OS_PRIORITY_BASE) /*sysapp function pointer return value.*/ #define SYSTEM_APP_SUCCESFUL 0 #define SYSTEM_APP_ONTERMINATE_FAILED (-2) #define SYSTEM_APP_ONRUN_FAILED (-1) /*data structure define*/ typedef enum { SYSTEM_APP_GUIOBJ_CREATE_FAILED = (-8), SYSTEM_APP_TASK_CREATE_FAILED = (-7), SYSTEM_APP_QUEUE_ERROR = (-6), SYSTEM_APP_PARAM_ERROR = (-5), SYSTEM_APP_STATE_ERROR = (-4), SYSTEM_APP_DATA_ERROR = (-3), SYSTEM_APP_INIT_ERROR = (-2), SYSTEM_APP_INDEX_ERROR = (-1), SYSTEM_APP_SUCCESS = 0, SYSTEM_APP_INSTNACE_EXIST = 1, SYSTEM_APP_NO_FOCUSED_GUIOBJ = 2, SYSTEM_APP_NO_GUIOBJ = 3, SYSTEM_APP_ERROR_CODE_MAX } sys_app_errorcode_t; /*Function pointer declearation.*/ typedef int (*SysAppPPFuncPtr) (void** ppPrivateData); typedef int (*SysAppFuncPtr) (void *pPrivateData); typedef int (*SysAppFuncPtrParam) (void *pPrivateData, UINT32 dParam); typedef int (*SysAppMsgHandler) (void *pPrivateData, UINT32 dMessage, UINT32 dParam); typedef struct SystemApplicationInstance_t_ { UINT32 dSystemApplicationIndex; SysAppPPFuncPtr fpOnCreate; /*Initialize function pointer.*/ SysAppPPFuncPtr fpOnDestroy; /*Finalize function pointer.*/ SysAppFuncPtrParam fpOnRun; /*Function pointer to handle idle to active state.*/ SysAppFuncPtrParam fpOnTerminate; /*Function pointer to handle active to idle state.*/ SysAppFuncPtr fpOnTimerUpdate; /*Function pointer to handle timer event. (called every 100 ms)*/ SysAppMsgHandler fpOnEvent; /*Function pointer to handle incoming message.*/ UINT8 bAppState; /*System app state*/ GUI_Object_Definition_t **pGUIObjectTable; /*GUI object table*/ UINT32 dGUITableSize; void *stSystemAppInfrastructure; /*Infrastructure to the system app.*/ void *stAppSpecificData; /*Pointer to system application specific data structure.*/ } SysAppInstDef; void SYSAPP_GOBJ_Set_OSDLOCK(BOOL osdlock); BOOL SYSAPP_GOBJ_Get_OSDLOCK(void); /***************************************************************************** ** FUNCTION : SYSAPP_IF_Initialize ** ** DESCRIPTION : ** Initialize system app module ** ** PARAMETERS : ** dTotalSysApp: system app total number ** pSysAppTable: system app define ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_SUCCESS: Initialize system app module success *****************************************************************************/ int SYSAPP_IF_Initialize(UINT32 dTotalSysApp, SysAppInstDef** pSysAppTable); /***************************************************************************** ** FUNCTION : SYSAPP_IF_InitializeSysApp ** ** DESCRIPTION : ** Initialize one system app ** ** PARAMETERS : ** dSystemAppID: system app index ** MainAppQHdl: main app queue handle ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_INSTNACE_EXIST: this system app have initialized ** SYSTEM_APP_SUCCESS: Initialize system app success *****************************************************************************/ int SYSAPP_IF_InitializeSysApp(UINT32 dSystemAppID, GL_Queue_t MainAppQHdl); /***************************************************************************** ** FUNCTION : SYSAPP_IF_Finalize ** ** DESCRIPTION : ** Finalize one system app ** ** PARAMETERS : ** dSystemAppID: system app index ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_QUEUE_ERROR: Finalize system app failed ** SYSTEM_APP_SUCCESS: Initialize system app success *****************************************************************************/ int SYSAPP_IF_Finalize(UINT32 dSystemAppID); /***************************************************************************** ** FUNCTION : SYSAPP_IF_Activate ** ** DESCRIPTION : ** active system app ** ** PARAMETERS : ** dSystemAppID: system app index ** dParam: system app on run paramter ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_QUEUE_ERROR: Active system app failed ** SYSTEM_APP_SUCCESS: Active system app success *****************************************************************************/ int SYSAPP_IF_Activate(UINT32 dSystemAppID, UINT32 dParam); /***************************************************************************** ** FUNCTION : SYSAPP_IF_Terminate ** ** DESCRIPTION : ** terminate system app ** ** PARAMETERS : ** dSystemAppID: system app index ** dParam: system app on terminate paramter ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_QUEUE_ERROR: terminate system app failed ** SYSTEM_APP_SUCCESS: terminate system app success *****************************************************************************/ int SYSAPP_IF_Terminate(UINT32 dSystemAppID, UINT32 dParam); /***************************************************************************** ** FUNCTION : SYSAPP_IF_GetSystemAppQueueHandle ** ** DESCRIPTION : ** get system app queue handle ** ** PARAMETERS : ** dIndex: system app index ** QueueHandle: system app queue handle ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_SUCCESS: get system app queue handle success *****************************************************************************/ int SYSAPP_IF_GetSystemAppQueueHandle(UINT32 dIndex, GL_Queue_t * QueueHandle); /***************************************************************************** ** FUNCTION : SYSAPP_IF_SentInternalEvent ** ** DESCRIPTION : ** Send internal message to system app ** ** PARAMETERS : ** dSystemAppID: system app index ** dMessage: internal message ** dParam: internal message's paramter ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_QUEUE_ERROR: send internal message to system app failed ** SYSTEM_APP_SUCCESS: send internal message to system app success *****************************************************************************/ int SYSAPP_IF_SentInternalEvent(UINT8 bSystemAppIndex, UINT32 dMessage, UINT32 dParam); /***************************************************************************** ** FUNCTION : SYSAPP_IF_RetrievePrivateData ** ** DESCRIPTION : ** Retrieve private data ** ** PARAMETERS : ** dSystemAppID: system app index ** ppPrivateData: system app private data ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_INDEX_ERROR: system app index error ** SYSTEM_APP_SUCCESS: get system app private data success *****************************************************************************/ int SYSAPP_IF_RetrievePrivateData(UINT8 bSystemAppIndex, void** ppPrivateData); /***************************************************************************** ** FUNCTION : SYSAPP_IF_Activate ** ** DESCRIPTION : ** get system app running state ** ** PARAMETERS : ** stTaskHandle: system app task handle ** ** RETURN VALUES: ** false: system app not running ** true: system app running *****************************************************************************/ bool SYSAPP_IF_IsSysAppRunning(GL_Task_t stTaskHandle); /***************************************************************************** ** FUNCTION : SYSAPP_IF_ClearQueue ** ** DESCRIPTION : ** Clear system app queue ** ** PARAMETERS : ** bSystemAppIndex: system app index ** bClearFlag: clear message type ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_SUCCESS: clear system app queue success *****************************************************************************/ int SYSAPP_IF_ClearQueue(UINT8 bSystemAppIndex, UINT32 bClearFlag); /***************************************************************************** ** FUNCTION : SYSAPP_IF_GetSysAppStateByIndex ** ** DESCRIPTION : ** Clear system app state ** ** PARAMETERS : ** bSystemAppIndex: system app index ** bState: system app state ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_SUCCESS: get system app state success *****************************************************************************/ int SYSAPP_IF_GetSysAppStateByIndex(UINT8 bSystemAppIndex, UINT8* bState); /***************************************************************************** ** FUNCTION : SYSAPP_IF_SendGlobalEventWithIndex ** ** DESCRIPTION : ** Send global message to system app ** ** PARAMETERS : ** dIndex: system app index ** dMessage: global message ** dParam: global message's paramter ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_QUEUE_ERROR: send global message to system app failed ** SYSTEM_APP_SUCCESS: send global message to system app success *****************************************************************************/ int SYSAPP_IF_SendGlobalEventWithIndex(UINT32 dIndex, UINT32 dMessage, UINT32 dParam); /***************************************************************************** ** FUNCTION : SYSAPP_IF_SendCriticalGlobalEventWithIndex ** ** DESCRIPTION : ** Send global message to system app with critical ** ** PARAMETERS : ** dIndex: system app index ** dMessage: global message ** dParam: global message's paramter ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_QUEUE_ERROR: send global message to system app failed ** SYSTEM_APP_SUCCESS: send global message to system app success *****************************************************************************/ int SYSAPP_IF_SendCriticalGlobalEventWithIndex(UINT32 dIndex, UINT32 dMessage, UINT32 dParam); /***************************************************************************** ** FUNCTION : SYSAPP_IF_GetSysAppStateByIndex ** ** DESCRIPTION : ** Clear system app state ** ** PARAMETERS : ** bSystemAppIndex: system app index ** bState: system app state ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_SUCCESS: get system app state success *****************************************************************************/ int SYSAPP_GOBJ_CreateGUIObject_WithPara(UINT8 bSystemAppIndex, UINT32 dGUIObjIndex,UINT32 dParameter); int SYSAPP_GOBJ_CreateGUIObject_WithParaForLoseFocus(UINT8 bSystemAppIndex, UINT32 dGUIObjIndex,UINT32 dParameter, bool bFocusChange); /***************************************************************************** ** FUNCTION : SYSAPP_GOBJ_DestroyGUIObject ** ** DESCRIPTION : ** Destroy one gui object ** ** PARAMETERS : ** bSystemAppIndex: system app index ** dGUIObjIndex: destroy gui object index ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_SUCCESS: destroy gui object success *****************************************************************************/ int SYSAPP_GOBJ_DestroyGUIObject(UINT8 bSystemAppIndex, UINT32 dGUIObjIndex); int SYSAPP_GOBJ_DestroyGUIObject_WithFocusChange(UINT8 bSystemAppIndex, UINT32 dGUIObjIndex, bool bFocusChange); /***************************************************************************** ** FUNCTION : SYSAPP_GOBJ_DestroyAllGUIObject ** ** DESCRIPTION : ** Destroy system app's all gui object ** ** PARAMETERS : ** bSystemAppIndex: system app index ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_SUCCESS: destroy all gui objects success *****************************************************************************/ int SYSAPP_GOBJ_DestroyAllGUIObject(UINT8 bSystemAppIndex); /***************************************************************************** ** FUNCTION : SYSAPP_GOBJ_FinalizeGUIObject ** ** DESCRIPTION : ** Finalize system app's gui object ** ** PARAMETERS : ** bSystemAppIndex: system app index ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_SUCCESS: finalize gui objects success *****************************************************************************/ int SYSAPP_GOBJ_FinalizeGUIObject(UINT8 bSystemAppIndex); /***************************************************************************** ** FUNCTION : SYSAPP_GOBJ_GUIObjectExist ** ** DESCRIPTION : ** Judge one gui objext exist gui objext list ** ** PARAMETERS : ** bSystemAppIndex: system app index ** dGUIObjIndex: gui object index ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** false: gui object not exist ** true: gui object exist *****************************************************************************/ int SYSAPP_GOBJ_GUIObjectExist(UINT8 bSystemAppIndex, UINT32 dGUIObjIndex); /***************************************************************************** ** FUNCTION : SYSAPP_GOBJ_GetTotalCreatedObjects ** ** DESCRIPTION : ** Get system app total gui object ** ** PARAMETERS : ** bSystemAppIndex: system app index ** dTotalObjects: total gui object value ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error *****************************************************************************/ int SYSAPP_GOBJ_GetTotalCreatedObjects(UINT8 bSystemAppIndex, UINT32* dTotalObjects); /***************************************************************************** ** FUNCTION : SYSAPP_GOBJ_GetObjectIDByIndex ** ** DESCRIPTION : ** Get system app total gui object ** ** PARAMETERS : ** bSystemAppIndex: system app index ** dGUIObjIndex: gui object index ** dID: gui object ID ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error *****************************************************************************/ int SYSAPP_GOBJ_GetObjectIDByIndex(UINT8 bSystemAppIndex, UINT32 dGUIObjIndex, UINT32* dID); /***************************************************************************** ** FUNCTION : SYSAPP_GOBJ_SendMsgToSingleGUIObject ** ** DESCRIPTION : ** Send message to single gui object ** ** PARAMETERS : ** bSystemAppIndex: system app index ** dGUIObjIndex: gui object index ** dMessage: message ** dParam: message's paramter ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_SUCCESS: send message to gui objects success *****************************************************************************/ int SYSAPP_GOBJ_SendMsgToSingleGUIObject(UINT8 bSystemAppIndex, UINT32 dGUIObjIndex, UINT32 dMessage, UINT32 dParam); /***************************************************************************** ** FUNCTION : SYSAPP_GOBJ_DestroyPartialGUIObjects ** ** DESCRIPTION : ** Destroy Partial gui object ** ** PARAMETERS : ** bSystemAppIndex: system app index ** Indexes: destroy gui objects ** bNoOfObjs: gui objects total number ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error ** SYSTEM_APP_SUCCESS: destroy gui objects success *****************************************************************************/ int SYSAPP_GOBJ_DestroyPartialGUIObjects(UINT8 bSystemAppIndex, UINT32* Indexes, UINT8 bNoOfObjs); /***************************************************************************** ** FUNCTION : SYSAPP_GOBJ_GetLastFocusedGUIObject ** ** DESCRIPTION : ** Get last focused gui object ** ** PARAMETERS : ** bSystemAppIndex: system app index ** dLastFocusedIndex: last focused gui objext index ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error *****************************************************************************/ int SYSAPP_GOBJ_GetLastFocusedGUIObject(UINT8 bSystemAppIndex, int* dLastFocusedIndex); /***************************************************************************** ** FUNCTION : SYSAPP_GOBJ_GetFocusedGUIObject ** ** DESCRIPTION : ** Get current focused gui object ** ** PARAMETERS : ** bSystemAppIndex: system app index ** dLastFocusedIndex: current focused gui objext index ** ** RETURN VALUES: ** SYSTEM_APP_INDEX_ERROR: input paramter error *****************************************************************************/ int SYSAPP_GOBJ_GetFocusedGUIObject(UINT8 bSystemAppIndex, int* dFocusedIndex); #endif