Beispiel #1
0
HRESULT	CToolMgr::InitToolMgr(HWND hWnd)
{
	InitVariable();

	m_hWnd = hWnd;

	m_Log.AddLog(LOG_TYPE_TOOLWORK, "서버 매니저 툴 초기화 작업 시작...");

	m_WinSockMgr.InitWinSockMgr();
	m_SQLMgr.InitSQLMgr();

	m_Log.AddLog(LOG_TYPE_TOOLWORK, "서버 매니저 툴 초기화 작업 끝...");

	return S_OK;
}
Beispiel #2
0
void JMChattControl::Initialize(const Rectangle& bounds, String strYouName, Bitmap* pBitmapYouPhoto, String strMyName, Bitmap* pBitmapMyPhoto)
{
	this->Construct(bounds);


	AddTouchEventListener(*this);


	__stScreenInfo.rtScreen = this->GetBounds();


	if( __pCanvasBack == null ) {
		__pCanvasBack = new Canvas();
		__pCanvasBack->Construct(__stScreenInfo.rtScreen);
	}


	__stScreenInfo.strYouName = strYouName;
	__stScreenInfo.pBitmapYouPhoto = pBitmapYouPhoto;

	__stScreenInfo.strMyName = strMyName;
	__stScreenInfo.pBitmapMyPhoto = pBitmapMyPhoto;

	__pArrayChattData = new ArrayList();
	__pArrayChattData->Construct();


	__pArrayNeedLoadImage = new ArrayList();
	__pArrayNeedLoadImage->Construct();


	InitVariable();


	__pTimerRedraw = new Timer();
	__pTimerRedraw->Construct(*this);
	__pTimerRedraw->Start(DF_TIMER_INTERVAL_REDRAW);


	__pTimerAutoSlide = new Timer();
	__pTimerAutoSlide->Construct(*this);
}
Beispiel #3
0
void CATDtmfVts::TimerRun(TInt aError)
	{
	LOGTEXT(_L8("[Ltsy CallControl] Starting CATDtmfVts::TimerRun()"));
	
	if (aError != KErrNone)
		{
		User::After(KLtsyStopAndCancelTimeOut);
		}
	
	if (iDtmfWorkType == EDtmfStopOneTone)
		{
		iCtsyDispatcherCallback.CallbackCallControlStopDtmfToneComp(KErrNone);
		}
	else if (iDtmfWorkType == EDtmfCancelMoreTones)
		{
		iCtsyDispatcherCallback.CallbackCallControlSendDtmfTonesCancelComp(KErrNone);
		}
	
	//Init
	InitVariable();
	
	//Let other command can use I/O port
	iPhoneGlobals.iEventSignalActive = EFalse;	
	}
