- #include <gendef.h>
- #include <system.h>
- #include <ir.h>
- #include <flash.h>
- #include <keydef.h>
- #include <osp.h>
- #include <timer.h>
- #include <osd.h>
- #include <av.h>
- #include <string.h>
- #include "dmd.h"
- #include "dmx.h"
- #include "sipsi.h"
- #include "search.h"
- #include "epg.h"
- #include "appltype.h"
- #include "avplay.h"
- #include "eprom.h"
- #include "db.h"
- #include "kb_machblue_client.h"
- #include "kb_machblue_client_task.h"
- #include "kb_dc_task.h"
- static STB_State gStbState = State_AV;
- static UINT32 gAppQueID = 0;
- //static void IR_CallBack(UINT32 pressed, UINT32 keyID);
- static void STB_SendMsg(KB_OSPMsgNode *pInMsg);
- static void SI_CallBack(KB_OSPMsgNode *pInMsg);
- void DMD_CallBack(KB_DMDCallbackEvents event);
- static void APPTIMER_CallBack(KB_OSPMsgNode *pInMsg);
- extern void E2P_Test(void);
- extern BOOL RcKeyboardProcessSetup ( void );
- extern void LED_Init(void);
- extern void KB_SysPowerInit(void);
- //swf模块测试
- extern void KB_SWF_INIT(void);
- extern void kb_dc_ServCfgGetActivate(void);
- int main()
- {
- KB_SysInit();
- KB_OSPInit();
- KB_E2PInit();
- KB_FLASHInit();
- KB_TimerInit();
- KB_DMDInit();
- KB_DMDCallBack(DMD_CallBack);
- KB_OSDInit();
- KB_DBInit();
- KB_SIInit();
- KB_SICallback(SI_CallBack);
- SRTIM_Init();
- KB_TimeInit();
- KB_TimerCallBack(APPTIMER_CallBack);
- RcKeyboardProcessSetup();
- KB_EPGInit();
- KB_NVODInit();
- KB_SEARCHInit();
- KB_CAInit();
- KB_DTVInit();
- LED_Init();
- KB_SysPowerInit();
- //OTA_CLIENT_Init();
- KB_NETInit();
- KB_TimeSetCurTime((time_t)10000);
- //swf模块测试接口
- KB_SWF_INIT();
- //Machblue 模块初始化
- kb_machblue_task_init();
- kb_machblue_client_init();
- kb_dc_init();
- //KB_WatchTaskInit();
- KB_DcTaskInit();
- KB_OSPTaskDelay(1000);
- kb_dc_ServCfgGetActivate();
- KB_OSPTaskSetPri(NULL, 0);
- KB_OSPTaskSus(NULL);
- return (0);
- }
- void DMD_CallBack(KB_DMDCallbackEvents event)
- {
- KB_OSPMsgNode msgNode;
- msgNode.Word1 = MOD_TUNER;
- msgNode.Word2 = event;
- STB_SendMsg(&msgNode);
- }
- STB_State KB_GetCurState(void)
- {
- return gStbState;
- }
- UINT32 KB_RegQueID(UINT32 nQueueId)
- {
- UINT32 nCurQueID;
- nCurQueID = gAppQueID;
- gAppQueID = nQueueId;
- return nCurQueID;
- }
- INT32 STB_StateSwitch(INT32 nApplet)
- {
- INT32 nPreviousApplet;
- if(nApplet < State_MAX)
- {
- nPreviousApplet = gStbState;
- switch (nPreviousApplet)
- {
- case State_AV:
- if (nApplet != State_EPG)
- {
- KB_DTVDestroy();
- }
- break;
- case State_EPG:
- KB_EPGDestroy();
- break;
- case State_MENU:
- break;
- case State_NVOD:
- KB_NVODDestroy();
- break;
- case State_SRCH:
- KB_SEARCHDestroy();
- KB_DCStart_Service();
- break;
- default:
- break;
- }
- gStbState = nApplet;
- switch (nApplet)
- {
- case State_AV:
- KB_DTVCreate();
- break;
- case State_EPG:
- KB_EPGCreate();
- break;
- case State_MENU:
- break;
- case State_NVOD:
- KB_NVODCreate();
- break;
- case State_SRCH:
- KB_DCStop_Service();
- KB_OSPTaskDelay(500);
- KB_SEARCHCreate();
- break;
- default:
- break;
- }
- }
- else
- {
- return RETFIAL1;
- }
- return RETOK;
- }
- static void STB_SendMsg(KB_OSPMsgNode *pInMsg)
- {
- switch (gStbState)
- {
- case State_AV:
- KB_DTVAVHandleMsg(pInMsg);
- break;
- case State_EPG:
- KB_EPGHandleMsg(pInMsg);
- break;
- case State_MENU:
- //printf("nSTB_SendMsg::Word1(%d), Word2(%d)",
- // pInMsg->Word1, pInMsg->Word2);
- //增加对当前时间获取设置的处理
- if (MOD_SIPSI == pInMsg->Word1 && KB_SI_MSG_TDT_DONE == pInMsg->Word2)
- {
- KB_TimeSetCurTime(*((time_t*)pInMsg->Word3));
- }
- break;
- case State_NVOD:
- NVOD_HandleMsg(pInMsg);
- break;
- case State_SRCH:
- KB_SEARCHHandleMsg(pInMsg);
- break;
- default:
- break;
- }
- }
- static void SI_CallBack(KB_OSPMsgNode *pInMsg)
- {
- STB_SendMsg(pInMsg);
- }
- static void APPTIMER_CallBack(KB_OSPMsgNode *pInMsg)
- {
- KB_OSPMsgNode msgNode;
- if (gAppQueID)
- {
- KB_OSPMsgSend(gAppQueID, pInMsg);
- }
- }
- /* EOF */