exgmgr.pp 6.5 KB

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