Exemplo n.º 1
0
/*!
 * @brief This-stuff-hasn't-been-adjusted-yet thread.
 */
void EventThread(void *data)
{
	for (;;)
	{
		OS_SemaphoreWait(EventSemaphore, 0);
		if (ToggleSwitch)
		{
			ToggleSwitch = bFALSE;
			ChangeMode(MODE_TOGGLE);
			continue;
		}

		if (GameSwitch)
		{
			GameSwitch = bFALSE;
			ChangeMode(MODE_GAME);
			continue;
		}

		if (ToggleFinishedFlag)
		{
			ToggleFinishedFlag = bFALSE;
			ChangeMode(MODE_DEFAULT);
			continue;
		}

		if (GameFinishedFlag)
		{
			GameFinishedFlag = bFALSE;
			ChangeMode(MODE_DEFAULT);
			continue;
		}
	}
}
Exemplo n.º 2
0
void MyPositionController::NextMode(ScreenBase const & screen)
{
  string const kAlohalyticsClickEvent = "$onClick";

  // Skip switching to next mode while we are waiting for position.
  if (IsWaitingForLocation())
  {
    alohalytics::LogEvent(kAlohalyticsClickEvent,
                          LocationModeStatisticsName(location::PendingPosition));
    return;
  }

  alohalytics::LogEvent(kAlohalyticsClickEvent, LocationModeStatisticsName(m_mode));

  // Start looking for location.
  if (m_mode == location::NotFollowNoPosition)
  {
    m_pendingTimer.Reset();
    ChangeMode(location::PendingPosition);
    return;
  }

  // Calculate preferred zoom level.
  int const currentZoom = GetZoomLevel(screen);
  int preferredZoomLevel = kDoNotChangeZoom;
  if (currentZoom < kZoomThreshold)
    preferredZoomLevel = min(GetZoomLevel(screen, m_position, m_errorRadius), kMaxScaleZoomLevel);

  // In routing not-follow -> follow-and-rotate, otherwise not-follow -> follow.
  if (m_mode == location::NotFollow)
  {
    ChangeMode(m_isInRouting ? location::FollowAndRotate : location::Follow);
    UpdateViewport(preferredZoomLevel);
    return;
  }

  // From follow mode we transit to follow-and-rotate if compass is available or
  // routing is enabled.
  if (m_mode == location::Follow)
  {
    if (IsRotationAvailable() || m_isInRouting)
    {
      ChangeMode(location::FollowAndRotate);
      UpdateViewport(preferredZoomLevel);
    }
    return;
  }

  // From follow-and-rotate mode we can transit to follow mode if routing is disabled.
  if (m_mode == location::FollowAndRotate)
  {
    if (!m_isInRouting)
    {
      ChangeMode(location::Follow);
      ChangeModelView(m_position, 0.0, m_pixelRect.Center(), preferredZoomLevel);
    }
  }
}
Exemplo n.º 3
0
void GameLogic::ChangeScene( const char* sceneName, const game_logic_mode_t nextGameMode ) {
	ChangeMode( GAME_LOGIC_MODE_LOADING );
	Instance.FileSystem->LoadStaticScene( sceneName );

	CONSOLE_PRINT_INFO( "GameLogic::ChangeScene => New scene is %s\n", sceneName );

	m_NextGameMode = nextGameMode;

	ChangeMode( GAME_LOGIC_MODE_TRANSITION );
	Instance.Renderer->CacheSceneRessources();
}
Exemplo n.º 4
0
/*
	メインダイアログ用 WM_COMMAND 処理ルーチン
*/
BOOL TInstDlg::EvCommand(WORD wNotifyCode, WORD wID, LPARAM hwndCtl)
{
	switch (wID) {
	case IDOK:
		propertySheet->GetData();
		if (cfg.mode == UNINSTALL_MODE)
			UnInstall();
		else
			Install();
		return	TRUE;

	case IDCANCEL:
		::PostQuitMessage(0);
		return	TRUE;

	case FILE_BUTTON:
		BrowseDirDlg(this, FILE_EDIT, "Select Install Directory");
		return	TRUE;

	case SETUP_RADIO:
	case UNINSTALL_RADIO:
		if (wNotifyCode == BN_CLICKED)
			ChangeMode();
		return	TRUE;
	}
	return	FALSE;
}
Exemplo n.º 5
0
void GameLogic::OnTick() {
	switch( m_ActiveGameMode ) {
		case GAME_LOGIC_MODE_PLAYING:
			Instance.SceneManager->OnTick();
			Instance.InputHandler->UpdateRelativeMouse();
			break;

		case GAME_LOGIC_MODE_TEST:
			ChangeScene( "Scenes/Dev/Test_Sandbox.its", GAME_LOGIC_MODE_PLAYING );
			break;

		case GAME_LOGIC_MODE_TRANSITION:
			ChangeMode( m_NextGameMode );
			m_NextGameMode = GAME_LOGIC_MODE_NONE;
			break;

		case GAME_LOGIC_MODE_EDITOR:
			Instance.SceneManager->OnTick();
			Instance.InputHandler->UpdateMouse();
			EditorMouseUpdate();
			break;

		case GAME_LOGIC_MODE_UNKNOWN:
		case GAME_LOGIC_MODE_NONE:
		default:
			break;
	}
}
Exemplo n.º 6
0
void Camera::DeleteTarget( )
{
	Target = NULL;
	TargetX = NULL;
	TargetY = NULL;
	ChangeMode( ctmNormal );
}
Exemplo n.º 7
0
void Camera::SetTarget( double* x, double* y )
{
	TargetX = x;
	TargetY = y;
	ChangeMode( ctmCenter );
	Update( );
}
Exemplo n.º 8
0
void CVision::ChangeMode( VisionMode newMode )
{
	// If we're not in idle and the request is not the current mode or idle, we have
	// to switch back to idle first and then to the new mode.
	if ( (m_vmMode != VM_IDLE) && (newMode != VM_IDLE) && (newMode != m_vmMode))
		ChangeMode( VM_IDLE );
	
	m_vmMode = newMode;

	// Reconfigure the vision network.
	switch ( m_vmMode )
	{
	case VM_IDLE:		
		SetComponentsOperationMode( CVisComponent::OP_IDLE );
		break;
		
	case VM_CLASSIFICATION:
		SetComponentsOperationMode( CVisComponent::OP_CLASSIFICATION );		
		break;

	case VM_SERVICE:
		SetComponentsOperationMode( CVisComponent::OP_SERVICE );		
		break;
		
	case VM_CALIBRATION:
		SetEvent( 1 );
		SetComponentsOperationMode( CVisComponent::OP_CALIBRATION );
		break;
	}
}
Exemplo n.º 9
0
int n3heDefault(int module)
{
    int counter=0;
    //Change Mode
    counter+=ChangeMode(module,1);

    //Change Event Length
    if(module!=30)
    counter+=ChangeLength(module,n3He_EVENT);
    if(module==30)
    counter+=ChangeLength(module,DIRTY_EVENT);
 
   //Change Resolution
    if(module!=30)
    counter+=ChangeRes(module,1);
    if(module==30)
    counter+=ChangeRes(module,0);

    //Change Sample Rate
    counter+=ChangeRate(module,n3He_RATE);

    //Change Decimation 
    if(module!=30) 
    counter+=ChangeDecimation(module,n3He_NACC); //nacc(16,16)
    if(module==30)
    counter+=ChangeDecimation(module,DIRTY_NACC); //nacc(1,1)

    return(counter);
}
Exemplo n.º 10
0
void MyPositionController::SetTimeInBackground(double time)
{
  if (time >= kMaxTimeInBackgroundSec && m_mode == location::NotFollow)
  {
    ChangeMode(m_isInRouting ? location::FollowAndRotate : location::Follow);
    UpdateViewport(kDoNotChangeZoom);
  }
}
Exemplo n.º 11
0
void MyPositionController::LoseLocation()
{
  if (m_mode != location::NotFollowNoPosition)
  {
    ChangeMode(location::NotFollowNoPosition);
    SetIsVisible(false);
  }
}
Exemplo n.º 12
0
/*
	メインダイアログ用 WM_INITDIALOG 処理ルーチン
*/
BOOL TInstDlg::EvCreate(LPARAM lParam)
{
	GetWindowRect(&rect);
	int		cx = ::GetSystemMetrics(SM_CXFULLSCREEN), cy = ::GetSystemMetrics(SM_CYFULLSCREEN);
	int		xsize = rect.right - rect.left, ysize = rect.bottom - rect.top;

	::SetClassLong(hWnd, GCL_HICON,
					(LONG_PTR)::LoadIcon(TApp::GetInstance(), (LPCSTR)SETUP_ICON));
	MoveWindow((cx - xsize)/2, (cy - ysize)/2, xsize, ysize, TRUE);
	Show();

// プロパティシートの生成
	staticText.AttachWnd(GetDlgItem(INSTALL_STATIC));
	propertySheet = new TInstSheet(this, &cfg);

// 現在ディレクトリ設定
	char		buf[MAX_PATH], setupDir[MAX_PATH];
	TRegistry	reg(HKEY_LOCAL_MACHINE, BY_MBCS);

// タイトル設定
	if (IsWinVista() && TIsUserAnAdmin()) {
		GetWindowText(buf, sizeof(buf));
		strcat(buf, " (Admin)");
		SetWindowText(buf);
	}

// Program Filesのパス取り出し
	if (reg.OpenKey(REGSTR_PATH_SETUP)) {
		if (reg.GetStr(REGSTR_PROGRAMFILES, buf, sizeof(buf)))
			MakePath(setupDir, buf, FASTCOPY);
		reg.CloseKey();
	}

// 既にセットアップされている場合は、セットアップディレクトリを読み出す
	if (reg.OpenKey(REGSTR_PATH_UNINSTALL)) {
		if (reg.OpenKey(FASTCOPY)) {
			if (reg.GetStr(REGSTR_VAL_UNINSTALLER_COMMANDLINE, setupDir, sizeof(setupDir))) {
				GetParentDir(setupDir, setupDir);
			}
			reg.CloseKey();
		}
		reg.CloseKey();
	}

	if (!cfg.startMenu || !cfg.deskTop) {
		GetShortcutPath(&cfg);
	}

	SetDlgItemText(FILE_EDIT, cfg.setupDir ? toA(cfg.setupDir) : setupDir);

	CheckDlgButton(cfg.mode == SETUP_MODE ? SETUP_RADIO : UNINSTALL_RADIO, 1);
	ChangeMode();

	if (cfg.runImme) PostMessage(WM_COMMAND, MAKEWORD(IDOK, 0), 0);

	return	TRUE;
}
Exemplo n.º 13
0
void GLManager::MainLoop()
{
    InputManager::getInstance()->SetKeyState();
    ChangeMode();

    m_Timer->Tick();
    Update(m_Timer->DeltaTime());
    Render();
}
Exemplo n.º 14
0
void MyPositionController::Render(uint32_t renderMode, ScreenBase const & screen,
                                  ref_ptr<dp::GpuProgramManager> mng,
                                  dp::UniformValuesStorage const & commonUniforms)
{
  if (IsWaitingForLocation())
  {
    if (m_pendingTimer.ElapsedSeconds() >= kMaxPendingLocationTimeSec)
      ChangeMode(location::NotFollowNoPosition);
  }

  if (IsInRouting() && m_mode == location::NotFollow &&
      m_routingNotFollowTimer.ElapsedSeconds() >= kMaxNotFollowRoutingTimeSec)
  {
    ChangeMode(location::FollowAndRotate);
    UpdateViewport(kDoNotChangeZoom);
  }

  if (m_shape != nullptr && IsVisible() && IsModeHasPosition())
  {
    if (m_isDirtyViewport && !m_needBlockAnimation)
    {
      UpdateViewport(kDoNotChangeZoom);
      m_isDirtyViewport = false;
    }

    if (!IsModeChangeViewport())
      m_isPendingAnimation = false;

    m_shape->SetPosition(GetDrawablePosition());
    m_shape->SetAzimuth(GetDrawableAzimut());
    m_shape->SetIsValidAzimuth(IsRotationAvailable());
    m_shape->SetAccuracy(m_errorRadius);
    m_shape->SetRoutingMode(IsInRouting());

    double const updateInterval = m_updateLocationTimer.ElapsedSeconds();
    m_shape->SetPositionObsolete(updateInterval >= kMaxUpdateLocationInvervalSec);

    if ((renderMode & RenderAccuracy) != 0)
      m_shape->RenderAccuracy(screen, mng, commonUniforms);

    if ((renderMode & RenderMyPosition) != 0)
      m_shape->RenderMyPosition(screen, mng, commonUniforms);
  }
}
Exemplo n.º 15
0
void MyPositionController::DeactivateRouting()
{
  if (m_isInRouting)
  {
    m_isInRouting = false;

    ChangeMode(location::Follow);
    ChangeModelView(m_position, 0.0, m_pixelRect.Center(), kDoNotChangeZoom);
  }
}
Exemplo n.º 16
0
void MyPositionController::ActivateRouting(int zoomLevel)
{
  if (!m_isInRouting)
  {
    m_isInRouting = true;
    m_routingNotFollowTimer.Reset();

    if (IsRotationAvailable())
    {
      ChangeMode(location::FollowAndRotate);
      ChangeModelView(m_position, m_drawDirection, GetRoutingRotationPixelCenter(), zoomLevel);
    }
    else
    {
      ChangeMode(location::Follow);
      ChangeModelView(m_position, zoomLevel);
    }
  }
}
Exemplo n.º 17
0
void RadarDopplerClass::SetSRMOverride( void )
{
   SetPower(TRUE);
   //MI
   if(mode == SAM)
	   noovrradarmode = prevMode;
   else
	   noovrradarmode = mode;//me123
   ChangeMode (Dogfovrradarmode); 
   Overridemode = 2;//me123 dogfight flag
}
Exemplo n.º 18
0
void EnemyKingPumpkin::Update(){
	CountdownInvisible();
	Move();
	DispInfoRegister();
	Enemy::Update();
	cntChange--;
	if (cntChange <= 0){
		ChangeMode();
		cntChange = maxCntChange;
	}
}
Exemplo n.º 19
0
int CDateTimeCtrlEx::SetExplicitDate(LPSYSTEMTIME pSystemTime,DWORD dwFlags)
{
	m_dwFlags|=DontSendNotifications;
	if (pSystemTime->wYear==0xFFFF && pSystemTime->wMonth==0xFFFF)
	{
		// Relative
		if (!(dwFlags&DTXF_NOMODECHANGE))
			ChangeMode(TRUE);
		SetRelativeDate(pSystemTime->wDay,dwFlags);
		
		m_dwFlags&=~DontSendNotifications;
		return 1;
	}
	else
	{
		if (!(dwFlags&DTXF_NOMODECHANGE))
			ChangeMode(FALSE);
		m_dwFlags&=~DontSendNotifications;
		return (int)::SendMessage(m_hTimePickerWnd,DTM_SETSYSTEMTIME,dwFlags&~DTXF_MSGMASK,(LPARAM)pSystemTime);
	}
}
Exemplo n.º 20
0
void MyPositionController::StopLocationFollow()
{
  if (m_mode == location::Follow || m_mode == location::FollowAndRotate)
    ChangeMode(location::NotFollow);
  m_desiredInitMode = location::NotFollow;

  if (m_mode == location::PendingPosition)
    m_notFollowAfterPending = true;
  
  if (m_isInRouting)
    m_routingNotFollowTimer.Reset();
}
Exemplo n.º 21
0
int ContinuousMode(int module)
{
    int counter=0;
    //Change Mode
    counter+=ChangeMode(module,2);
    //Change Resolution
    counter+=ChangeRes(module,1);
    //Change Sample Rate
    counter+=ChangeRate(module,CONT_RATE);
    //Change Decimation  
    counter+=ChangeDecimation(module,CONT_NACC); //nacc(16,16)
    return(counter);
}
Exemplo n.º 22
0
void MyPositionController::OnCompassTapped()
{
  alohalytics::LogEvent("$compassClicked", {{"mode", LocationModeStatisticsName(m_mode)},
                                            {"routing", strings::to_string(IsInRouting())}});
  if (m_mode == location::FollowAndRotate)
  {
    ChangeMode(location::Follow);
    ChangeModelView(m_position, 0.0, m_pixelRect.Center(), kDoNotChangeZoom);
  }
  else
  {
    ChangeModelView(0.0);
  }
}
Exemplo n.º 23
0
void tcDisplayModes::LoadModeFromOptions()
{
	const char* modeString = tcOptions::Get()->GetOptionString("DisplaySettings");
	int width;
	int height;
	int bits;
	int freq;
	
	if (sscanf(modeString, "%d %d %d %d", &width, &height, &bits, &freq) < 4)
	{
		return;
	}

	ChangeMode(width, height, bits, freq);
}
Exemplo n.º 24
0
void RadarDopplerClass::SetMRMOverride( void )
{
   SetPower(TRUE);
    //MI
   if(mode == SAM)
	   noovrradarmode = prevMode;
   else
	   noovrradarmode = mode;//me123
	if (!lockedTarget)
	{
		//MI changed so it remembers our last mode
		//airRangeIdx = 1;//me123
		//MI
		lastAirRangeIdx = airRangeIdx;
		airRangeIdx = MissOvrRangeIdx;
	}
	ChangeMode (Missovrradarmode);
	Overridemode = 1;//me123 missovride flag
}
Exemplo n.º 25
0
void CDateTimeCtrlEx::SetRelativeDate(int nNewPos,DWORD dwFlags)
{
	m_dwFlags|=DontSendNotifications;
	
	if (!(dwFlags&DTXF_NOMODECHANGE))
		ChangeMode(TRUE);

	WCHAR szStringBuffer[100];
	int nLen=-1;
	if (nNewPos==0)
		LoadString(IDS_DATETODAY,szStringBuffer,100);
	else if (nNewPos==1)
		LoadString(IDS_DATEDAY,szStringBuffer,100);
	else
	{
		if (_itow_s(nNewPos,szStringBuffer,100,10)!=0)
			szStringBuffer[0]='\0';
		nLen=istrlen(szStringBuffer);
		
		if (nLen+1<100)
		{
			szStringBuffer[nLen]=L' ';
			LoadString(IDS_DATENDAYS,szStringBuffer+nLen+1,100-nLen-1);
		}
	}

	if (IsUnicodeSystem())
		::SendMessageW(m_hEditWnd,WM_SETTEXT,0,(LPARAM)szStringBuffer);
	else
		::SendMessage(m_hEditWnd,WM_SETTEXT,0,(LPARAM)(LPCSTR)W2A(szStringBuffer));

	//::SendMessage(m_hEditWnd,EM_SETSEL,0,nLen);

	if (!(dwFlags&DTXF_NOSPINCHANGE))
		::SendMessage(m_hSpinWnd,UDM_SETPOS32,0,nNewPos);

	m_dwFlags&=~DontSendNotifications;
}
Exemplo n.º 26
0
void RadarDopplerClass::ClearOverride( void )
{

	if (Overridemode == 2) //me123 dogfight flag
	{
		if(mode == ACM_30x20 || mode == ACM_10x60 || mode == ACM_SLEW || mode == ACM_BORE)
			Dogfovrradarmode = mode;

		//restore our range
		airRangeIdx = lastAirRangeIdx;
	}

	if (Overridemode == 1)//me123 missovride flag
	{
		Missovrradarmode = mode;
		//restore our range
		airRangeIdx = lastAirRangeIdx;
		MissOvrRangeIdx = curRangeIdx;
	}

	Overridemode = 0;
	ChangeMode (noovrradarmode);//me123
}
Exemplo n.º 27
0
/******************* VikeWin start **************************/
VikeWin::VikeWin(cbStyledTextCtrl* target, cbEditor *editor, VikeStatusBar *bar)
    : m_searchCmd('/', m_highlight),
      m_generalCmd(':', m_highlight),
      m_pBuiltinStatusBar(bar)
{
    LOGIT(_T("new VikeWin created"));
    //init some params
    PushState(VIKE_START);
    m_iCaretPos = 0;
    func = ViFunc::Instance();

    wxWindow *parent = target->GetParent();

    //parent->Freeze();
    /* Kidnap the sizer of editor */
    LayoutStatusBar(target, editor);
    //parent->Thaw();
    LOGIT(_T("we have resize the window for status bar"));

    /* the last step to change mode */
    ChangeMode(NORMAL, target);
    //UpdateCaret(target);
}
Exemplo n.º 28
0
/*------------------------------------------------------------------------------------------------------------------
-- FUNCTION: WndProc
--
-- DATE: February 9th, 2016
--
-- REVISIONS: February 9th, 2016: Created WndProc
--			  February 10th, 2016: Added WSAAsyncSelect socket calls and hooked up UI events
--			  February 15th, 2016: Commented
--
-- DESIGNER: Carson Roscoe
--
-- PROGRAMMER: Carson Roscoe
--
-- INTERFACE: LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
--
-- RETURN: long pointer result regarding exit code
--
-- NOTES:
-- Invoked whenever either a menu item has triggered an event, or whenever our socket has triggered a Accept or Read
-- event.
----------------------------------------------------------------------------------------------------------------------*/
LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) {
    char ip[64];
    char portStr[64];
    char sizeStr[64];
    char timesStr[64];
    int port = DEFAULTPORT;
    int size = 2000;
    int times = 3;
    LPOPENFILENAME fileName;

    switch (Message) {
    //On destroy window, cleanup
    case WM_DESTROY:
        tcpConnection.Cleanup();
        udpConnection.Cleanup();
        break;
    //On create window
    case WM_CREATE:
        hdc = GetDC(hwnd);

        ReleaseDC(hwnd, hdc);
        break;
    //On UI command...
    case WM_COMMAND:
        switch (LOWORD(wParam)) {
        //On button pressed to send data
        case IDM_SEND:
            //determine if client.
            if (mode == Client) {
                GetWindowText(editTextIP, ip, sizeof(ip));
                GetWindowText(editTextPort, portStr, sizeof(portStr));
                ComboBox_GetLBText(comboBox1, ComboBox_GetCurSel(comboBox1), sizeStr);
                ComboBox_GetLBText(comboBox2, ComboBox_GetCurSel(comboBox2), timesStr);

                port = atoi(portStr);
                size = atoi(sizeStr);
                times = atoi(timesStr);

                switch (protocol) {
                case TCPmode:
                    tcpConnection.SendPacket(port, ip, size, times);
                    break;
                case UDPmode:
                    udpConnection.SendPacket(port, ip, size, times);
                    break;
                }
            } else { //Else we are teh server
                tcpConnection.Cleanup();
                udpConnection.Cleanup();
                GetWindowText(editTextPort, portStr, sizeof(portStr));
                switch (protocol) {
                case TCPmode:
                    tcpConnection.StartServer(atoi(portStr));
                    break;
                case UDPmode:
                    udpConnection.StartServer(atoi(portStr));
                    break;
                }
            }
            break;
        //If we are changing to either the client or the server
        case ID_MODE_CLIENT:
        case ID_MODE_SERVER:
            ChangeMode(wParam);
            break;
        //By default, update UDP/TCP modes
        default:
            switch (ComboBox_GetCurSel(comboBox3)) {
            case 0:
                protocol = TCPmode;
                break;
            case 1:
                protocol = UDPmode;
                break;
            }
        }
        break;
    //On receiving socket commands
    case WM_SOCKET:
        if (mode != Server)
            return 0;
        if (WSAGETSELECTERROR(lParam)) {
            int errorCode = WSAGETSELECTERROR(lParam);
            perror("Socket failed with error " + errorCode);
            //If it isnt an error
        } else {
            switch (WSAGETSELECTEVENT(lParam)) {
            //On accept call, we are TCP that means so call our Accept method
            case FD_ACCEPT:
                tcpConnection.Accept(wParam);
                break;
            //On read call determine which protocol and call appropriate read
            case FD_READ:
                GetWindowText(editTextPort, portStr, sizeof(portStr));
                switch (protocol) {
                case TCPmode:
                    tcpConnection.ReceivePacket(atoi(portStr), wParam);
                    break;
                case UDPmode:
                    udpConnection.ReceivePacket(atoi(portStr), wParam);
                    break;
                }
                return 0;
            }
        }
        return 0;
    default:
        return DefWindowProc(hwnd, Message, wParam, lParam);
    }
    return 0;
}
Exemplo n.º 29
0
/*! Handle the messages routed to the display queue */
static void DisplayQueueMessageHandler(tMessage *pMsg)
{
  tMessage Msg;

  switch (pMsg->Type)
  {
  case ShowCallMsg:
    HandleCallNotification(pMsg->Options, pMsg->pBuffer, pMsg->Length);
    break;

  case WriteBufferMsg:
    WriteBufferHandler(pMsg);
    break;

  case SetWidgetListMsg:
    SetWidgetList(pMsg);
    break;
  
  case UpdateDisplayMsg:
  
    if ((!(pMsg->Options & MSG_OPT_UPD_INTERNAL) &&
        (pMsg->Options & MODE_MASK) == NOTIF_MODE) &&
        GetProperty(PROP_AUTO_BACKLIGHT))
      SendMessage(AutoBacklightMsg, MSG_OPT_NONE);

    UpdateDisplayHandler(pMsg);
    break;

  case DrawMsg:
    DrawMsgHandler(pMsg);
    break;
    
  case UpdateClockMsg:
    UpdateClock();
    break;
    
  case DrawClockWidgetMsg:
    DrawClockWidget(pMsg->Options);
    break;

  case BluetoothStateChangeMsg:
    BluetoothStateChangeHandler(pMsg);
    break;

  case IdleUpdateMsg:
    IdleUpdateHandler();
    break;

  case ButtonStateMsg:
    ButtonStateHandler();
    break;

  case StopTimerMsg:
    StopTimer((eTimerId)pMsg->Options);
    break;

  case MonitorBatteryMsg:
    MonitorBattery();
    break;

  case MusicIconMsg:
      MusicIcon(pMsg->Options);
      break;

  case MusicStateMsg:
    HandleMusicStateChange(pMsg->Options);
    break;
    
  case ChangeModeMsg:
    ChangeMode(pMsg->Options);
    break;
  
  case ControlFullScreenMsg:
    SetProperty(PROP_PHONE_DRAW_TOP, pMsg->Options || *pMsg->pBuffer ? PROP_PHONE_DRAW_TOP : 0);
    break;

  case ModifyTimeMsg:
    ModifyTimeHandler(pMsg);
    break;

  case MenuModeMsg:
    MenuModeHandler(pMsg->Options);
    break;

  case MenuButtonMsg:
    MenuButtonHandler(pMsg->Options);
    break;

  case EnableButtonMsg:
    EnableButtonMsgHandler(pMsg);
    break;

  case DevTypeMsg:

    Msg.Length = 1;
    Msg.Type = DevTypeRespMsg;
    Msg.Options = BOARD_TYPE; //default G2

    if (CreateMessage(&Msg))
    {
      Msg.pBuffer[0] = BOARD_TYPE; // backward compatible

      if (GetMsp430HardwareRevision() < 'F')
      {
        Msg.Options = DIGITAL_WATCH_TYPE_G1;
        Msg.pBuffer[0] = DIGITAL_WATCH_TYPE_G1; // backward compatible
      }

      Msg.Options |= DEV_TYPE_EN_ACK; // support ACK
      RouteMsg(&Msg);
    }

    PrintF("- DevTypeResp:%u", Msg.Options);

    // set ACK and HFP/MAP bits
//    SendMessage(ConnTypeMsg, pMsg->Options);
    break;

  case VerInfoMsg:

    Msg.Length = BUILD_LENGTH + 4 + 3;
    Msg.Type = VerInfoRespMsg;
    Msg.Options = MSG_OPT_NONE;

    if (CreateMessage(&Msg))
    {
      GetBuildNumber(Msg.pBuffer);

      *(Msg.pBuffer + BUILD_LENGTH) = VERSION[0] - ZERO;
      *(Msg.pBuffer + BUILD_LENGTH + 1) = VERSION[2] - ZERO;
      *(Msg.pBuffer + BUILD_LENGTH + 2) = VERSION[4] - ZERO;
      *(Msg.pBuffer + BUILD_LENGTH + 3) = GetMsp430HardwareRevision();
      *(Msg.pBuffer + BUILD_LENGTH + 4) = BootVersion[0] - ZERO;
      *(Msg.pBuffer + BUILD_LENGTH + 5) = BootVersion[2] - ZERO;
      *(Msg.pBuffer + BUILD_LENGTH + 6) = BootVersion[4] - ZERO;

      RouteMsg(&Msg);
    }
    PrintE("-Ver(%u):", Msg.Length); PrintQ(Msg.pBuffer, Msg.Length);
    break;

  case LogMsg:
    SendStateLog();
    break;
    
  case VibrateMsg:
    SetVibrateModeHandler(pMsg);
    break;

  case SetRtcMsg:
    if (SetRtc((Rtc_t *)pMsg->pBuffer)) UpdateClock();
    break;
    
  case CountdownMsg:
    if (pMsg->Options == CDT_ENTER)
    {
      PageType = PAGE_TYPE_INFO;
      CurrentPage[PageType] = CountdownPage;
    }
    CountdownHandler(pMsg->Options);
    break;

  case ServiceMenuMsg:
    ServiceMenuHandler();
    break;

  case FieldTestMsg:
    HandleFieldTestMode(pMsg->Options);
    break;

  case DisableButtonMsg:
    DisableButtonMsgHandler(pMsg);
    break;

  case ReadButtonConfigMsg:
    ReadButtonConfigHandler(pMsg);
    break;

  case SetBacklightMsg:
    SetBacklight(pMsg->Options);
    // testing
//    pMsg->Type = AccelMsg;
//    pMsg->Options = 1; //enable
//    HandleAccelerometer(pMsg);
    break;

  case AutoBacklightMsg:
    if (LightSenseCycle() < DARK_LEVEL) SetBacklight(LED_ON);
    break;

  case BatteryConfigMsg:
    SetBatteryLevels(pMsg->pBuffer);
    break;

  case ReadBatteryVoltageMsg:
    ReadBatteryVoltageHandler();
    break;

  case ResetMsg:
    SoftwareReset(RESET_BUTTON_PRESS, pMsg->Options);
    break;

  case NvalOperationMsg:
    NvalOperationHandler(pMsg);
    break;

  case SecInvertMsg:
    HandleSecInvert(pMsg->Options);
    break;

  case LoadTemplateMsg:
    LoadTemplateHandler(pMsg);
    break;

  case LinkAlarmMsg:
    SendMessage(VibrateMsg, VIBRA_PATTERN_LNKALM);
    break;

  case ModeTimeoutMsg:
    ModeTimeoutHandler();
    break;

  case WatchStatusMsg:
    PageType = PAGE_TYPE_INFO;
    CurrentPage[PageType] = StatusPage;
    DrawWatchStatusScreen(TRUE);
    break;

  case TermModeMsg:
    TermModeHandler();
    break;
    
  case LowBatteryWarningMsg:
    break;
    
  case LowBatteryBtOffMsg:
    UpdateClock();
    break;

#if __IAR_SYSTEMS_ICC__
  case EraseTemplateMsg:
//    EraseTemplateHandler(pMsg);
    break;
    
  case WriteToTemplateMsg:
//    WriteToTemplateHandler(pMsg);
    break;
#endif

  case AccelMsg:
    HandleAccelerometer(pMsg);
    break;

  case ReadLightSensorMsg:
    ReadLightSensorHandler();
    break;

  case WatchDrawnScreenTimeout:
    IdleUpdateHandler();
    break;

  case RateTestMsg:
    /* don't care what data is */
    Msg.Length = 10;
    Msg.Type = DiagnosticLoopback;
    Msg.Options = MSG_OPT_NONE;
    if (CreateMessage(&Msg)) RouteMsg(&Msg);
    break;
    
  default:
    PrintF("# Disp Msg:x%02X", pMsg->Type);
    break;
  }
}
Exemplo n.º 30
0
tcDisplayModes::~tcDisplayModes()
{
	ChangeMode(startMode.width, startMode.height, startMode.bits, 
		startMode.frequency);
}