smslib.pp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. (******************************************************************************
  2. *
  3. * Copyright (c) 1997-2000 Palm, Inc. or its subsidiaries.
  4. * All rights reserved.
  5. *
  6. * File: SmsLib.h
  7. *
  8. * Release: Palm OS SDK 4.0 (63220)
  9. *
  10. * Description:
  11. * Include file for PalmOS SMS Library
  12. *
  13. * History:
  14. * 1/26/00 Created by Hatem Oueslati
  15. * 3/01/00 Ludovic Ferrandis - Add API
  16. * 8/28/00 Ludovic Ferrandis - Update structure
  17. *
  18. *****************************************************************************)
  19. unit smslib;
  20. interface
  21. uses palmos, errorbase, exgmgr, telephonymgrui, telephonymgrtypes, telephonymgr;
  22. // The Sms library is used as an Exchange library. ExgLib.h defines all the
  23. // primary entrypoints into the library. The rest of this include file defines the
  24. // specials opCodes used in the ExgControl function and the structure used in the
  25. // socketRef field of the Exchange Manager Socket structure.
  26. (****************************************************************************
  27. *
  28. * ExgLibControl opcodes
  29. *
  30. ****************************************************************************)
  31. // Those Op codes take SmsPrefType as parameter
  32. const
  33. exgLibSmsPrefGetOp = exgLibCtlSpecificOp or 1;
  34. exgLibSmsPrefGetDefaultOp = exgLibCtlSpecificOp or 2;
  35. exgLibSmsPrefSetOp = exgLibCtlSpecificOp or 3;
  36. // This Op code takes a network type constant as parameter kSmsNetworkXxx
  37. exgLibSmsPrefDisplayOp = exgLibCtlSpecificOp or 4;
  38. // This Op code takes an UInt16 as parameter
  39. exgLibSmsIncompleteGetCountOp = exgLibCtlSpecificOp or 5;
  40. // This OpCode takes a SmsID (UInt16) as parameter
  41. exgLibSmsIncompleteDeleteOp = exgLibCtlSpecificOp or 6;
  42. (****************************************************************************
  43. *
  44. * Types and Constants
  45. *
  46. ****************************************************************************)
  47. const
  48. kSmsLibName = 'SMS Library'; // name of Sms library
  49. // Feature Creators and numbers, for use with the FtrGet() call. This
  50. // feature can be obtained to get the current version of the Sms Library
  51. const
  52. kSmsFtrNumVersion = UInt16(0);
  53. // $MMmfsbbb, where MM is major version, m is minor version
  54. // f is bug fix, s is stage: 3-release, 2-beta, 1-alpha, 0-development,
  55. // bbb is build number for non-releases
  56. // V1.12b3 would be: $01122003
  57. // V2.00a2 would be: $02001002
  58. // V1.01 would be: $01013000
  59. const
  60. kSmsMessageRegExtensionType = 'sms';
  61. kSmsReportRegExtensionType = 'rps';
  62. kSmsExtensionTypeLength = 3;
  63. kSmsScheme = '_sms';
  64. kSmsMaxPhoneSize = kTelMaxPhoneNumberLen + 1; // Max length for Phone number
  65. kSmsNBSConverter = UInt8(0); // NBS header will be add to the data
  66. kSmsNoConverter = UInt8(1); // No header will be add to the data.
  67. kSmsRowDataEncoding = UInt8(0); // 8 bit encoding scheme
  68. kSmsTextEncoding = UInt8(1); // 7 bit compressed encoding scheme.
  69. kSmsNetworkAuto = UInt8(-1);
  70. kSmsNetworkCDMA = UInt8(kTelNwkCDMA);
  71. kSmsNetworkGSM = UInt8(kTelNwkGSM);
  72. kSmsNetworkTDMA = UInt8(kTelNwkTDMA);
  73. kSmsNetworkPDC = UInt8(kTelNwkPDC);
  74. kSmsMessageType = UInt8(0);
  75. kSmsIncompleteType = UInt8(1);
  76. kSmsReportType = UInt8(2);
  77. (****************************************************************************
  78. *
  79. * Sms Error
  80. *
  81. ****************************************************************************)
  82. const kSmsErrMaxSizeExceeded = smsErrorClass or $01; // Message exceeds maximum size supported by network
  83. (****************************************************************************
  84. *
  85. * Data Structures
  86. *
  87. ****************************************************************************)
  88. (****************************************************************************
  89. * Report parameters
  90. ****************************************************************************)
  91. (* Report Parameters Type
  92. ---------------------- *)
  93. type
  94. SmsReportParamsType = record
  95. timeStamp: UInt32; // TimeStamp of the report (when delivered, or last attempt, ...)
  96. index: UInt16; // SMS index on the phone storage
  97. reportType: UInt8; // Delivery report type
  98. report: UInt8; // Status report indicator
  99. originatingAddress: PChar; // Phone number to which belong the report (was sent)
  100. end;
  101. SmsReportParamsTag = SmsReportParamsType;
  102. SmsReportParamsPtr = ^SmsReportParamsType;
  103. (****************************************************************************
  104. * Send parameters
  105. ****************************************************************************)
  106. (* Advanced Parameters Type for TDMA & CDMA network
  107. ------------------------------------------------ *)
  108. type
  109. SmsSendCDMAParamsType = record
  110. messageType: UInt8; // Message Type
  111. deferredDate: TelSmsDateTimeType;
  112. priority: UInt8;
  113. privacy: UInt8;
  114. bits: UInt8;
  115. {
  116. alertOnDelivery: UInt8 ; //:1
  117. manualAckRequest: UInt8; //:1
  118. reserved: UInt8; //:6
  119. }
  120. callbackNumber: PChar; // Address to reply
  121. end;
  122. SmsSendCDMAParamsTag = SmsSendCDMAParamsType;
  123. SmsSendCDMAParamsPtr = ^SmsSendCDMAParamsType;
  124. SmsSendTDMAParamsType = SmsSendCDMAParamsType;
  125. SmsSendTDMAParamsPtr = ^SmsSendCDMAParamsType;
  126. (* Advanced Parameters Type for GSM network
  127. ---------------------------------------- *)
  128. type
  129. SmsSendGSMParamsType = record
  130. protocolId: UInt16; // Reserved - not supported (Fax, paging, . . .)
  131. serviceCenterNumber: PChar; // SMS Center number - Optionel
  132. rejectDuplicated: Boolean; // Network must reject msg if the same exists
  133. replyPath: Boolean; // Use reply specified path
  134. end;
  135. SmsSendGSMParamsTag = SmsSendGSMParamsType;
  136. SmsSendGSMParamsPtr = ^SmsSendGSMParamsType;
  137. (* SMS Send Parameters Type
  138. ------------------------ *)
  139. type
  140. SmsSendParamsType = record
  141. validityPeriod: TelSmsDateTimeType; // SMS validity Period
  142. destinationAddress: PChar; // recipient number -> to send the sms to
  143. bits: UInt8;
  144. {
  145. networkDeliveryRequested: UInt8; // (:1) Sms report wanted
  146. ignoreDefaultValue: UInt8; // (:1) If false, the field validityPeriod, ackRequested, reportRequested, smsCenter are ignored.
  147. reserved: UInt8; // (:6)
  148. }
  149. partCount: UInt16; // number of parts of the SMS (output)
  150. lastPart: UInt16; // if error, the last part sent (output)
  151. converter: UInt8; // How the data are going to be typed (0 = NBS, 1 = None)
  152. case Integer of // union 'protocol'
  153. 1: (gsm: SmsSendGSMParamsType);
  154. 2: (cdma: SmsSendCDMAParamsType);
  155. 3: (tdma: SmsSendTDMAParamsType);
  156. end;
  157. SmsSendParamsTag = SmsSendParamsType;
  158. SmsSendParamsPtr = ^SmsSendParamsType;
  159. (****************************************************************************
  160. * Receive parameters
  161. ****************************************************************************)
  162. (* Advanced Parameters Type for TDMA & CDMA network
  163. ----------------------------------------------- *)
  164. type
  165. SmsReceiveCDMAParamsType = record
  166. messageType: UInt8; // Delivery Message Type
  167. validityPeriod: TelSmsDateTimeType;
  168. priority: UInt8;
  169. privacy: UInt8;
  170. alertOnDeliveryRequest: Boolean;
  171. manualAckRequest: Boolean;
  172. voiceMessageNumber: UInt8;
  173. languageIndicator: UInt8;
  174. callbackNumberAddress: PChar; // Store callback address
  175. end;
  176. SmsReceiveCDMAParamsTag = SmsReceiveCDMAParamsType;
  177. SmsReceiveCDMAParamsPtr = ^SmsReceiveCDMAParamsType;
  178. SmsReceiveTDMAParamsType = SmsReceiveCDMAParamsType;
  179. SmsReceiveTDMAParamsPtr = ^SmsReceiveCDMAParamsType;
  180. (* Advanced Parameters Type for GSM network
  181. ---------------------------------------- *)
  182. type
  183. SmsReceiveGSMParamsType = record
  184. protocolId: UInt16; // reserved - not supported
  185. serviceCenterNumber: PChar;
  186. replyPath: Boolean; // Must use specified reply path
  187. end;
  188. SmsReceiveGSMParamsTag = SmsReceiveGSMParamsType;
  189. SmsReceiveGSMParamsPtr = ^SmsReceiveGSMParamsType;
  190. (* SMS Receive Parameters Type
  191. --------------------------- *)
  192. type
  193. SmsReceiveParamsType = record
  194. timeStamp: UInt32; // Palm
  195. originatingAddress: PChar; // originating number -> to send the sms to
  196. bits: UInt8;
  197. {
  198. leaveOnPhone: UInt8 // (:1) Received messages won't be deleted on the phone (Input)
  199. forceSlotMode: UInt8 // (:1) Force parsing methode to Slot Mode (default is Block mode) (Input)
  200. reserved: UInt8 // (:6)
  201. }
  202. index: UInt16; // Index of the storage in the mobile where the message is stored
  203. otherToReceive: Boolean;
  204. reportDeliveryIndicator: Boolean;
  205. case Integer of // union 'protocol'
  206. 1: (gsm: SmsReceiveGSMParamsType);
  207. 2: (cdma: SmsReceiveCDMAParamsType);
  208. 3: (tdma: SmsReceiveTDMAParamsType);
  209. end;
  210. SmsReceiveParamsTag = SmsReceiveParamsType;
  211. SmsReceiveParamsPtr = ^SmsReceiveParamsType;
  212. (****************************************************************************
  213. * Sms parameters
  214. ****************************************************************************)
  215. (* SMS Parameters Type
  216. ------------------- *)
  217. type
  218. SmsParamsType = record
  219. creator: UInt32; // MUST ALWAYS BE SET TO sysFileCSmsLib
  220. smsID: UInt16; // ID of the SMS (output)
  221. extension: PChar; // Extension type of the data - Optionel (Output)
  222. mimeTypes: PChar; // Mime type of object - Optionel (Output)
  223. appCreator: UInt32; // Application Creator of the target - Optionel (Output)
  224. dataCodingScheme: UInt8; // How SMS are going to convert the data (0 = 8 bit, 1 = 7 bit)
  225. networkType: UInt8; // Indicates the type of advanced parameters (input - output)
  226. dataType: UInt8; // Indicates the kind of message: Sms, incomplete Sms, Report (Output)
  227. nbsDestPort: UInt16; // NBS port to use to encode the data (input) - port used in received Sms (output)
  228. nbsSrcPort: UInt16; // NBS port to use to encode the data (input) - port used in received Sms (output)
  229. case Integer of // union 'data'
  230. 1: (send: SmsSendParamsType);
  231. 2: (receive: SmsReceiveParamsType);
  232. 3: (report: SmsReportParamsType);
  233. end;
  234. SmsParamsTag = SmsParamsType;
  235. SmsParamsPtr = ^SmsParamsType;
  236. (* Preferences Type
  237. ------------------- *)
  238. type
  239. SmsPrefType = record
  240. validity: UInt32; // Validity period of SMS (relatif) in seconds
  241. warnOver: UInt16; // Display an alert if sending more Sms than this value.
  242. leave: Boolean; // Leave SMS on Phone
  243. report: Boolean; // Ask for a network delivery report
  244. autoSMSC: Boolean; // If set, don't use the value stored in smscNumber field
  245. smscNumber: array [1..kSmsMaxPhoneSize] of Char; // SMS Service Center. Could be null
  246. end;
  247. SmsPrefTag = SmsPrefType;
  248. SmsPrefPtr = ^SmsPrefType;
  249. implementation
  250. end.