123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517 |
- /*****************************************************************************
- ** 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 <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <types.h>
- #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
|