123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- /*****************************************************************************
- ** File: main_app.h
- **
- ** Description:
- **
- ** Copyright(c) 2008 Sunmedia Technologies - All Rights Reserved
- **
- ** Author : qin.he
- **
- ** $Id: $
- *****************************************************************************/
- #ifndef MAIN_APP_H_
- #define MAIN_APP_H_
- /*header file*/
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <types.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include "gl_types.h"
- #include "gobj_datastruct.h"
- #include "sysapp_if.h"
- /*macro define*/
- #define MAIN_APP_STACK_SIZE 4096
- /*Return Message definition*/
- #define MAIN_APP_OPERATION_FAILED (-4)
- #define MAIN_APP_INSTANCE_NOT_INITIALIZED (-3)
- #define MAIN_APP_OBJECT_CREATE_FAILED (-2)
- #define MAIN_APP_INVALID_SYSTEM_APP (-1)
- #define MAIN_APP_SUCCESS 0
- #define MAIN_APP_INSTANCE_ALREADY_EXIST 1
- #define MAIN_APP_NO_ACTIVE_SYSTEM_APP 2
- #define MAIN_APP_INDEX_ERROR 3
- #define MAIN_APP_TERMINATE_CURRENT_APP_FIRST 4
- #define MAIN_APP_SYSTEM_APP_ALREADY_RUNNING 5
- #define MAIN_APP_ACTIVATE_FAILED 6
- #define MAIN_APP_TERMAINATE_FAILED 7
- #define MAIN_APP_IN_TRANSITION 8
- /*Internal use definition.*/
- #define MAIN_APP_SYSTEM_APP_NOT_SELECTED (-1)
- /*Main App state*/
- #define MAIN_APP_SYSTEM_APP_ON_TRANSITION (1)
- #define MAIN_APP_NORMAL (2)
- #define MAIN_APP_INITIALIZING (3)
- #define MAIN_APP_RISC_ALIVE_STANDBY (4)
- /*data structure define*/
- extern GL_Queue_t MainAppQueueHandle;
- /*Function pointer declearation.*/
- typedef int (*MainAppFunc) (void);
- typedef int (*MainAppMsgHandler) (UINT32 dMessage, UINT32 dParam);
- typedef struct MainApp_InitCfg_t_
- {
- ifunc6 pfInitFlow;
- GUI_Object_Definition_t ** pGUIObjectTable;
- MainAppFunc pfOnTimerUpdate;
- MainAppMsgHandler pfOnEvent;
- } MainApp_InitCfg_t;
- typedef enum{
- MAINAPP_AWAKE = 0,
- MAINAPP_STANDBY = 1
- }StandByMode;
- /*****************************************************************************
- ** FUNCTION : MAINAPP_Initialize
- **
- ** DESCRIPTION :
- ** Initialize main app
- **
- ** PARAMETERS :
- ** pstMainAppInit: main app init config parameter
- **
- ** RETURN VALUES:
- ** MAIN_APP_INSTANCE_NOT_INITIALIZED: main app already initialized
- ** MAIN_APP_OBJECT_CREATE_FAILED: main app initialize failed
- ** MAIN_APP_SUCCESS: main app initialize success
- *****************************************************************************/
- int MAINAPP_Initialize(MainApp_InitCfg_t *pstMainAppInit);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_Finalize
- **
- ** DESCRIPTION :
- ** Finalize main app
- **
- ** PARAMETERS :
- ** None
- **
- ** RETURN VALUES:
- ** MAIN_APP_INSTANCE_NOT_INITIALIZED: main app not initialized
- ** MAIN_APP_SUCCESS: main app finalize success
- *****************************************************************************/
- int MAINAPP_Finalize(void);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_SendGlobalEvent
- **
- ** DESCRIPTION :
- ** Send globle event to main app
- **
- ** PARAMETERS :
- ** dMessage: globle event
- ** dParam: event's paramter
- **
- ** RETURN VALUES:
- ** MAIN_APP_INSTANCE_NOT_INITIALIZED: main app not is initialize
- ** SYSTEM_APP_QUEUE_ERROR: send message failed
- ** MAIN_APP_SUCCESS: send message success
- *****************************************************************************/
- int MAINAPP_SendGlobalEvent(UINT32 dMessage, UINT32 dParam);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_GetMainAppState
- **
- ** DESCRIPTION :
- ** Get main app state
- **
- ** PARAMETERS :
- ** dState: main app state value
- **
- ** RETURN VALUES:
- ** MAIN_APP_INSTANCE_NOT_INITIALIZED: main app not is initialize
- ** MAIN_APP_SUCCESS: get main app state success
- *****************************************************************************/
- int MAINAPP_GetMainAppState(UINT32 * dState);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_GetActiveSystemAppIndex
- **
- ** DESCRIPTION :
- ** Get active system app index
- **
- ** PARAMETERS :
- ** dIndex: active system app index
- **
- ** RETURN VALUES:
- ** MAIN_APP_INSTANCE_NOT_INITIALIZED: main app not is initialize
- ** MAIN_APP_IN_TRANSITION: main app in transition state
- ** MAIN_APP_NO_ACTIVE_SYSTEM_APP: not active system app
- ** MAIN_APP_SUCCESS: get actvie system app success
- *****************************************************************************/
- int MAINAPP_GetActiveSystemAppIndex(UINT32 * dIndex);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_ActivateSystemApp
- **
- ** DESCRIPTION :
- ** Main app active system app
- **
- ** PARAMETERS :
- ** dSystemIndex: system app index
- ** dParam: system app on run paramter
- **
- ** RETURN VALUES:
- ** MAIN_APP_INSTANCE_NOT_INITIALIZED: main app not is initialize
- ** MAIN_APP_SYSTEM_APP_ALREADY_RUNNING: system app already running
- ** MAIN_APP_IN_TRANSITION: main app in transition state
- ** MAIN_APP_INDEX_ERROR: system app index error
- ** MAIN_APP_SUCCESS: active system app success
- *****************************************************************************/
- int MAINAPP_ActivateSystemApp(UINT32 dSystemIndex, UINT32 dParam);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_TerminateSystemApp
- **
- ** DESCRIPTION :
- ** Main app terminate system app
- **
- ** PARAMETERS :
- ** dSystemIndex: system app index
- ** dParam: system app on terminate paramter
- **
- ** RETURN VALUES:
- ** MAIN_APP_INSTANCE_NOT_INITIALIZED: main app not is initialize
- ** MAIN_APP_SYSTEM_APP_ALREADY_RUNNING: system app already running
- ** MAIN_APP_IN_TRANSITION: main app in transition state
- ** MAIN_APP_INDEX_ERROR: system app index error
- ** MAIN_APP_SUCCESS: terminate system app success
- *****************************************************************************/
- int MAINAPP_TerminateSystemApp(UINT32 dSystemIndex, UINT32 dParam);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_SwitchSystemApp
- **
- ** DESCRIPTION :
- ** Main app switch system app
- **
- ** PARAMETERS :
- ** dSystemIndex: system app index
- ** dParam1: system app on terminate paramter
- ** dParam2: system app on run paramter
- **
- ** RETURN VALUES:
- ** MAIN_APP_INSTANCE_NOT_INITIALIZED: main app not is initialize
- ** MAIN_APP_SYSTEM_APP_ALREADY_RUNNING: system app already running
- ** MAIN_APP_IN_TRANSITION: main app in transition state
- ** MAIN_APP_INDEX_ERROR: system app index error
- ** MAIN_APP_SUCCESS: Switch system app success
- *****************************************************************************/
- int MAINAPP_SwitchSystemApp(UINT32 dSystemIndex, UINT32 dParam1, UINT32 dParam2);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_FinalizeSystemApp
- **
- ** DESCRIPTION :
- ** Main app finalize system app
- **
- ** PARAMETERS :
- ** dSystemIndex: system app index
- ** dParam: system app on terminate paramter
- **
- ** RETURN VALUES:
- ** MAIN_APP_INSTANCE_NOT_INITIALIZED: main app not is initialize
- ** MAIN_APP_SYSTEM_APP_ALREADY_RUNNING: system app already running
- ** MAIN_APP_IN_TRANSITION: main app in transition state
- ** MAIN_APP_INDEX_ERROR: system app index error
- ** MAIN_APP_SUCCESS: finalize system app success
- *****************************************************************************/
- int MAINAPP_FinalizeSystemApp(UINT32 dSystemIndex);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_IsEnteringStandby
- **
- ** DESCRIPTION :
- ** get system standby mode
- **
- ** PARAMETERS :
- ** StandyMode: standby mode value
- **
- ** RETURN VALUES:
- ** MAIN_APP_INSTANCE_NOT_INITIALIZED: main app not is initialize
- ** MAIN_APP_SUCCESS: get system standby mode success
- *****************************************************************************/
- int MAINAPP_IsEnteringStandby(StandByMode* StandyMode);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_GetRuningState
- **
- ** DESCRIPTION :
- ** Get main app is running state
- **
- ** PARAMETERS :
- ** None
- **
- ** RETURN VALUES:
- ** bMainAppRunning: main app running state value
- *****************************************************************************/
- UINT8 MAINAPP_GetRuningState(void);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_RegisterFunc
- **
- ** DESCRIPTION :
- ** Register function
- **
- ** PARAMETERS :
- ** APP_MessageDisposeStart: Message dispose function start
- ** APP_MessageDisposeEnd: Message dispose function end
- **
- ** RETURN VALUES:
- ** None
- *****************************************************************************/
- void MAINAPP_RegisterFunc(ifunc10 APP_MessageDisposeStart, ifunc10 APP_MessageDisposeEnd);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_MessageDisposeStart
- **
- ** DESCRIPTION :
- ** main app and system app message dispose start function
- **
- ** PARAMETERS :
- ** pdMessage: message
- ** pdParam: message param
- **
- ** RETURN VALUES:
- ** None
- *****************************************************************************/
- void MAINAPP_MessageDisposeStart(UINT32* pdMessage, UINT32* pdParam);
- /*****************************************************************************
- ** FUNCTION : MAINAPP_MessageDisposeEnd
- **
- ** DESCRIPTION :
- ** main app and system app message dispose end function
- **
- ** PARAMETERS :
- ** pdMessage: message
- ** pdParam: message param
- **
- ** RETURN VALUES:
- ** None
- *****************************************************************************/
- void MAINAPP_MessageDisposeEnd(UINT32* pdMessage, UINT32* pdParam);
- #endif
|