예제 #1
0
void menu(struct menuInfo* theSelectedInfo, int *theConfHasBeenUpdated)
{
  ENTER("menu");
  enum MENU_State aMenuState=MENU_Volume;
  struct menuInfo aOldInfo;
  
  if (!theSelectedInfo || !theConfHasBeenUpdated)
    {
      return;
    }

  memcpy( &aOldInfo, theSelectedInfo, sizeof(struct menuInfo));

  if (mustSetPreferences())
    {
      *theConfHasBeenUpdated=1;
    }
  else
    {
      setTextToSpeech( &(theSelectedInfo->myTextToSpeech), 
		       theSelectedInfo->myMenuLanguage,
		       theSelectedInfo->myDesktop,
		       0);
      aMenuState=MENU_End;
      *theConfHasBeenUpdated=0;
    }

  serialPortInit();

  while(aMenuState != MENU_End)
    {
      switch(aMenuState)
	{
	case MENU_Volume:
	  setVolume();
	  aMenuState = (GNC_UpArrowKey == getLastKeyPressed()) ? MENU_QuitExpected : MENU_Language;
	  break;

	case MENU_Language:
	  if (setMenuLanguage( &theSelectedInfo->myMenuLanguage))
	    {
	      theSelectedInfo->myUserConfIsKnown=1;
	      if (!aOldInfo.myUserConfIsKnown)
		{ /* The default keyboard must match the selected language */
		  theSelectedInfo->myKeyboard = getProbableKeyboard(theSelectedInfo->myMenuLanguage);
		  loadkeys( theSelectedInfo->myKeyboard);
		}

	      buildI18n( theSelectedInfo->myMenuLanguage, 
			 theSelectedInfo->myTextToSpeech, 
			 theSelectedInfo->myKeyboard,
			 theSelectedInfo->myKeyboardFeatures,
			 theSelectedInfo->myDesktop,
			 theSelectedInfo->myUserConfIsKnown);
	    }
	  aMenuState = (GNC_UpArrowKey == getLastKeyPressed()) ? MENU_Volume : MENU_Keyboard;
	  break;

	case MENU_Keyboard:
	  {
	    if(setKeyboard(&theSelectedInfo->myKeyboard, 
			   theSelectedInfo->myMenuLanguage))
	      {
		theSelectedInfo->myUserConfIsKnown=1;

		// The keyboard is available as soon as it is selected.
		loadkeys( theSelectedInfo->myKeyboard);

		buildI18n( theSelectedInfo->myMenuLanguage, 
			   theSelectedInfo->myTextToSpeech, 
			   theSelectedInfo->myKeyboard,
			   theSelectedInfo->myKeyboardFeatures,
			   theSelectedInfo->myDesktop,
			   theSelectedInfo->myUserConfIsKnown);
	      }
	    aMenuState = (GNC_UpArrowKey == getLastKeyPressed()) ? MENU_Language : MENU_KeyboardFeatures;	  
	  }
	  break;

	case MENU_KeyboardFeatures:
	  if (setKeyboardFeatures(& theSelectedInfo->myKeyboardFeatures))
	    {
	      theSelectedInfo->myUserConfIsKnown=1;
	      buildI18n( theSelectedInfo->myMenuLanguage, 
			 theSelectedInfo->myTextToSpeech, 
			 theSelectedInfo->myKeyboard,
			 theSelectedInfo->myKeyboardFeatures,
			 theSelectedInfo->myDesktop,
			 theSelectedInfo->myUserConfIsKnown);
	    }
	  aMenuState = (GNC_UpArrowKey == getLastKeyPressed()) ? MENU_Keyboard : MENU_Braille;	  
	  break;

	case MENU_Braille:
	  {
	    // The braille driver is installed as soon as it is selected.
	    struct brailleInfo aBrailleInfo;
	    getDefaultConf( theSelectedInfo->myKeyboard, & aBrailleInfo );
	    setBraille( &aBrailleInfo);
	    
	    aMenuState = (GNC_UpArrowKey == getLastKeyPressed()) ? MENU_KeyboardFeatures : MENU_Desktop;
	  }
	  break;

	case MENU_Desktop:
	  if (setDesktop( &(theSelectedInfo->myDesktop)))
	    {
	      theSelectedInfo->myUserConfIsKnown=1;	      
	      buildI18n( theSelectedInfo->myMenuLanguage, 
			 theSelectedInfo->myTextToSpeech, 
			 theSelectedInfo->myKeyboard,
			 theSelectedInfo->myKeyboardFeatures,
			 theSelectedInfo->myDesktop,
			 theSelectedInfo->myUserConfIsKnown);
	    }
	  aMenuState = (GNC_UpArrowKey == getLastKeyPressed()) ? MENU_Braille : MENU_TTS;
	  break;

	case MENU_TTS:
	  if (setTextToSpeech( &(theSelectedInfo->myTextToSpeech),
			       theSelectedInfo->myMenuLanguage,
			       theSelectedInfo->myDesktop,
			       1))
	    {
	      theSelectedInfo->myUserConfIsKnown=1;	      
	      buildI18n( theSelectedInfo->myMenuLanguage, 
			 theSelectedInfo->myTextToSpeech, 
			 theSelectedInfo->myKeyboard,
			 theSelectedInfo->myKeyboardFeatures,
			 theSelectedInfo->myDesktop,
			 theSelectedInfo->myUserConfIsKnown);
	    }
	  aMenuState = (GNC_UpArrowKey == getLastKeyPressed()) ? MENU_Desktop : MENU_Internet;
	  break;

	case MENU_Internet:
	  {
	    setInternet( theSelectedInfo);
	    aMenuState = (GNC_UpArrowKey == getLastKeyPressed()) ? MENU_TTS : MENU_PersistentStorage;
	  }
	  break;

	case MENU_PersistentStorage:
	  {
	    setPersistentStorage( theSelectedInfo);
	    aMenuState = (GNC_UpArrowKey == getLastKeyPressed()) ? MENU_Internet : MENU_QuitExpected;
	  }
	  break;

	case MENU_QuitExpected:
	  {
	    if (setQuitExpected())
	      {
		aMenuState = MENU_End;
	      }
	    else
	      {
		aMenuState = (GNC_UpArrowKey == getLastKeyPressed()) ? MENU_PersistentStorage : MENU_Volume;
	      }
	  }
	  break;

	default:
	  aMenuState = MENU_End; // Security
	  break;
	}
    }
  clearStoredSentences();

  if (!*theConfHasBeenUpdated)
    {
      *theConfHasBeenUpdated=(0!=memcmp( &aOldInfo, theSelectedInfo, sizeof(struct menuInfo)));

/* 	((aOldInfo.myMenuLanguage != theSelectedInfo->myMenuLanguage) */
/* 	 || (aOldInfo.myKeyboard != theSelectedInfo->myKeyboard) */
/* 	 || (aOldInfo.myKeyboardFeatures.myStickyKeysAreAvailable != theSelectedInfo->myKeyboardFeatures.myStickyKeysAreAvailable) */
/* 	 || (aOldInfo.myKeyboardFeatures.myRepeatKeysAreAvailable != theSelectedInfo->myKeyboardFeatures.myRepeatKeysAreAvailable) */
/* 	 || (aOldInfo.myTextToSpeech.myIdentifier != theSelectedInfo->myTextToSpeech.myIdentifier) */
/* 	 || (aOldInfo.myTextToSpeech.myLanguage != theSelectedInfo->myTextToSpeech.myLanguage) */
/* 	 || (aOldInfo.myTextToSpeech.myPort != theSelectedInfo->myTextToSpeech.myPort) */
/* 	 || (aOldInfo.myDesktop != theSelectedInfo->myDesktop)); */
    }
}
예제 #2
0
initialiseModule(void)
{
	return serialPortInit();
}
예제 #3
0
EXPORT(sqInt) initialiseModule(void) {
	return serialPortInit();
}
initialiseModule(void)
{
	// SerialPlugin>>#initialiseModule
	return serialPortInit();
}