Beispiel #4
0
int main(int argc, char *argv[])
{
    char *pEnv;

    /*--------------------------------------------------------------------------
      중복 프로세스 체크
      ---------------------------------------------------------------------------*/
    if (dupcheckbyname(argv[0]) != 0) {
        fprintf(stderr, "oops!!! duplicated process(%s). So, exit\n", argv[0]);
        exit(0);
    }

    /*--------------------------------------------------------------------------
      시그널 등록
      ---------------------------------------------------------------------------*/
    setupSignal(vmct_signal_handler);

    /*--------------------------------------------------------------------------
      Init Environment
      ---------------------------------------------------------------------------*/
    /* get environment variable */
    if ((pEnv = getenv(BPAPP_ENV_NAME)) == NULL){
        fprintf(stderr, "'%s' environment variable not found(%s)\n", BPAPP_ENV_NAME, strerror(errno));
        exit(0);
    }

    /*--------------------------------------------------------------------------
      디버그 프린트 및 로그 초기화
      ---------------------------------------------------------------------------*/
#if 0
    InitDebug(pEnv, FMS_VMC | FMS_CLB, FMS_INFO1, DBG_TERMINAL | DBG_FILE | DBG_THIS);
#else
    InitDebug(pEnv, FMS_VMC | FMS_CLB, FMS_INFO1, DBG_FILE | DBG_THIS);
#endif

    xprint(FMS_VMC | FMS_LOOKS, "\n");
    xprint(FMS_VMC | FMS_LOOKS, "*********************************************************************\n");
    xprint(FMS_VMC | FMS_LOOKS, "     BPAPP-VMCT : START \n");
    xprint(FMS_VMC | FMS_LOOKS, "*********************************************************************\n");
    xprint(FMS_VMC | FMS_LOOKS, "\n");

    /* Init Global Variable */
    if (InitVariable() < 0) {
        xprint(FMS_VMC | FMS_FATAL, "Initialize failed, So exit\n");
        terminateLog();
        close_xprint();
        exit(0);
    }

    /* Init config from cfgFile */
    if (read_config(pEnv) < 0) {
        xprint(FMS_VMC | FMS_FATAL, "Global Configuration error, So exit\n");
        close_xprint();
        exit(0);
    }

    /* Init Mutex & MsgQCmdTmr */
    InitMutexCmdTmr();

#ifdef __DEBUG__
    DebugSizeofStruct();
    DebugVmctInfo();
    DebugVmProcessInfo();
#endif

    /*--------------------------------------------------------------------------
      pthread Create
     ---------------------------------------------------------------------------*/
    /* TCP Recv Control (HOST) */
    if (ThreadFlags[PTASK0] == FALSE) {
        pthread_attr_init(&Thread_Attr[PTASK0]);
        pthread_attr_setdetachstate(&Thread_Attr[PTASK0], PTHREAD_CREATE_DETACHED);
        pthread_create(&ThreadArray[PTASK0], &Thread_Attr[PTASK0], TcpRcvTask, NULL);
        pthread_attr_destroy(&Thread_Attr[PTASK0]);
        ThreadFlags[PTASK0] = TRUE;
    }

    /* System Info HOST Send */
    if (ThreadFlags[PTASK1] == FALSE) {
        pthread_attr_init(&Thread_Attr[PTASK1]);
        pthread_attr_setdetachstate(&Thread_Attr[PTASK1], PTHREAD_CREATE_DETACHED);
        pthread_create(&ThreadArray[PTASK1], &Thread_Attr[PTASK1], TcpSessionTask, NULL);
        pthread_attr_destroy(&Thread_Attr[PTASK1]);
        ThreadFlags[PTASK1] = TRUE;
    }

    /* Timer Cmd (TCP Reconnect) */
    if (ThreadFlags[PTASK2] == FALSE) {
        pthread_attr_init(&Thread_Attr[PTASK2]);
        pthread_attr_setdetachstate(&Thread_Attr[PTASK2], PTHREAD_CREATE_DETACHED);
        pthread_create(&ThreadArray[PTASK2], &Thread_Attr[PTASK2], TmrCmdTask, NULL);
        pthread_attr_destroy(&Thread_Attr[PTASK2]);
        ThreadFlags[PTASK2] = TRUE;
    }

    RunState = 1;

    while(RunState != 0) {
        nanoSleep(1000);
    }

    pthread_join(ThreadArray[PTASK0], NULL);
    pthread_join(ThreadArray[PTASK1], NULL);
    pthread_join(ThreadArray[PTASK2], NULL);

    return(0);
}
//复位桌子
void __cdecl CTableFrameSink::RepositTableFrameSink()
{
	InitVariable();
	return;
}
//构造函数
CTableFrameSink::CTableFrameSink()
{
	m_bIsGameEnd=false;
	InitVariable();
	return;
}
Beispiel #7
0
/*
                         Main application
 */
