/***********************************************************************
 *
 * FUNCTION:    RomVersionCompatible
 *
 * DESCRIPTION: This routine checks that a ROM version is meet your
 *              minimum requirement.
 *
 * PARAMETERS:  requiredVersion - minimum rom version required
 *                                (see sysFtrNumROMVersion in SystemMgr.h 
 *                                for format)
 *              launchFlags     - flags that indicate if the application 
 *                                UI is initialized.
 *
 * RETURNED:    error code or zero if rom is compatible
 *
 * REVISION HISTORY:
 *
 *
 ***********************************************************************/
static Err RomVersionCompatible(UInt32 requiredVersion, UInt16 launchFlags)
{
	UInt32 romVersion;

	// See if we're on in minimum required version of the ROM or later.
	FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
	if (romVersion < requiredVersion)
		{
		if ((launchFlags & (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) ==
			(sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp))
			{
			FrmAlert (RomIncompatibleAlert);
		
			// Palm OS 1.0 will continuously relaunch this app unless we switch to 
			// another safe one.
			if (romVersion <= kPalmOS10Version)
				{
				AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
				}
			}
		
		return sysErrRomIncompatible;
		}

	return errNone;
}
Ejemplo n.º 2
0
Err RomVersionCompatible
    (
    UInt32 reqVersion
    )
{
    if ( romVersion < reqVersion ) {
        MSG( _( "wrong ROM version detected ( %lx )\n", romVersion ) );
        FrmAlert( infoWrongROMVersion );
        if ( sysGetROMVerMajor( romVersion ) == 0x01 )
            AppLaunchWithCommand( sysFileCDefaultApp,
                sysAppLaunchCmdNormalLaunch, NULL );
        return sysErrRomIncompatible;
    }
    return errNone;
}
Ejemplo n.º 3
0
/***********************************************************************
 * function is checking ROM version of the palmos operating system
 * if ROM version is less then required the result of this function is
 * sysErrRomIncompatible
 ***********************************************************************/
static Err
RomVersionCompatible (UInt32 requiredVersion, UInt16 launchFlags)
{
  // See if we're on in minimum required version of the ROM or later.
  if (TNPalmOSVersion() < requiredVersion) {
    if ((launchFlags & (sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) ==
	(sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp)) {
      FrmAlert (ALERT_ROMIncompatible);

      // PalmOS before 3.5 will continuously relaunch this app unless we switch to
      // another safe one.
      AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
    }

    return (sysErrRomIncompatible);
  }

  return (0);
}
static Err RomVersionCheck(UInt16 launchFlags)
{
	UInt32 Version;
	FtrGet(sysFtrCreator, sysFtrNumROMVersion, &Version);

	if (Version < sysMakeROMVersion(5,0,0,sysROMStageDevelopment,0))
	{
		if ((launchFlags & sysAppLaunchFlagNewGlobals) != 0 &&
			(launchFlags & sysAppLaunchFlagUIApp) != 0)
		{
			FrmCustomAlert(WarningOKAlert, "System version 5.0 or greater is required to run this application!", " ", " ");

			// Palm OS 1.0 requires you to explicitly launch another app
			if (Version < sysMakeROMVersion(1,0,0,sysROMStageRelease,0))
			{
				AppLaunchWithCommand(sysFileCDefaultApp,
						sysAppLaunchCmdNormalLaunch, NULL);
			}
		}

		return sysErrRomIncompatible;
	}
	return errNone;
}
Ejemplo n.º 5
0
/***********************************************************************
 * main function
 ***********************************************************************/
UInt32
PilotMain(UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
{
  UInt16 error = RomVersionCompatible (MINVERSION, launchFlags);
  if (error) return (error);

  /***
  * NORMAL STARTUP
  ****/
  if ( cmd == sysAppLaunchCmdNormalLaunch ) {
    error = StartApplication ();
    if (error) {
      // PalmOS before 3.5 will continuously relaunch this app unless we switch to
      // another safe one.
      if (error != dmErrCorruptDatabase) {
        FrmCustomAlert(ALERT_debug, "Please reports this bug! Give your Palm device and PalmOS version, this BadBug(TM) should not happen.", "", "");
      }
      StopApplication();
      AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
      return error;
    }

    FrmGotoForm(FORM_main);

    AppEventLoop ();
    StopApplication ();

    /***
     * FIND
     ****/
    /*
      } else if (cmd == sysAppLaunchCmdSaveData) {
      FrmSaveAllForms();
      } else if (cmd == sysAppLaunchCmdFind) {
      PalmGlobalFind((FindParamsPtr)cmdPBP);
    */

    /***
     * GoTo
     ****/
    /*
      } else if (cmd == sysAppLaunchCmdGoTo) {
      Boolean launched = launchFlags & sysAppLaunchFlagNewGlobals;
	
      if (launched) {
      error = StartApplication();
      if (! error) {
      GoToItem((GoToParamsPtr)cmdPBP, launched);
      AppEventLoop();
      StopApplication();
      }
      } else {
      GoToItem((GoToParamsPtr)cmdPBP, launched);
      }
    */

    /***
     * BEAMING
     ****/
  } else if (cmd == sysAppLaunchCmdSyncNotify) {
    // Register with the Exchange Manager
    ExgRegisterData(APP_CREATOR, exgRegExtensionID, "umx");
  } else if (cmd == sysAppLaunchCmdExgAskUser) {
    // Always assume "Yes" as answer to the accept dialog since we display our
    // own on which the user can cancel the data
    ExgAskParamType *exgAskParam = (ExgAskParamType *)cmdPBP;
    exgAskParam->result=exgAskOk;
  } else if (cmd == sysAppLaunchCmdExgReceiveData) {
    DmOpenRef cats=NULL, dogs=NULL;
    // Is app active?
    if (launchFlags & sysAppLaunchFlagSubCall) {
      // Quit Forms
      FrmSaveAllForms();

      cats = DatabaseGetRefN(DB_MAIN);
      dogs = DatabaseGetRefN(DB_DATA);
      error = BeamReceive(cats, dogs, (ExgSocketPtr) cmdPBP);
      CacheReset();
      FrmGotoForm(FORM_main);

    } else {
      // Another app was running when we were called
      cats = DmOpenDatabaseByTypeCreator(DATABASE_TYPE, APP_CREATOR, dmModeReadWrite);
      dogs = DmOpenDatabaseByTypeCreator(DATABASE_DATA_TYPE, APP_CREATOR, dmModeReadWrite);
      if (! (cats && dogs)) {
        FrmAlert(ALERT_beamdbfail);
      } else {
        error=BeamReceive(cats, dogs, (ExgSocketPtr)cmdPBP);
      }
      if (cats)  DmCloseDatabase(cats);
      if (dogs)  DmCloseDatabase(dogs);
    }

    /***
     * ALARM
     ****/
  } else if (cmd == sysAppLaunchCmdAlarmTriggered) {
    // Is app active?
    if (launchFlags & sysAppLaunchFlagSubCall) {
      AlarmTriggered(DatabaseGetRefN(DB_MAIN), (SysAlarmTriggeredParamType *)cmdPBP);
    } else {
      DmOpenRef cats = DmOpenDatabaseByTypeCreator(DATABASE_TYPE, APP_CREATOR, dmModeReadWrite);
      AlarmTriggered(cats, (SysAlarmTriggeredParamType *)cmdPBP);
      DmCloseDatabase(cats);
    }

    /***
     * ATTENTION
     ****/
  } else if (cmd == sysAppLaunchCmdAttention) {
    // Is app active?
    if (launchFlags & sysAppLaunchFlagSubCall) {
      AttentionBottleNeckProc(DatabaseGetRefN(DB_MAIN), (AttnLaunchCodeArgsType *)cmdPBP);
    } else {
      // Another app was running when we were called
      DmOpenRef cats = DmOpenDatabaseByTypeCreator(DATABASE_TYPE, APP_CREATOR, dmModeReadWrite);
      AttentionBottleNeckProc(cats, (AttnLaunchCodeArgsType *)cmdPBP);
      DmCloseDatabase(cats);
    }

    /***
     * ATTENTION GOTO
     ****/
  } else if (cmd == appLaunchCmdAlarmEventGoto) {
    error = StartApplication ();
    if (error) {
      // PalmOS before 3.5 will continuously relaunch this app unless we switch to
      // another safe one.
      if (error != dmErrCorruptDatabase) {
        FrmCustomAlert(ALERT_debug, "Please reports this bug! Give your Palm device and PalmOS version, this BadBug(TM) should not happen.", "", "");
      }
      StopApplication();
      AppLaunchWithCommand(sysFileCDefaultApp, sysAppLaunchCmdNormalLaunch, NULL);
      return error;
    }

    ExamSetGoto(*(UInt32 *)cmdPBP);
    FrmGotoForm(FORM_exams);

    AppEventLoop ();
    StopApplication ();


  /***
  * TIME CHANGE
  ****/
  // Launch code sent when the system time is changed.
  } else if (cmd == sysAppLaunchCmdTimeChange) {
    // reset the trigger for the next alarm to fire
    if (launchFlags & sysAppLaunchFlagSubCall) {
      AlarmReset(DatabaseGetRefN(DB_MAIN));
      // Remove any "future" alarms from the attention manager queue
      // (ie alarms that will trigger after the new time setting)
      //AlarmUpdatePosted(DeviceTimeChanged);
    } else {
      // Another app was running when we were called
      DmOpenRef cats = DmOpenDatabaseByTypeCreator(DATABASE_TYPE, APP_CREATOR, dmModeReadWrite);
      if (cats != 0) {
        AlarmReset(cats);
        //AlarmUpdatePosted(DeviceTimeChanged);
        DmCloseDatabase(cats);
      }
    }
    
  
  /***
  * RESET
  ****/
  // This action code is sent after the system is reset.
  } else if (cmd == sysAppLaunchCmdSystemReset) {
    if (! ((SysAppLaunchCmdSystemResetType*)cmdPBP)->hardReset) {
      if (launchFlags & sysAppLaunchFlagSubCall) {
        AlarmReset(DatabaseGetRefN(DB_MAIN));
      } else {
        // Another app was running when we were called
        DmOpenRef cats = DmOpenDatabaseByTypeCreator(DATABASE_TYPE, APP_CREATOR, dmModeReadWrite);
        if (cats != 0) {
          AlarmReset(cats);
          DmCloseDatabase(cats);
        }
      }
    }

  }

  return 0;
}
Ejemplo n.º 6
0
/***********************************************************************
 * handling for the main drop down menu actions
 ***********************************************************************/
Boolean
HandleMenuEvent (UInt16 command)
{
  Boolean handled = false;
  MenuEraseStatus(0);
  gMenuCurrentForm=FrmGetFormId(FrmGetActiveForm());

  switch (command) {
  case MENUITEM_about:
    FrmDoDialog(FrmInitForm(FORM_about));
    handled=true;
    break;

  case MENUITEM_course:
    AddCourse();
    handled=true;
    break;

  case MENUITEM_time:
    if (CountCourses() != 0) {
      AddTime();
    } else {
      FrmAlert(ALERT_nocourses);
    }
    handled=true;
    break;

  case MENUITEM_courselist:
    FrmGotoForm(FORM_courselist);
    handled=true;
    break;

  case MENUITEM_settings:
    FrmPopupForm(FORM_settings);
    handled=true;
    break;

  case MENUITEM_alarm:
    FrmPopupForm(FORM_alarm_sets);
    handled=true;
    break;

  case MENUITEM_exams:
    FrmGotoForm(FORM_exams);
    handled=true;
    break;

  case MENUITEM_beam:
    BeamSemester(DatabaseGetCat());
    handled=true;
    break;

  case MENUITEM_chat:
    AppLaunchWithCommand(UNICHAT_APP_CREATOR, sysAppLaunchCmdNormalLaunch, NULL);
    handled=true;
    break;

  case MENUITEM_mensa:
    AppLaunchWithCommand(UNIMENSA_APP_CREATOR, sysAppLaunchCmdNormalLaunch, NULL);
    handled=true;
    break;

  default:
    break;
  }

  return handled;
}