helper.pp 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. (******************************************************************************
  2. *
  3. * Copyright (c) 2000 Palm, Inc. or its subsidiaries.
  4. * All rights reserved.
  5. *
  6. * File: Helper.h
  7. *
  8. * Release: Palm OS SDK 4.0 (63220)
  9. *
  10. * Description:
  11. * Public header file for the Helper API.
  12. *
  13. *****************************************************************************)
  14. unit helper;
  15. interface
  16. uses palmos;
  17. //------------------------------------------------------------------------
  18. // HelperNotifyEventType structure
  19. // This structure is passed as the notifyDetailsP field of SysNotifyParamType with
  20. // a sysNotifyHelperEvent notificatiom.
  21. //------------------------------------------------------------------------
  22. const
  23. kHelperNotifyCurrentVersion = 1;
  24. // Action codes for the sysNotifyHelperEvent broadcast (used in HelperNotifyEventType)
  25. type
  26. HelperNotifyActionCodeType = UInt16;
  27. const
  28. kHelperNotifyActionCodeEnumerate = HelperNotifyActionCodeType(1);
  29. kHelperNotifyActionCodeValidate = HelperNotifyActionCodeType(2);
  30. kHelperNotifyActionCodeExecute = HelperNotifyActionCodeType(3);
  31. type
  32. HelperNotifyEventTypeTag = record
  33. // Version - this definition is version 1
  34. // Later versions should include all the same fields as version 1
  35. // of HelperNotifyEventType plus additional fields
  36. version: UInt16;
  37. // what to do: enumerate, validate, or do it.
  38. actionCode: HelperNotifyActionCodeType;
  39. // data specific to the action code - valid if version = 1 for now
  40. case Integer of
  41. 1: (enumerateP: Pointer {^HelperNotifyEnumerateListTypeTag});
  42. 2: (validateP: Pointer {^HelperNotifyValidateTypeTag});
  43. 3: (executeP: Pointer {^HelperNotifyExecuteTypeTag});
  44. end;
  45. HelperNotifyEventType = HelperNotifyEventTypeTag;
  46. //------------------------------------------------------------------------
  47. // HelperNotifyEnumerateListType structure
  48. // An element in a linked list of helpers (used below)...
  49. //------------------------------------------------------------------------
  50. // In an helperNotifyActionCodeEnumerate response, this should be allocated
  51. // by the helper in the heap with MemPtrNew() and changed to be owned by the
  52. // system. It will be freed by the broadcaster. If a helper supports multiple
  53. // service classes, it should create multiple entries.
  54. //
  55. const
  56. kHelperAppMaxNameSize = 48; // max. helper name length, including zero-
  57. // terminator, expressed in # of bytes
  58. kHelperAppMaxActionNameSize = 32; // max. helper action name length, including
  59. // zero-terminator, expressed in # of
  60. // bytes
  61. type
  62. HelperNotifyEnumerateListTypeTag = record
  63. // Pointer to the next element in the list, or NULL to signal end of list.
  64. nextP: ^HelperNotifyEnumerateListType;
  65. // The name of the helper to show to the user (for example, when choosing
  66. // a default/preferred helper for a given class of service; zero-terminated
  67. // string).
  68. helperAppName: array [0..kHelperAppMaxNameSize-1] of Char;
  69. // Custom text that represents the action to be taken, such as "Dial",
  70. // "Send fax", etc. (for display in an action pop-up, or button, for example);
  71. // zero-terminated string.
  72. actionName: array [0..kHelperAppMaxActionNameSize-1] of Char;
  73. // The registered, unique ID of the helper (typically the helper app's
  74. // creator ID).
  75. helperAppID: UInt32;
  76. // Services class ID supported by the helper; for example:
  77. // helperServiceClassIDEMail (see HelperServiceClass.h)
  78. serviceClassID: UInt32;
  79. end;
  80. HelperNotifyEnumerateListType = HelperNotifyEnumerateListTypeTag;
  81. //------------------------------------------------------------------------
  82. // HelperNotifyValidateType structure
  83. // Data type for the helperNotifyActionCodeValidate event.
  84. //------------------------------------------------------------------------
  85. // The matching helper(s) must set the "handled" field of SysNotifyParamType
  86. // to true.
  87. HelperNotifyValidateTypeTag = record
  88. // IN: Service Class ID of requested service (required); for example:
  89. // helperServiceClassIDEMail (see HelperServiceClass.h)
  90. serviceClassID: UInt32;
  91. // IN: The unique ID of the Helper; may be 0 (zero) to indicate any
  92. // available helper of the specified service class;
  93. helperAppID: UInt32;
  94. end;
  95. HelperNotifyValidateType = HelperNotifyValidateTypeTag;
  96. //------------------------------------------------------------------------
  97. // Data type for the helperNotifyActionCodeExecute event
  98. //------------------------------------------------------------------------
  99. //
  100. // The target helper that processes the request must set the "handled" field
  101. // of SysNotifyParamType to true, even if a failure occurred during processing.
  102. // The 'err' field of the HelperNotifyExecuteType structure is used to indicate
  103. // success or failure.
  104. //
  105. // Helpers must check if the "handled" field in HelperNotifyEventType structure is
  106. // already set, and *not* process the "execute" request if so.
  107. //
  108. // The helper is responsible for informing user of any errors.
  109. //
  110. HelperNotifyExecuteTypeTag = record
  111. // IN: Service Class ID of requested service (required); for example:
  112. // helperServiceClassIDEMail (see HelperServiceClass.h)
  113. serviceClassID: UInt32;
  114. // IN: The unique ID of the Helper; may be 0 (zero) to indicate any
  115. // available helper of the specified service class;
  116. helperAppID: UInt32;
  117. // IN: Service-dependent data string, such as a phone number or email
  118. // address (see HelperServiceClass.h for data that is appropriate for
  119. // each of the "common" service classes); zero-terminated; will be
  120. // duplicated by helper if necessary (ex. "1-650-123-4567",
  121. // "[email protected]", etc.). Multiple fields may be separated by
  122. // semicolons (';').
  123. dataP: PChar;
  124. // IN: Description of data; zero-terminated; will be duplicated by helper
  125. // if necessary (ex. "John Doe"); this field is optional -- may be NULL.
  126. displayedName: PChar;
  127. // IN: Pointer to a service-specific extended details data structure or NULL.
  128. // This optional field is used for supplying additional arguments to the
  129. // helper. The type of each of these data structures is well-defined
  130. // and associated with a specific helper service class; will be duplicated
  131. // by helper if necessary; may be ignored by helper.
  132. detailsP: Pointer;
  133. // OUT: service-specific error code; must be initialize to 0 (zero) by host
  134. // before broadcasting this request. 0 is used to signal success (although
  135. // this may only be an indication that a request was scheduled and may
  136. // not be performed until an app switch takes place).
  137. err: Err;
  138. end;
  139. HelperNotifyExecuteType = HelperNotifyExecuteTypeTag;
  140. implementation
  141. end.