exgmgr.pp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. {$MACRO ON}
  2. (******************************************************************************
  3. *
  4. * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
  5. * All rights reserved.
  6. *
  7. * File: ErrorMgr.h
  8. *
  9. * Release: Palm OS SDK 4.0 (63220)
  10. *
  11. * Description:
  12. * Include file for Error Management that depend on ERROR_CHECK_LEVEL
  13. * All the rest of the old ErrorMgr.h is in ErrorBase.h
  14. *
  15. * History:
  16. * 10/25/94 RM - Created by Ron Marianetti
  17. * 10/9/98 Bob - Fill in all macros, fix defns w/ do{}while(0)
  18. * 7/21/99 Bob - split invariant stuff out into ErrorBase.h
  19. * 12/23/99 jmp Fix <> vs. "" problem.
  20. *
  21. *****************************************************************************)
  22. {$IFNDEF FPC_DOTTEDUNITS}
  23. unit exgmgr;
  24. {$ENDIF FPC_DOTTEDUNITS}
  25. interface
  26. {$IFDEF FPC_DOTTEDUNITS}
  27. uses PalmApi.Palmos, PalmApi.Coretraps, PalmApi.Errorbase, PalmApi.Datamgr;
  28. {$ELSE FPC_DOTTEDUNITS}
  29. uses palmos, coretraps, errorbase, datamgr;
  30. {$ENDIF FPC_DOTTEDUNITS}
  31. const
  32. exgMemError = exgErrorClass or 1;
  33. exgErrStackInit = exgErrorClass or 2; // stack could not initialize
  34. exgErrUserCancel = exgErrorClass or 3;
  35. exgErrNoReceiver = exgErrorClass or 4; // receiver device not found
  36. exgErrNoKnownTarget = exgErrorClass or 5; // can't find a target app
  37. exgErrTargetMissing = exgErrorClass or 6; // target app is known but missing
  38. exgErrNotAllowed = exgErrorClass or 7; // operation not allowed
  39. exgErrBadData = exgErrorClass or 8; // internal data was not valid
  40. exgErrAppError = exgErrorClass or 9; // generic application error
  41. exgErrUnknown = exgErrorClass or 10; // unknown general error
  42. exgErrDeviceFull = exgErrorClass or 11; // device is full
  43. exgErrDisconnected = exgErrorClass or 12; // link disconnected
  44. exgErrNotFound = exgErrorClass or 13; // requested object not found
  45. exgErrBadParam = exgErrorClass or 14; // bad parameter to call
  46. exgErrNotSupported = exgErrorClass or 15; // operation not supported by this library
  47. exgErrDeviceBusy = exgErrorClass or 16; // device is busy
  48. exgErrBadLibrary = exgErrorClass or 17; // bad or missing ExgLibrary
  49. type
  50. ExgGoToType = record
  51. dbCardNo: UInt16; // card number of the database
  52. dbID: LocalID; // LocalID of the database
  53. recordNum: UInt16; // index of record that contain a match
  54. uniqueID: UInt32; // postion in record of the match.
  55. matchCustom: UInt32; // application specific info
  56. end;
  57. ExgGoToPtr = ^ExgGoToType;
  58. ExgSocketType = record
  59. libraryRef: UInt16; // identifies the Exg library in use
  60. socketRef: UInt32; // used by Exg library to identify this connection
  61. target: UInt32; // Creator ID of application this is sent to
  62. count: UInt32; // # of objects in this connection (usually 1)
  63. length: UInt32; // # total byte count for all objects being sent (optional)
  64. time: UInt32; // last modified time of object (optional)
  65. appData: UInt32; // application specific info
  66. goToCreator: UInt32; // creator ID of app to launch with goto after receive
  67. goToParams: ExgGoToType; // If launchCreator then this contains goto find info
  68. bits: UInt16;
  69. {
  70. UInt16 localMode:1; // Exchange with local machine only mode
  71. UInt16 packetMode:1; // Use connectionless packet mode (Ultra)
  72. UInt16 noGoTo:1; // Do not go to app (local mode only)
  73. UInt16 noStatus:1; // Do not display status dialogs
  74. UInt16 reserved:12; // reserved system flags
  75. }
  76. description: PAnsiChar; // text description of object (for user)
  77. type_: PAnsiChar; // Mime type of object (optional)
  78. name: PAnsiChar; // name of object, generally a file name (optional)
  79. end;
  80. ExgSocketPtr = ^ExgSocketType;
  81. // structures used for sysAppLaunchCmdExgAskUser launch code parameter
  82. // default is exgAskDialog (ask user with dialog...
  83. type
  84. ExgAskResultType = Enum;
  85. const
  86. exgAskDialog = 0;
  87. exgAskOk = Succ(exgAskDialog);
  88. exgAskCancel = Succ(exgAskOk);
  89. type
  90. ExgAskParamType = record
  91. socketP: ExgSocketPtr;
  92. result: ExgAskResultType; // what to do with dialog
  93. reserved: UInt8;
  94. end;
  95. ExgAskParamPtr = ^ExgAskParamType;
  96. // Optional parameter structure used with ExgDoDialog for category control
  97. ExgDialogInfoType = record
  98. version: UInt16; // version of this structure (should be zero)
  99. db: DmOpenRef; // open database ref (for category information)
  100. categoryIndex: UInt16; // index of selected category
  101. end;
  102. const
  103. exgSeparatorChar = #9; // '\t' AnsiChar used to separate multiple registry entries
  104. exgRegLibraryID = $fffc; // library register thier presence
  105. exgRegExtensionID = $fffd; // filename extenstion registry
  106. exgRegTypeID = $fffe; // MIME type registry
  107. exgDataPrefVersion = 0;
  108. exgMaxTitleLen = 20; // max size for title from exgLibCtlGetTitle
  109. exgLibCtlGetTitle = 1; // get title for Exg dialogs
  110. exgLibCtlSpecificOp = $8000; // start of range for library specific control codes
  111. type
  112. ExgDBReadProc = function(dataP: Pointer; var sizeP: UInt32; userDataP: Pointer): Err;
  113. ExgDBDeleteProc = function(const nameP: PAnsiChar; version, cardNo: UInt16; dbID: LocalID; userDataP: Pointer): Boolean;
  114. ExgDBWriteProc = function(const dataP: Pointer; var sizeP: UInt32; userDataP: Pointer): Err;
  115. function ExgInit: Err; syscall sysTrapExgInit;
  116. function ExgConnect(socketP: ExgSocketPtr): Err; syscall sysTrapExgConnect;
  117. function ExgPut(socketP: ExgSocketPtr): Err; syscall sysTrapExgPut;
  118. function ExgGet(socketP: ExgSocketPtr): Err; syscall sysTrapExgGet;
  119. function ExgAccept(socketP: ExgSocketPtr): Err; syscall sysTrapExgAccept;
  120. function ExgDisconnect(socketP: ExgSocketPtr; error: Err): Err; syscall sysTrapExgDisconnect;
  121. function ExgSend(socketP: ExgSocketPtr; const bufP: Pointer; const bufLen: UInt32; var err: Err): UInt32; syscall sysTrapExgSend;
  122. function ExgReceive(socketP: ExgSocketPtr; bufP: Pointer; const bufLen: UInt32; var err: Err): UInt32; syscall sysTrapExgReceive;
  123. function ExgRegisterData(const creatorID: UInt32; const id: UInt16; const dataTypesP: PAnsiChar): Err; syscall sysTrapExgRegisterData;
  124. function ExgNotifyReceive(socketP: ExgSocketPtr): Err; syscall sysTrapExgNotifyReceive;
  125. function ExgDBRead(readProcP: ExgDBReadProc; deleteProcP: ExgDBDeleteProc;
  126. userDataP: Pointer; var dbIDP: LocalID; cardNo: UInt16;
  127. var needResetP: Boolean; keepDates: Boolean): Err; syscall sysTrapExgDBRead;
  128. function ExgDBWrite(writeProcP: ExgDBWriteProc;
  129. userDataP: Pointer; const nameP: PAnsiChar; dbID: LocalID; cardNo: UInt16): Err; syscall sysTrapExgDBWrite;
  130. function ExgDoDialog(socketP: ExgSocketPtr; var infoP: ExgDialogInfoType; var errP: Err): Boolean; syscall sysTrapExgDoDialog;
  131. implementation
  132. end.