MorePalmOS
A development library for developing Palm OS applications

MoreSystemMgr.c

Go to the documentation of this file.
00001 /******************************************************************************
00002  * MorePalmOS
00003  * Copyright (c) 2004 Steven Fisher
00004  *
00005  * Distributed under the Boost Software License, Version 1.0. See accompanying
00006  * license file License.txt or <http://www.boost.org/LICENSE_1_0.txt>.
00007  *
00008  * http://morepalmos.sourceforge.net
00009  *
00010  *   MorePalmOS is the humble begining of an attempt to provide a library for
00011  *   Palm OS development which works around system bugs, illustrate how to
00012  *   use system calls, and provide "glue code" for programming Palm OS
00013  *   applications in a more straightforward way while minimally impacting
00014  *   code size.
00015  *****************************************************************************/
00016 
00017 #include "MorePrefix.h"
00018 #include "MoreSystemMgr.h"
00019 #include "MorePrivate.h"
00020 
00021 #include <AppLaunchCmd.h>
00022 #include <FeatureMgr.h>
00023 #include <Form.h>
00024 
00025 Boolean MSysRomVersionCompatible( UInt32 requiredVersion,
00026                                 UInt16 launchFlags, UInt16 alertID )
00027 {
00028         UInt16 safeToCallAlertFlags;
00029         UInt32 romVersion;
00030 
00031         // See if we're on in minimum required version of the ROM or later.
00032         FtrGet( sysFtrCreator, sysFtrNumROMVersion, &romVersion );
00033         _require( romVersion >= requiredVersion, fail );
00034         return errNone;
00035 fail:
00036         safeToCallAlertFlags =
00037                 sysAppLaunchFlagNewGlobals | sysAppLaunchFlagUIApp;
00038         if ( ( launchFlags & ( safeToCallAlertFlags ) )== safeToCallAlertFlags )
00039         {
00040                 if ( alertID )
00041                         FrmAlert( alertID );
00042                 // Pilot 1.0 will continuously relaunch this app unless we switch to
00043                 // a safe one.
00044                 if ( romVersion < sysMakeROMVersion( 2, 0, 0, sysROMStageRelease, 0 ) )
00045                         AppLaunchWithCommand( sysFileCDefaultApp,
00046                                 sysAppLaunchCmdNormalLaunch, NULL );
00047         }
00048         return sysErrRomIncompatible;
00049 }
00050 
00051 Err MSysGetMyCreatorID( CreatorID_t* creatorId )
00052 {
00053         InternalCardNum_t card;
00054         LocalID db;
00055         Err err;
00056         err = SysCurAppDatabase( &card, &db );
00057         _reject( err, fail );
00058         err = DmDatabaseInfo( card, db, NULL, NULL, NULL, NULL, NULL, NULL,
00059                                                   NULL, NULL, NULL, NULL, creatorId );
00060         // fall thru
00061 fail:
00062         return err;
00063 }

SourceForge.net Logo