void main(void)
{
    uint16_t u16VoltVar;
    uint8_t u8CtrlHighCnt;
    uint8_t u8CtrlLowCnt;
    uint8_t u8SignalCnt;
    uint8_t u8VoltCnt;
    bool    bPowerIssue;
    bool    bCheckPower;
    
    // initialize the device
    SYSTEM_Initialize();
    InitVariable();
    
    u16VoltVar = 0;
    u8CtrlHighCnt = 0;
    u8CtrlLowCnt = 0;
    u8SignalCnt = 0;
    u8VoltCnt = 0;
    bPowerIssue = false;
    bCheckPower = false;

    // When using interrupts, you need to set the Global and Peripheral Interrupt Enable bits
    // Use the following macros to:

    // Enable the Global Interrupts
    INTERRUPT_GlobalInterruptEnable();

    // Enable the Peripheral Interrupts
    INTERRUPT_PeripheralInterruptEnable();

    // Disable the Global Interrupts
    //INTERRUPT_GlobalInterruptDisable();

    // Disable the Peripheral Interrupts
    //INTERRUPT_PeripheralInterruptDisable();
    
    __delay_ms(100);
    
    while (1)
    {
        if( gu8Mode != MODE_CHECK_VOLT && bPowerIssue == false )
        {
            if( bCheckPower == false )
            {
                if( gu8TMR0State & TMR0_FLAG_1S )
                {
                    gu8TMR0State &= ~TMR0_FLAG_1S;

                    u16VoltVar = 0;
                    u16VoltVar = ADC_GetVolt();
                    // 8.5V = 2250, 12V = 2850, 14V = 3200 1V ~= 170
                    if( u16VoltVar > DEF_OVP || u16VoltVar < DEF_UVP )
                    {
                        // Issue
                        u8VoltCnt = 0;
                        bCheckPower = true;
                    }
                    else
                    {
                        bPowerIssue = false;
                    }
                }
            }
            else
            {
                if( gu8TMR0State & TMR0_FLAG_10MS )
                {
                    gu8TMR0State &= ~TMR0_FLAG_10MS;
                    
                    u16VoltVar = 0;
                    u16VoltVar = ADC_GetVolt();
                    // To-Do:
                    // 8.5V = 2250, 12V = 2850, 16V = 3530 1V ~= 170
                    if( u16VoltVar > DEF_OVP || u16VoltVar < DEF_UVP )
                    {
                        u8VoltCnt++;
                        if( u8VoltCnt > 5 )
                        {
                            bPowerIssue = true;
                            bCheckPower = false;
                        }
                    }
                    else
                    {
                        u8VoltCnt = 0;
                        bCheckPower = false;
                    }
                }
            }
        }
        
        // Add your application code
        switch( gu8Mode )
        {
            case MODE_CHECK_VOLT:
                if( gu8TMR0State & TMR0_FLAG_10MS )
                {
                    gu8TMR0State &= ~TMR0_FLAG_10MS;
                    
                    u16VoltVar = 0;
                    u16VoltVar = ADC_GetVolt();
                    // To-Do:
                    // 8.5V = 2250, 12V = 2850, 16V = 3530 1V ~= 170
                    if( u16VoltVar > DEF_OVP || u16VoltVar < DEF_UVP )
                    {
                        u8VoltCnt++;
                        if( u8VoltCnt > 5 )
                        {
                            bPowerIssue = true;
                        }
                    }
                    else
                    {
                        u8VoltCnt = 0;
                        InitMotorPosition();
                    }
                }
                break;
                
            case MODE_IN_VOLT:
                break;
                
            case MODE_CHECK_CONTROL:
                if( gu8TMR0State & TMR0_FLAG_10MS )
                {
                    gu8TMR0State &= ~TMR0_FLAG_10MS;
                    u16VoltVar = 0;
                    u16VoltVar = ADC_GetVolt();
                    // To-Do:
                    // 8.5V = 2250, 12V = 2850, 16V = 3530 1V ~= 170
                    if( u16VoltVar > DEF_OVP || u16VoltVar < DEF_UVP )
                    {
                        u8VoltCnt++;
                        if( u8VoltCnt > 5 )
                        {
                            gu8Mode = MODE_CHECK_VOLT;
                        }
                    }
                    else
                    {
                        if( IO_CONTROL_GetValue() == HIGH )
                        {
                            u8CtrlHighCnt++;
                            u8CtrlLowCnt = 0;
                            if( u8CtrlHighCnt > 5 )
                            {
                                u8CtrlHighCnt = 0;
                                u8CtrlLowCnt = 0;
                                u8SignalCnt = 0;
                                gu8Mode = MODE_CONTROL_HIGH;
                            }
                        }
                        else
                        {
                            u8CtrlHighCnt = 0;
                            u8CtrlLowCnt++;
                            if( u8CtrlLowCnt > 5 )
                            {
                                u8CtrlHighCnt = 0;
                                u8CtrlLowCnt = 0;
                                u8SignalCnt = 0;
                                gu8Mode = MODE_CONTROL_LOW;
                            }
                        }
                    }
                }
                break;
                
            case MODE_CONTROL_HIGH:
                if( gu8TMR0State & TMR0_FLAG_10MS )
                {
                    gu8TMR0State &= ~TMR0_FLAG_10MS;
                    
                    IO_FEEDBACK_SetDigitalOutput();
                    if( IO_FEEDBACK_GetValue() == HIGH )
                    {
                        // C1F1
                        if( u8SignalCnt < 5 )
                        {
                            u8SignalCnt++;
                        }
                        else
                        {
                            gu8Mode = MODE_FORWARD;    // CW
                            TMR2_StartTimer();
                            TMR2_WriteTimer(0);
                            IO_CW_GREEN_SetHigh();
                        }
                    }
                    else
                    {
                        // C1F0
                        u8SignalCnt = 0;
                        u8CtrlHighCnt = 0;
                        u8CtrlLowCnt = 0;
                        gu8Mode = MODE_CHECK_CONTROL;
                    }
                }
                break;
                
            case MODE_CONTROL_LOW:
                if( gu8TMR0State & TMR0_FLAG_10MS )
                {
                    gu8TMR0State &= ~TMR0_FLAG_10MS;
                    
                    IO_FEEDBACK_SetDigitalOutput();
                    if( IO_FEEDBACK_GetValue() == LOW )
                    {
                        // C0F0
                        if( u8SignalCnt < 5 )
                        {
                            u8SignalCnt++;
                        }
                        else
                        {
                            gu8Mode = MODE_BACKWARD;    // CCW
                            TMR2_StartTimer();
                            TMR2_WriteTimer(0);
                            IO_CCW_RED_SetHigh();
                        }
                    }
                    else
                    {
                        // C0F1
                        u8CtrlHighCnt = 0;
                        u8CtrlLowCnt = 0;
                        u8SignalCnt = 0;
                        gu8Mode = MODE_CHECK_CONTROL;
                    }
                }
                break;
                
            case MODE_FORWARD:
                if( LOW == IO_CW_GREEN_GetValue() ||
                    true == bCheckInTheMiddle() )
                {
                    TMR2_StopTimer();
                    IO_CW_GREEN_SetLow();
                    IO_B_CTRL_SetHigh();        // Set B signal to low
                    IO_Y_CTRL_SetLow();        // Set Y signal to high
                    IO_W_CTRL_SetHigh();        // Set W signal to low
                    
                    IO_FEEDBACK_SetDigitalOutput();
                    IO_FEEDBACK_SetLow();
                    u8CtrlHighCnt = 0;
                    u8CtrlLowCnt = 0;
                    if( bPowerIssue == true )
                    {
                        bPowerIssue = false;
                        gu8Mode = MODE_CHECK_VOLT;
                    }
                    else
                    {
                        gu8Mode = MODE_CHECK_CONTROL;
                    }
                }
                break;
                
            case MODE_BACKWARD:
                if( LOW == IO_CCW_RED_GetValue() ||
                    true == bCheckBConnectW() )
                {
                    TMR2_StopTimer();
                    IO_CCW_RED_SetLow();
                    IO_B_CTRL_SetHigh();        // Set B signal to low
                    IO_Y_CTRL_SetLow();        // Set Y signal to high
                    IO_W_CTRL_SetHigh();        // Set W signal to low
                    
                    IO_FEEDBACK_SetDigitalOutput();
                    IO_FEEDBACK_SetHigh();
                    u8CtrlHighCnt = 0;
                    u8CtrlLowCnt = 0;
                    if( bPowerIssue == true )
                    {
                        bPowerIssue = false;
                        gu8Mode = MODE_CHECK_VOLT;
                    }
                    else
                    {
                        gu8Mode = MODE_CHECK_CONTROL;
                    }
                }
                break;
                
            case MODE_FINISH:
                IO_CW_GREEN_SetLow();
                IO_CCW_RED_SetLow();
                IO_B_CTRL_SetHigh();        // Set B signal to low
                IO_Y_CTRL_SetLow();        // Set Y signal to high
                IO_W_CTRL_SetHigh();        // Set W signal to low
                TMR2_StopTimer();
                
                IO_FEEDBACK_SetDigitalOutput();
                if( IO_CONTROL_GetValue() == LOW )
                {
                    IO_FEEDBACK_SetHigh();
                }
                else
                {
                    IO_FEEDBACK_SetLow();
                }
                u8CtrlHighCnt = 0;
                u8CtrlLowCnt = 0;
                if( bPowerIssue == true )
                {
                    bPowerIssue = false;
                    gu8Mode = MODE_CHECK_VOLT;
                }
                else
                {
                    gu8Mode = MODE_CHECK_CONTROL;
                }
                break;
                
            default:
                break;
        }
        
        CLRWDT();
    }
    
}