home *** CD-ROM | disk | FTP | other *** search
- /*
- Program to change Serial/IR settings to "Cradle" and start a local HotSync
- Should be installed to be launched when the HotSync-button
- on the craddle is pressed.
-
- (C)1999 Anders Gustafsson - andersg@funcform.se
-
- This program and sourcecode may be freely distributed as long as this
- text isn't removed and any modifications to the program are distributed free.
-
- The author is NOT responsible for any damages caused by this program.
-
- v0.2 (990627 13:00) Fully functional version
- v0.1 (990627 02:00) First version
-
-
- TODO: reset Serial/IR settings to IR when HotSync is completed
-
- */
-
-
- #include <Common.h>
- #include <System/SerialMgr.h>
- #include <System/Preferences.h>
- #include "SerIR.h"
-
-
- static void StartSyncApplication(){
- LocalID mDBID;
- UInt mCardNo;
- DmSearchStateType mSearchState;
-
- DmGetNextDatabaseByTypeCreator(true, &mSearchState, sysFileTApplication, sysFileCSync, true, &mCardNo, &mDBID);
- SysUIAppSwitch(mCardNo, mDBID, sysAppLaunchCmdSyncRequestLocal, NULL);
-
- }
-
- static void DisableSerialViaIR(){
- Err err;
- UInt refNum;
- SerIrPanelPreferencesType mSIRprefs;
-
- err = SysLibFind("SerIrCOMM Lib", &refNum);
-
- if (!err){
- SerControl(refNum,serIrCommCtlSysLibFindPatchEnable,(VoidPtr) 0,(WordPtr)0);
- mSIRprefs.serIrSelection=eSerIrUseCable;
- PrefSetAppPreferences(serIrPanelCreator, serIrPanelPrefsID,serIrPanelPrefsVersionNum,&mSIRprefs, sizeof(SerIrPanelPreferencesType),serIrPanelPrefsSaved);
- }
-
- }
-
-
- static DWord StarterPilotMain(Word cmd, Ptr cmdPBP, Word launchFlags){
-
- if(cmd==sysAppLaunchCmdSyncRequestLocal || cmd==sysAppLaunchCmdNormalLaunch){
- DisableSerialViaIR();
- StartSyncApplication();
- }
-
- return 0;
- }
-
- DWord PilotMain( Word cmd, Ptr cmdPBP, Word launchFlags){
- return StarterPilotMain(cmd, cmdPBP, launchFlags);
- }
-
-