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