/packages/winceunits/src/sms.pp

https://github.com/slibre/freepascal · Puppet · 582 lines · 512 code · 70 blank · 0 comment · 27 complexity · c1826cd5ee631c1b8068a0774f7d5d4b MD5 · raw file

  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2008 Free Pascal development team.
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. ********************************************************************** }
  10. //
  11. // Module: sms.h
  12. //
  13. //
  14. // Microsoft Windows Mobile 6.0 for PocketPC SDK.
  15. //
  16. unit sms;
  17. {$CALLING cdecl}
  18. interface
  19. uses Windows;
  20. //
  21. // Errors
  22. //
  23. const
  24. FACILITY_SMS = $0200;
  25. // MAKE_HRESULT rules OK!
  26. // Specific registration errors (for SmsSetMessageNotification, SmsClearMessageNotification)
  27. const
  28. SMS_E_INVALIDPROTOCOL = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0001;
  29. SMS_E_REGISTRATIONEXISTS = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0002;
  30. SMS_S_NOSUCHREGISTRATION = (SEVERITY_SUCCESS shl 31) or (FACILITY_SMS shl 16) or $0003;
  31. // Specific messaging errors (for SmsOpen, SmsSendMessage, SmsGetSMSC, etc.)
  32. SMS_E_TOOMUCHDATA = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0100;
  33. SMS_E_INVALIDDATA = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0101;
  34. SMS_E_BUFFERTOOSMALL = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0102;
  35. SMS_E_PROVIDERSPECIFICBUFFERWRONGSIZE = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0103;
  36. SMS_E_TIMEUNAVAILABLE = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0104;
  37. SMS_E_RECEIVEHANDLEALREADYOPEN = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0105;
  38. SMS_E_DESTINATIONOUTOFSVC = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0106;
  39. SMS_E_INVALIDADDRESS = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0107;
  40. SMS_E_MSGBARREDBYOPERATOR = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0108;
  41. SMS_E_MSGCALLBARRED = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0109;
  42. SMS_E_NOSCSUBSCRIPTION = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010a;
  43. SMS_E_SCBUSY = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010b;
  44. SMS_E_SVCNOTSUBSCRIBED = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010c;
  45. SMS_E_UNASSIGNEDNUMBER = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010d;
  46. SMS_E_UNKNOWNSCADDRESS = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010e;
  47. SMS_E_UNIDENTIFIEDSUBCRIBER = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $010f;
  48. SMS_E_FDNRESTRICT = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0110;
  49. // General SMS messaging errors
  50. SMS_E_MISC = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0200;
  51. SMS_E_PASSWORD = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0201;
  52. SMS_E_SIM = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0202;
  53. SMS_E_NETWORKACCESS = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0203;
  54. SMS_E_NETWORK = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0204;
  55. SMS_E_MOBILE = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0205;
  56. SMS_E_NETWORKUNSUPPORTED = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0206;
  57. SMS_E_MOBILEUNSUPPORTED = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0207;
  58. SMS_E_BADPARAM = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0208;
  59. SMS_E_STORAGE = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $0209;
  60. SMS_E_SMSC = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020a;
  61. SMS_E_DESTINATION = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020b;
  62. SMS_E_DESTINATIONUNSUPPORTED = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020c;
  63. SMS_E_RADIOUNAVAILABLE = (SEVERITY_ERROR shl 31) or (FACILITY_SMS shl 16) or $020d;
  64. //
  65. // Constants
  66. //
  67. const
  68. SMS_DATAGRAM_SIZE = 140;
  69. SMS_BROADCAST_DATAGRAM_SIZE = 82;
  70. SMS_MAX_APPNAME_LENGTH = MAX_PATH;
  71. SMS_MAX_PARAMS_LENGTH = MAX_PATH;
  72. SMS_MAX_PROTOCOLNAME_LENGTH = MAX_PATH;
  73. SMS_MAX_MESSAGEUID_SIZE = 1024;
  74. SMS_MAX_ADDRESS_LENGTH = 256;
  75. SMS_MAX_SUBADDRESS_SIZE = 256;
  76. // dwMessageModes for SmsOpen
  77. SMS_MODE_RECEIVE = $00000001;
  78. SMS_MODE_SEND = $00000002;
  79. // dwOptions for SmsSendMessage
  80. SMS_OPTION_DELIVERY_NONE = $00000000;
  81. SMS_OPTION_DELIVERY_NO_RETRY = $00000001;
  82. // dwMessageOptions for TEXT_PROVIDER_SPECIFIC_DATA
  83. PS_MESSAGE_OPTION_NONE = $00000000;
  84. PS_MESSAGE_OPTION_REPLYPATH = $00000001;
  85. PS_MESSAGE_OPTION_STATUSREPORT = $00000002;
  86. PS_MESSAGE_OPTION_DISCARD = $00000004;
  87. // dwMessageStatus0 and dwMessageStatus1 for SmsGetMessageStatus and the SMS status-message provider (SMS_MSGTYPE_STATUS)
  88. // Message status is unknown iff dwMessageStatus0 and dwMessageStatus1 are both set to MESSAGE_STATUS_UNKNOWN
  89. MESSAGE_STATUS_UNKNOWN = $00000000;
  90. // Valid bits for dwMessageStatus0
  91. MESSAGE_STATUS_0_RECEIVEDBYSME = $00000001;
  92. MESSAGE_STATUS_0_FORWARDEDTOSME = $00000002;
  93. MESSAGE_STATUS_0_REPLACEDBYSC = $00000004;
  94. MESSAGE_STATUS_0_CONGESTION_TRYING = $00000008;
  95. MESSAGE_STATUS_0_SMEBUSY_TRYING = $00000010;
  96. MESSAGE_STATUS_0_SMENOTRESPONDING_TRYING = $00000020;
  97. MESSAGE_STATUS_0_SVCREJECTED_TRYING = $00000040;
  98. MESSAGE_STATUS_0_QUALITYUNAVAIL_TRYING = $00000080;
  99. MESSAGE_STATUS_0_SMEERROR_TRYING = $00000100;
  100. MESSAGE_STATUS_0_CONGESTION = $00000200;
  101. MESSAGE_STATUS_0_SMEBUSY = $00000400;
  102. MESSAGE_STATUS_0_SMENOTRESPONDING = $00000800;
  103. MESSAGE_STATUS_0_SVCREJECTED = $00001000;
  104. MESSAGE_STATUS_0_QUALITYUNAVAIL_TEMP = $00002000;
  105. MESSAGE_STATUS_0_SMEERROR = $00004000;
  106. MESSAGE_STATUS_0_REMOTEPROCERROR = $00008000;
  107. MESSAGE_STATUS_0_INCOMPATIBLEDEST = $00010000;
  108. MESSAGE_STATUS_0_CONNECTIONREJECTED = $00020000;
  109. MESSAGE_STATUS_0_NOTOBTAINABLE = $00040000;
  110. MESSAGE_STATUS_0_NOINTERNETWORKING = $00080000;
  111. MESSAGE_STATUS_0_VPEXPIRED = $00100000;
  112. MESSAGE_STATUS_0_DELETEDBYORIGSME = $00200000;
  113. MESSAGE_STATUS_0_DELETEDBYSC = $00400000;
  114. MESSAGE_STATUS_0_NOLONGEREXISTS = $00800000;
  115. MESSAGE_STATUS_0_QUALITYUNAVAIL = $01000000;
  116. MESSAGE_STATUS_0_RESERVED_COMPLETED = $02000000;
  117. MESSAGE_STATUS_0_RESERVED_TRYING = $04000000;
  118. MESSAGE_STATUS_0_RESERVED_ERROR = $08000000;
  119. MESSAGE_STATUS_0_RESERVED_TMPERROR = $10000000;
  120. MESSAGE_STATUS_0_SCSPECIFIC_COMPLETED = $20000000;
  121. MESSAGE_STATUS_0_SCSPECIFIC_TRYING = $40000000;
  122. MESSAGE_STATUS_0_SCSPECIFIC_ERROR = $80000000;
  123. // Valid bits for dwMessageStatus1
  124. MESSAGE_STATUS_1_SCSPECIFIC_TMPERROR = $00000001;
  125. // Language identifiers for SMS_BROADCAST_RANGES.dwBroadcastMsgLangs
  126. SMS_DCSLANG_UNKNOWN = $00000001;
  127. SMS_DCSLANG_GERMAN = $00000002;
  128. SMS_DCSLANG_ENGLISH = $00000004;
  129. SMS_DCSLANG_ITALIAN = $00000008;
  130. SMS_DCSLANG_FRENCH = $00000010;
  131. SMS_DCSLANG_SPANISH = $00000020;
  132. SMS_DCSLANG_DUTCH = $00000040;
  133. SMS_DCSLANG_SWEDISH = $00000080;
  134. SMS_DCSLANG_DANISH = $00000100;
  135. SMS_DCSLANG_PORTUGUESE = $00000200;
  136. SMS_DCSLANG_FINNISH = $00000400;
  137. SMS_DCSLANG_NORWEGIAN = $00000800;
  138. SMS_DCSLANG_GREEK = $00001000;
  139. SMS_DCSLANG_TURKISH = $00002000;
  140. SMS_DCSLANG_HUNGARIAN = $00004000;
  141. SMS_DCSLANG_POLISH = $00008000;
  142. SMS_DCSLANG_CZECH = $00010000;
  143. SMS_DCSLANG_HEBREW = $00020000;
  144. SMS_DCSLANG_ARABIC = $00040000;
  145. SMS_DCSLANG_RUSSIAN = $00080000;
  146. SMS_DCSLANG_ICELANDIC = $00100000;
  147. SMS_DCSLANG_ALL = $001fffff;
  148. // Valid flags for SMS_BROADCAST_RANGES.dwParams
  149. SMS_PARAM_SBR_BROADCASTMSGIDS = $00000001;
  150. SMS_PARAM_SBR_BROADCASTMSGLANGS = $00000002;
  151. SMS_PARAM_SBR_ACCEPTIDS = $00000004;
  152. //Valid values for ProtocolID
  153. SMS_MSGPROTOCOL_UNKNOWN = $00000000;
  154. SMS_MSGPROTOCOL_SMETOSME = $00000001;
  155. SMS_MSGPROTOCOL_IMPLICIT = $00000002;
  156. SMS_MSGPROTOCOL_TELEX = $00000003;
  157. SMS_MSGPROTOCOL_TELEFAX_GROUP3 = $00000004;
  158. SMS_MSGPROTOCOL_TELEFAX_GROUP4 = $00000005;
  159. SMS_MSGPROTOCOL_VOICEPHONE = $00000006;
  160. SMS_MSGPROTOCOL_ERMES = $00000007;
  161. SMS_MSGPROTOCOL_PAGING = $00000008;
  162. SMS_MSGPROTOCOL_VIDEOTEX = $00000009;
  163. SMS_MSGPROTOCOL_TELETEX = $0000000a;
  164. SMS_MSGPROTOCOL_TELETEX_PSPDN = $0000000b;
  165. SMS_MSGPROTOCOL_TELETEX_CSPDN = $0000000c;
  166. SMS_MSGPROTOCOL_TELETEX_PSTN = $0000000d;
  167. SMS_MSGPROTOCOL_TELETEX_ISDN = $0000000e;
  168. SMS_MSGPROTOCOL_UCI = $0000000f;
  169. SMS_MSGPROTOCOL_MSGHANDLING = $00000010;
  170. SMS_MSGPROTOCOL_X400 = $00000011;
  171. SMS_MSGPROTOCOL_EMAIL = $00000012;
  172. SMS_MSGPROTOCOL_SCSPECIFIC1 = $00000013;
  173. SMS_MSGPROTOCOL_SCSPECIFIC2 = $00000014;
  174. SMS_MSGPROTOCOL_SCSPECIFIC3 = $00000015;
  175. SMS_MSGPROTOCOL_SCSPECIFIC4 = $00000016;
  176. SMS_MSGPROTOCOL_SCSPECIFIC5 = $00000017;
  177. SMS_MSGPROTOCOL_SCSPECIFIC6 = $00000018;
  178. SMS_MSGPROTOCOL_SCSPECIFIC7 = $00000019;
  179. SMS_MSGPROTOCOL_GSMSTATION = $0000001a;
  180. SMS_MSGPROTOCOL_SM_TYPE0 = $0000001b;
  181. SMS_MSGPROTOCOL_RSM_TYPE1 = $0000001c;
  182. SMS_MSGPROTOCOL_RSM_TYPE2 = $0000001d;
  183. SMS_MSGPROTOCOL_RSM_TYPE3 = $0000001e;
  184. SMS_MSGPROTOCOL_RSM_TYPE4 = $0000001f;
  185. SMS_MSGPROTOCOL_RSM_TYPE5 = $00000020;
  186. SMS_MSGPROTOCOL_RSM_TYPE6 = $00000021;
  187. SMS_MSGPROTOCOL_RSM_TYPE7 = $00000022;
  188. SMS_MSGPROTOCOL_RETURNCALL = $00000023;
  189. SMS_MSGPROTOCOL_ME_DOWNLOAD = $00000024;
  190. SMS_MSGPROTOCOL_DEPERSONALIZATION = $00000025;
  191. SMS_MSGPROTOCOL_SIM_DOWNLOAD = $00000026;
  192. //
  193. // Enumerations
  194. //
  195. type
  196. SMS_ADDRESS_TYPE = (SMSAT_UNKNOWN := 0,
  197. SMSAT_INTERNATIONAL,
  198. SMSAT_NATIONAL,
  199. SMSAT_NETWORKSPECIFIC,
  200. SMSAT_SUBSCRIBER,
  201. SMSAT_ALPHANUMERIC,
  202. SMSAT_ABBREVIATED);
  203. SMS_DATA_ENCODING = (SMSDE_OPTIMAL := 0,
  204. SMSDE_GSM,
  205. SMSDE_UCS2);
  206. PROVIDER_SPECIFIC_MESSAGE_CLASS = (PS_MESSAGE_CLASS0 := 0,
  207. PS_MESSAGE_CLASS1,
  208. PS_MESSAGE_CLASS2,
  209. PS_MESSAGE_CLASS3,
  210. PS_MESSAGE_CLASSUNSPECIFIED);
  211. PROVIDER_SPECIFIC_REPLACE_OPTION = (PSRO_NONE := 0,
  212. PSRO_REPLACE_TYPE1,
  213. PSRO_REPLACE_TYPE2,
  214. PSRO_REPLACE_TYPE3,
  215. PSRO_REPLACE_TYPE4,
  216. PSRO_REPLACE_TYPE5,
  217. PSRO_REPLACE_TYPE6,
  218. PSRO_REPLACE_TYPE7,
  219. PSRO_RETURN_CALL,
  220. PSRO_DEPERSONALIZATION);
  221. //
  222. // Types
  223. //
  224. type
  225. SMS_HANDLE = DWORD;
  226. LPSMS_HANDLE = ^SMS_HANDLE;
  227. SMS_MESSAGE_ID = DWORD;
  228. LPSMS_MESSAGE_ID = ^SMS_MESSAGE_ID;
  229. const
  230. INVALID_MESSAGE_ID = SMS_MESSAGE_ID($ffffffff);
  231. // Registration structure used by SmsSetMessageNotification and SmsClearMessageNotification
  232. type
  233. smsregistrationdata_tag = record
  234. cbSize:DWORD;
  235. tszAppName:array[0..SMS_MAX_APPNAME_LENGTH-1] of TCHAR;
  236. tszParams:array[0..SMS_MAX_PARAMS_LENGTH-1] of TCHAR;
  237. tszProtocolName:array[0..SMS_MAX_PROTOCOLNAME_LENGTH-1] of TCHAR;
  238. end;
  239. SMSREGISTRATIONDATA = smsregistrationdata_tag;
  240. LPSMSREGISTRATIONDATA = ^smsregistrationdata_tag;
  241. // SMS addressing information
  242. type
  243. sms_address_tag = record
  244. smsatAddressType:SMS_ADDRESS_TYPE;
  245. ptsAddress:array[0..SMS_MAX_ADDRESS_LENGTH-1] of TCHAR;
  246. end;
  247. SMS_ADDRESS = sms_address_tag;
  248. LPSMS_ADDRESS = ^sms_address_tag;
  249. // SMS status message information
  250. type
  251. sms_status_information_tag = record
  252. smsmidMessageID:SMS_MESSAGE_ID;
  253. dwMessageStatus0:DWORD;
  254. dwMessageStatus1:DWORD;
  255. smsaRecipientAddress:SMS_ADDRESS;
  256. stServiceCenterTimeStamp:SYSTEMTIME; // (UTC time)
  257. stDischargeTime:SYSTEMTIME; // (UTC time)
  258. end;
  259. SMS_STATUS_INFORMATION = sms_status_information_tag;
  260. LPSMS_STATUS_INFORMATION = ^sms_status_information_tag;
  261. // SMS broadcast message range information
  262. type
  263. sms_range_tag = record
  264. dwMinimum:DWORD;
  265. dwMaximum:DWORD;
  266. end;
  267. SMS_RANGE = sms_range_tag;
  268. LPSMS_RANGE = ^sms_range_tag;
  269. // SMS broadcast message ranges information
  270. // Use #pragma to avoid "warning C4200: nonstandard extension used : zero-sized array in struct/union
  271. type
  272. sms_broadcast_ranges_tag = record
  273. cbSize:DWORD;
  274. dwParams:DWORD;
  275. dwNumRanges:DWORD;
  276. dwBroadcastMsgLangs:DWORD;
  277. bAccept:BOOL;
  278. smsrBroadcastRanges:array[0..0] of SMS_RANGE;
  279. end;
  280. SMS_BROADCAST_RANGES = sms_broadcast_ranges_tag;
  281. LPSMS_BROADCAST_RANGES = ^sms_broadcast_ranges_tag;
  282. //
  283. // SMS message types (for use with SmsOpen)
  284. //
  285. // Text message type
  286. const
  287. SMS_MSGTYPE_TEXT = 'Microsoft Text SMS Protocol';
  288. // Provider-specific data for use with SmsSendMessage and SmsReadMessage
  289. // Bitfield values for the extended parameters of the text provider structure.
  290. const
  291. TEXTPSEXTPARM_NONE = $00000000;
  292. TEXTPSEXTPARM_CALLBACK = $00000001;
  293. TEXTPSEXTPARM_PRIORITY = $00000002;
  294. TEXTPSEXTPARM_ALL = $00000003;
  295. // The priority enum should match up with the RIL_MSGPRIORITY_* defines.
  296. // If any new values are added, the Priority mapping functions of sms_txtshared_cdma.cpp
  297. // should also be adjusted.
  298. type
  299. TEXT_PROVIDER_SPECIFIC_PRIORITY_TYPE = (TEXTPSPRI_NONE := 0,
  300. TEXTPSPRI_NORMAL := 1,
  301. TEXTPSPRI_INTERACTIVE,
  302. TEXTPSPRI_URGENT,
  303. TEXTPSPRI_EMERGENCY);
  304. type
  305. text_provider_specific_data_tag = record
  306. dwMessageOptions:DWORD;
  307. psMessageClass:PROVIDER_SPECIFIC_MESSAGE_CLASS;
  308. psReplaceOption:PROVIDER_SPECIFIC_REPLACE_OPTION;
  309. dwHeaderDataSize:DWORD;
  310. pbHeaderData:array[0..SMS_DATAGRAM_SIZE-1] of byte; // For concatenated messages, only the header from the first segment is returned.
  311. fMessageContainsEMSHeaders:BOOL; // At least one segment of this message contains EMS headers.
  312. // Only set if EMS handler installed.
  313. dwProtocolID:DWORD; // PID of incoming message, or desired PID of outgoing message.
  314. // Applies only to GSM. Set to SMS_MSGPROTOCOL_UNKNOWN if psReplaceOption
  315. // is not PSRO_NONE.
  316. dwExtParams:DWORD; // Bitfield of valid additional structure parameters (all structure
  317. // values above are considered always valid).
  318. tpsPriority:TEXT_PROVIDER_SPECIFIC_PRIORITY_TYPE; // Applies only to CDMA IS637. Priority indicator.
  319. smsaCallback:SMS_ADDRESS; // Applies only to CDMA IS637. Callback number
  320. end;
  321. TEXT_PROVIDER_SPECIFIC_DATA = text_provider_specific_data_tag;
  322. // Class 2 Text message type
  323. const
  324. SMS_MSGTYPE_CLASS2 = 'Microsoft Class2 SMS Protocol';
  325. type
  326. class2_provider_specific_data_tag = record
  327. dwMessageOptions:DWORD;
  328. psMessageClass:PROVIDER_SPECIFIC_MESSAGE_CLASS;
  329. psReplaceOption:PROVIDER_SPECIFIC_REPLACE_OPTION;
  330. dwHeaderDataSize:DWORD;
  331. pbHeaderData:array[0..SMS_DATAGRAM_SIZE-1] of byte; // For concatenated messages, only the header from the first segment is returned.
  332. fMessageContainsEMSHeaders:BOOL; // At least one segment of this message contains EMS headers.
  333. // Only set if EMS handler installed.
  334. dwProtocolID:DWORD; // PID of incoming message, or desired PID of outgoing message.
  335. // Applies only to GSM. Set to SMS_MSGPROTOCOL_UNKNOWN if psReplaceOption
  336. // is not PSRO_NONE.
  337. dwLocation:DWORD;
  338. dwIndex:DWORD;
  339. end;
  340. CLASS2_PROVIDER_SPECIFIC_DATA = class2_provider_specific_data_tag;
  341. // Notification message type
  342. const
  343. SMS_MSGTYPE_NOTIFICATION = 'Microsoft Notification SMS Protocol (Receive Only)';
  344. // Provider-specific data for use with SmsReadMessage
  345. type
  346. NOTIFICATION_PROVIDER_SPECIFIC_MSG_WAITING_TYPE = (NOTIFICATIONPSMWT_NONE := 0,
  347. NOTIFICATIONPSMWT_GENERIC,
  348. NOTIFICATIONPSMWT_VOICEMAIL,
  349. NOTIFICATIONPSMWT_FAX,
  350. NOTIFICATIONPSMWT_EMAIL,
  351. NOTIFICATIONPSMWT_OTHER);
  352. const
  353. NOTIFICATIONPS_NUM_MSG_WAITING_UNKNOWN = -1;
  354. NOTIFICATIONPS_NUM_MSG_WAITING_NONZERO = -2;
  355. type
  356. NOTIFICATION_PROVIDER_SPECIFIC_INDICATOR_TYPE = (NOTIFICATIONPSIT_NONE := 0,
  357. NOTIFICATIONPSIT_LINE1 := 1,
  358. NOTIFICATIONPSIT_LINE2 := 2);
  359. type
  360. notification_provider_specific_data_tag = record
  361. dwMessageOptions:DWORD;
  362. psMessageClass:PROVIDER_SPECIFIC_MESSAGE_CLASS;
  363. psReplaceOption:PROVIDER_SPECIFIC_REPLACE_OPTION;
  364. npsMsgWaitingType:NOTIFICATION_PROVIDER_SPECIFIC_MSG_WAITING_TYPE;
  365. iNumberOfMessagesWaiting:longint;
  366. npsIndicatorType:NOTIFICATION_PROVIDER_SPECIFIC_INDICATOR_TYPE;
  367. end;
  368. NOTIFICATION_PROVIDER_SPECIFIC_DATA = notification_provider_specific_data_tag;
  369. // WDP message type
  370. const
  371. SMS_MSGTYPE_WDP = 'Microsoft WDP SMS Protocol';
  372. // Provider-specific data for use with SmsSendMessage and SmsReadMessage
  373. type
  374. WDP_PROVIDER_SPECIFIC_PORT_ADDRESSING = (WDPPSPA_8_BIT_PORT_NUMBERS := 0,
  375. WDPPSPA_16_BIT_PORT_NUMBERS);
  376. type
  377. wdp_provider_specific_data_tag = record
  378. wdppsPortAddressing:WDP_PROVIDER_SPECIFIC_PORT_ADDRESSING;
  379. wDestinationPort:word;
  380. wOriginatorPort:word;
  381. end;
  382. WDP_PROVIDER_SPECIFIC_DATA = wdp_provider_specific_data_tag;
  383. // WCMP message type
  384. const
  385. SMS_MSGTYPE_WCMP = 'Microsoft WCMP SMS Protocol';
  386. // Provider-specific data for use with SmsSendMessage and SmsReadMessage
  387. type
  388. WCMP_PROVIDER_SPECIFIC_MESSAGE_TYPE = (WCMPPSMT_UNSUPPORTED := 0,
  389. WCMPPSMT_PORT_UNREACHABLE,
  390. WCMPPSMT_MESSAGE_TOO_BIG,
  391. WCMPPSMT_ECHO_REQUEST,
  392. WCMPPSMT_ECHO_REPLY);
  393. type
  394. wcmp_provider_specific_data_tag = record
  395. wcmppsMessageType:WCMP_PROVIDER_SPECIFIC_MESSAGE_TYPE;
  396. wParam1:word;
  397. wParam2:word;
  398. wParam3:word;
  399. smsaAddress:SMS_ADDRESS;
  400. end;
  401. WCMP_PROVIDER_SPECIFIC_DATA = wcmp_provider_specific_data_tag;
  402. // Status message type
  403. const
  404. SMS_MSGTYPE_STATUS = 'Microsoft Status Message SMS Protocol (Receive Only)';
  405. // Provider-specific data for use with SmsReadMessage
  406. type
  407. status_provider_specific_data_tag = record
  408. smssiStatusInformation:SMS_STATUS_INFORMATION;
  409. end;
  410. STATUS_PROVIDER_SPECIFIC_DATA = status_provider_specific_data_tag;
  411. // Broadcast message type
  412. const
  413. SMS_MSGTYPE_BROADCAST = 'Microsoft Broadcast Message SMS Protocol (Receive Only)';
  414. type
  415. BROADCAST_PROVIDER_SPECIFIC_GEOGRAPHICAL_SCOPE = (BPSGS_UNKNOWN := 0,
  416. BPSGS_CELL_DISPLAY_IMMEDIATE,
  417. BPSGS_CELL,
  418. BPSGS_PLMN,
  419. BPSGS_LOCATION_AREA);
  420. // Provider-specific data for use with SmsReadMessage
  421. type
  422. broadcast_provider_specific_data_tag = record
  423. wMessageID:word;
  424. wMessageCode:word;
  425. bpsgsGeographicalScope:BROADCAST_PROVIDER_SPECIFIC_GEOGRAPHICAL_SCOPE;
  426. wUpdateNumber:word;
  427. end;
  428. BROADCAST_PROVIDER_SPECIFIC_DATA = broadcast_provider_specific_data_tag;
  429. // Raw message type
  430. const
  431. SMS_MSGTYPE_RAW = 'Microsoft Raw SMS Protocol (Receive Only)';
  432. // Provider-specific data for use with SmsReadMessage
  433. type
  434. raw_provider_specific_data_tag = record
  435. dwHeaderDataSize:DWORD;
  436. pbHeaderData:array[0..SMS_DATAGRAM_SIZE-1] of byte;
  437. end;
  438. RAW_PROVIDER_SPECIFIC_DATA = raw_provider_specific_data_tag;
  439. //
  440. // APIs for SMS.dll
  441. //
  442. const
  443. SmsDLL = 'sms.dll';
  444. function SmsSetMessageNotification(psmsrd:LPSMSREGISTRATIONDATA):HRESULT; external SmsDLL name 'SmsSetMessageNotification';
  445. function SmsClearMessageNotification(tszProtocolName:LPCTSTR):HRESULT; external SmsDLL name 'SmsClearMessageNotification';
  446. // Open the SMS Messaging component for read and/or write access
  447. //
  448. // Each protocol may only have one handle open with SMS_MODE_RECEIVE.
  449. // Additional attempts to get RECEIVE mode on a given protocol will result in
  450. // SMS_E_RECEIVEHANDLEALREADYOPEN.
  451. //
  452. // Currently all protocols have applications whith open RECEIVE handles. As a
  453. // result, using the SMS API to receive SMS messages is not supported. Attempts
  454. // to do so may interfere with the proper operation of Inbox, WAP, or other SMS
  455. // applications.
  456. //
  457. // The IMailRuleClient interface in cemapi.h may be used to access received
  458. // text SMS messages.
  459. function SmsOpen(ptsMessageProtocol:LPCTSTR;
  460. dwMessageModes:DWORD;
  461. psmshHandle:LPSMS_HANDLE;
  462. phMessageAvailableEvent:LPHANDLE):HRESULT; external SmsDLL name 'SmsOpen';
  463. // Close a handle to the SMS messaging component
  464. function SmsClose(smshHandle:SMS_HANDLE):HRESULT; external SmsDLL name 'SmsClose';
  465. // Send an SMS message
  466. function SmsSendMessage(smshHandle:SMS_HANDLE;
  467. psmsaSMSCAddress:LPSMS_ADDRESS;
  468. psmsaDestinationAddress:LPSMS_ADDRESS;
  469. pstValidityPeriod:LPSYSTEMTIME; // (Values in this structure are expressed relative to the current time)
  470. pbData:LPBYTE;
  471. dwDataSize:DWORD;
  472. pbProviderSpecificData:LPBYTE;
  473. dwProviderSpecificDataSize:DWORD;
  474. smsdeDataEncoding:SMS_DATA_ENCODING;
  475. dwOptions:DWORD;
  476. psmsmidMessageID:LPSMS_MESSAGE_ID):HRESULT; external SmsDLL name 'SmsSendMessage';
  477. // Determine an upper-bound for the size of the buffer needed by the next call to SmsReadMessage
  478. function SmsGetMessageSize(smshHandle:SMS_HANDLE;
  479. pdwDataSize:LPDWORD):HRESULT; external SmsDLL name 'SmsGetMessageSize';
  480. // Read an SMS message (the appropriate size of the buffer can be found via a call to SmsGetMessageSize)
  481. function SmsReadMessage(smshHandle:SMS_HANDLE;
  482. psmsaSMSCAddress:LPSMS_ADDRESS;
  483. psmsaSourceAddress:LPSMS_ADDRESS;
  484. pstReceiveTime:LPSYSTEMTIME; // (UTC time)
  485. pbBuffer:LPBYTE;
  486. dwBufferSize:DWORD;
  487. pbProviderSpecificBuffer:LPBYTE;
  488. dwProviderSpecificDataBuffer:DWORD;
  489. pdwBytesRead:LPDWORD):HRESULT; external SmsDLL name 'SmsReadMessage';
  490. // Waits to receive a status-report for an SMS message
  491. function SmsGetMessageStatus(smshHandle:SMS_HANDLE;
  492. smsmidMessageID:SMS_MESSAGE_ID;
  493. psmssiStatusInformation:LPSMS_STATUS_INFORMATION;
  494. dwTimeout:DWORD):HRESULT; external SmsDLL name 'SmsGetMessageStatus';
  495. // Get the default SMS Service Center address
  496. function SmsGetSMSC(psmsaSMSCAddress:LPSMS_ADDRESS):HRESULT; external SmsDLL name 'SmsGetSMSC';
  497. // Set the default SMS Service Center address
  498. function SmsSetSMSC(psmsaSMSCAddress:LPSMS_ADDRESS):HRESULT; external SmsDLL name 'SmsSetSMSC';
  499. // Get the range of broadcast messages to listen for
  500. function SmsGetBroadcastMsgRanges(psmsbrBroadcastRanges:LPSMS_BROADCAST_RANGES):HRESULT; external SmsDLL name 'SmsGetBroadcastMsgRanges';
  501. // Set the range of broadcast messages to listen for
  502. function SmsSetBroadcastMsgRanges(psmsbrBroadcastRanges:LPSMS_BROADCAST_RANGES):HRESULT; external SmsDLL name 'SmsSetBroadcastMsgRanges';
  503. // Get the device's phone number for SMS
  504. function SmsGetPhoneNumber(psmsaAddress:LPSMS_ADDRESS):HRESULT; external SmsDLL name 'SmsGetPhoneNumber';
  505. // Approximate the system time based on the time indicated by the SMSC in the last status-report message
  506. function SmsGetTime(ptsCurrentTime:LPSYSTEMTIME; // (UTC time)
  507. pdwErrorMargin:LPDWORD):HRESULT; external SmsDLL name 'SmsGetTime';
  508. implementation
  509. end.