API Guide Home
(Online version only)

HsPhoneSMSTypes.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (c) 2004 palmOne, Inc. or its subsidiaries.
00003  * All rights reserved.
00004  *****************************************************************************/
00005 /** @ingroup Telephony
00006  *
00007  */
00008  
00009  
00010 /** 
00011  *
00012  * @file    HsPhoneSMSTypes.h
00013  *
00014  * @brief  Header File for Phone Library API ---- NETWORK CATEGORY
00015  *
00016  * NOTES:
00017  *  All implementations of the Handspring Phone Library support a common API. 
00018  *  This API is broken up into various categories for easier management.  This file
00019  *  defines the SMS category.  These API calls are used to interact with the wireless network.              
00020  */
00021 
00022 
00023 
00024 #ifndef _HS_PHONE_SMS_TYPES_H__
00025 #define _HS_PHONE_SMS_TYPES_H__
00026 #include <PalmOS.h>
00027 #include <PalmTypes.h>
00028 #ifndef __CORE_COMPATIBILITY_H__
00029 #include <PalmCompatibility.h>
00030     /** workaround for differing header files in sdk-3.5 and sdk-internal */
00031     #ifndef __CORE_COMPATIBILITY_H__
00032     #define __CORE_COMPATIBILITY_H__
00033     #endif 
00034 #endif 
00035 
00036 #if defined (_MSC_VER)  /**< Win 32 compiler */
00037 #pragma pack ( push, 2 )
00038 #endif
00039 
00040 
00041 /**
00042  * Palm OS address book functions
00043  **/
00044 enum AddressAppRecordFieldEnum {
00045     kName,          /**<        */
00046     kFirstName,         /**<        */
00047     kCompany,       /**<        */
00048     kPhone1,        /**<        */
00049     kPhone2,        /**<        */
00050     kPhone3,        /**<        */
00051     kPhone4,        /**<        */
00052     kPhone5,        /**<        */
00053     kAddress,       /**<        */
00054     kCity,          /**<        */
00055     kState,         /**<        */
00056     kZipCode,       /**<        */
00057     kCountry,       /**<        */
00058     kTitle,         /**<        */
00059     kCustom1,       /**<        */
00060     kCustom2,       /**<        */
00061     kCustom3,       /**<        */
00062     kCustom4,       /**<        */
00063     kNote,          /**<        */
00064     kRecordFieldEnumCount /**< must be the last field */
00065 };
00066 
00067 #ifndef __cplusplus
00068 typedef enum AddressAppRecordFieldEnum AddressAppRecordFieldEnum;
00069 #endif
00070 
00071 
00072 #define isValidAddressAppRecordFieldEnum(x) ((x >= kName) && (x < kRecordFieldEnumCount))   /**<        */
00073 
00074 /**
00075  *  Item description here
00076  **/
00077 typedef enum  {
00078     addrWorkLabel,      /**<        */
00079     addrHomeLabel,      /**<        */
00080     addrFaxLabel,       /**<        */
00081     addrOtherLabel,     /**<        */
00082     addrEmailLabel,     /**<        */
00083     addrMainLabel,      /**<        */
00084     addrPagerLabel,     /**<        */
00085     addrMobileLabel,    /**<        */
00086     addrNoLabel     /**<        */
00087 }AddressAppPhoneLabel;
00088 
00089 typedef UInt8 AddressAppPhoneLabelType;     /**<        */
00090 
00091 /**
00092  * This should probably be private to the library
00093  **/
00094 struct Address {
00095   // All fields should be considered read-only.
00096   AddressAppPhoneLabelType kind;    /**<        */
00097   char filler;              /**<        */
00098   UInt32 uniqueID;          /**<        */
00099   UInt16 phoneBookIndex;        /**<        */
00100   UInt16 count[3];          /**<        */
00101   // immediately followed by address data
00102 };
00103 
00104 
00105 /**
00106  * Item description here
00107  **/
00108 struct AddrDescriptor {
00109   UInt16 count;     /**< Length of list */
00110     // immediately followed by count pairs of (UInt16,Address)
00111 };
00112 
00113 #ifndef _cplusplus
00114 typedef struct Address Address;             /**<        */
00115 typedef struct AddrDescriptor AddrDescriptor;       /**<        */
00116 #endif
00117 
00118 
00119 /**
00120  * Item description here
00121  **/
00122 struct AddressType {
00123   UInt16 addressSize;       /**<        */
00124   Address address;      /**<        */
00125 };
00126 
00127 #ifndef _cplusplus
00128 typedef struct AddressType AddressType;     /**<        */
00129 #endif
00130 
00131 /**
00132  *  Item description here
00133  **/
00134 struct AddressAppRecordHeader {
00135     UInt32 options;     /**<        */
00136     UInt32 flags;       /**<        */
00137     UInt8 companyOffset;    /**<        */
00138     char data;      /**<        */
00139 };
00140 
00141 #ifndef _cplusplus
00142 typedef struct AddressAppRecordHeader AddressAppRecordHeader;   /**<        */
00143 #endif
00144 
00145 /**
00146  *  Item description here
00147  **/
00148 struct AddressAppRecord {
00149 // private:
00150     // Fields within an address.
00151     
00152     // Header of an address. This is immediately followed by the address
00153     // data. The first database is part of the following structure.
00154     // (See AddressDB.h for a detailled explanation of the structure.)
00155 
00156     MemHandle mData;    /**<        */
00157     UInt32 mID;     /**<        */
00158     Boolean mLocked;    /**<        */
00159     Int8  reserved1;    /**< padding */
00160     AddressAppRecordHeader* mHeader;    /**<        */
00161 };
00162 
00163 /**
00164  *  NBS defines
00165  **/
00166 
00167 /**
00168  *  @name Identifier elements definitions 
00169  **/
00170 /*@{*/
00171 #define NBSHeaderID            0x00  /**< NBS fragment header information identifier */
00172 #define NBSHeaderIDLen         0x03  /**< three bytes */
00173 
00174 #define Addressing8bitID       0x04  /**< 8-bit address information identifier */
00175 #define Addressing8bitIDLen    0x02  /**< 2 bytes... src port(1), dest port(1) */
00176 
00177 #define Addressing16bitID      0x05  /**< 16-bit address information identifier */
00178 #define Addressing16bitIDLen   0x04  /**< 4 bytes... src port(2), dest port(2) */
00179 /*@}*/
00180 
00181 
00182 /**
00183  *  @name Text Header elements
00184  **/
00185 /*@{*/
00186 #define NBSHeaderEscapeSeq     "//"      /**< start sequence of the header */
00187 #define NBSTextHeader          "//SCK"   /**< beginning of an NBS text header */
00188 #define NBSTextHeaderLength    5         /**< length of the header */
00189 /*@}*/
00190 
00191 
00192 /**
00193  *  @name 8bit addressing text header lengths, not including the //SCK
00194  **/
00195 /*@{*/
00196 #define Full8bitTextHeader     0x0A  /**< length for full header with 8-bit addressing    //SCKddoorrttnn */
00197 #define Minimum8bitTextHeader  0x02  /**< length for minimum header with 8-bit addressing //SCKdd */
00198 /*@}*/
00199 
00200 
00201 /**
00202  *  @name 16bit addressing text header lengths, not including the //SCKL
00203  **/
00204 /*@{*/
00205 #define Full16bitTextHeader    0x0F  /**< length for full header with 16-bit addressing    //SCKLddddoooorrttnn */
00206 #define Minimum16bitTextHeader 0x05  /**< length for minimum header with 16-bit addressing //SCKLdddd */
00207 /*@}*/
00208 
00209 #define TextHeaderTerminator   ' '   /**< text based headers terminate at the next space */
00210 
00211 #define phnNBSEvent         'Hnbs'
00212 
00213 
00214 /**
00215  *  @name NBS Port Numbers (Nokia Smart Messaging Spec)
00216  **/
00217 /*@{*/
00218 #define NBSPort_MimeVCard     0xE2  /**<        */
00219 #define NBSPort_MimeVCalendar 0xE4  /**<        */
00220 /*@}*/
00221 
00222 /**
00223  *  SMS stuff
00224  **/
00225 typedef enum {
00226   kMTIncoming, kMTOutgoing      /**<        */
00227 } SMSMessageType;
00228 
00229 #define isValidSMSMessageType(m) ((m >= kMTIncoming) && (m <= kMTOutgoing))     /**<        */
00230 
00231 /**
00232  *  Item description here
00233  **/
00234 typedef enum  {
00235   kNone,            /**<        */
00236   kReceiving, kReceived,    /**<        */
00237   kPending, kSending, kSent /**<        */
00238 }SMSMessageStatus;
00239 
00240 #define isValidSMSMessageStatus(m) ((m >= kNone) && (m <= kSent))       /**<        */
00241 
00242 /**
00243  * CDMA SMS Preference ?
00244  **/
00245 typedef struct
00246   {
00247     Boolean         audioAlertEnable;   /**<        */
00248     Boolean         confirmDeletion;    /**<        */
00249   }
00250 PhnSMSPrefType ,* PhnSMSPrefPtr;
00251 
00252 
00253 
00254 /**
00255  *  
00256  **/
00257 typedef enum  {
00258   kGreekSymbols = 1L << 0,      /**<        */
00259   kMissingPart =    1L << 1,    /**<        */
00260   kAutoDelete = 1L << 2,        /**<        */
00261   kNotification = 1L << 3,      /**<        */
00262   kDontEncode = 1L << 4,        /**<        */
00263   kSubstitution = 1L << 5,      /**<        */
00264   kFailed =     1L << 6,    /**<        */
00265   kStatusReport = 1L << 7,      /**<        */
00266   kFreeReply =  1L << 8,        /**<        */
00267   kInternetEMail =1L << 9,      /**<        */
00268   kTextSegments =   1L << 10,   /**<        */
00269   kSMSErrorType1 = 1L << 11,        /**<        */
00270   kSMSErrorType2 = 1L << 12,        /**<        */
00271   kSMSErrorType3 = 1L << 13,        /**<        */
00272   kSMSHighPriority = 1L << 14,      /**<        */
00273   kSMSLowPriority = 1L << 15,       /**<        */
00274         // application-level flags
00275   kRead = 1L << 16,         /**<        */
00276   kDeferredDelivery = 1L << 17,     /**<        */
00277   kWAPMsg = 1L << 18            /**<        */
00278 }SMSMessageFlags;
00279 
00280 /**
00281  *  
00282  **/
00283 typedef enum  {
00284   smsFmtIgnoreKind = 0,     /**<        */
00285   smsFmtMatchKind = 8,      /**<        */
00286   smsFmtExceptKind = 16,    /**<        */
00287   smsFmtAllKinds = 24,      /**<        */
00288   smsFmtLastNameFirst = 32, /**<        */
00289   smsFmtShortLabel = 64     /**<        */
00290 }SMSAddressFormat;
00291 
00292 /**
00293  *  
00294  **/
00295 typedef struct  {
00296   Boolean freeReply;        /**<        */
00297   Boolean statusReport;     /**<        */
00298   unsigned char validity;   /**<        */
00299 }SMSSendOptions;        
00300 
00301 /**
00302  *  
00303  **/
00304 typedef struct  {
00305   UInt32 owner;         /**< application owning this message */
00306   SMSMessageType type;      /**< message type */
00307   SMSMessageStatus status;  /**< message status */
00308   UInt32 date;          /**< date of sending or receipt */
00309   UInt32 flags;         /**< miscellaneous flags */
00310   UInt8 validity;       /**< validity period */
00311   UInt8 segments;       /**< number of segments (incoming message) */
00312                 /**< Size of field Addresses. If there is segmentation information for */
00313                 /**< a message this field contains also the sizes of the parts. The array */
00314                 /**< is therefore a variable-size array. */
00315   UInt16 size[1];       /**<        */
00316 }SmsHeader;
00317 
00318 
00319 /**
00320  *  Structure passed to the callbacks registered for incoming NBS notifications
00321  **/
00322 struct NBSNotificationEventType
00323 {
00324     UInt16 version;     /**< version number to provide future backwards compatibility */
00325 
00326     /** helper fields */
00327     Boolean NBSdatagram;    /**< flag if it is an NBS datagram */
00328     Boolean binary;         /**< true if binary data */
00329 
00330     void *headerP;      /**< pointer to raw header */
00331     UInt8 headerLen;    /**< length of headerP */
00332     Int8  reserved0;    /**< padding */
00333     void *dataP;        /**< pointer to data body */
00334     UInt8 dataLen;      /**< length of dataP */
00335 
00336     /** NBS datagram fields */
00337     UInt8 refNum;       /**< NBS reference number */
00338     UInt8 maxNum;       /**< max segment number 1-255 */
00339     UInt8 seqNum;       /**< sequence number    1-255, no more than maxNum */
00340     Int8  reserved1;    /**< padding */
00341     Int8  reserved1a;   /**< mo padding */
00342 
00343     UInt32 srcPort;     /**< source port */
00344     UInt32 dstPort;     /**< destination port */
00345 
00346     /** SMS related fields */
00347     UInt32 msgID;       /**< ID into the SMS database to reference this */
00348                         /**< message this ID is not gauranteed to be */
00349                         /**< valid once the notification callback */
00350                         /**< returns.  Users should make a copy of the */
00351                         /**< msg if they want to work on it after the */
00352                         /**< callback returns. */
00353                   
00354 
00355     char   *senderP;    /**< sender number - null terminated */
00356     UInt32 datetime;    /**< date/time stamp */
00357     Int32  reserved2;   /**< reserved*/
00358     Int32  reserved3;   /**< reserved*/
00359 };
00360 
00361 #ifndef _cplusplus
00362 typedef struct NBSNotificationEventType NBSNotificationEventType;       /**<        */
00363 #endif
00364 
00365 /**
00366  * NBS 
00367  **/
00368 enum { kParseError = -1, kDoneParsing=0, kParseInformationID, kParseInformationLength, kParseInformationData };
00369 
00370 /**
00371  *  SMS length information
00372  *
00373  *  @note For CDMA, this can be used to retrieve the SMS/EMS limits.
00374  *        length = max segment length.  size = max EMS length
00375  **/
00376 typedef struct 
00377   {                          //        IN                                              OUT
00378   UInt16   size;             /**< unused */
00379   Boolean  substitution;     /**< Substitute characters if needed (GSM ONLY)                           */
00380   UInt16   length;           /**<                                              total length of message */
00381   UInt16   segmentCount;     /**<                                              number of segments used */
00382   Boolean  requestSmsInfo;   /**< unused */
00383 }
00384 PhnLibLengthInfoType;
00385 
00386 /**
00387  *  SMS error codes obtained from the network in CDMA
00388  *  The first half of the enums are from IS-41D SMS cause codes
00389      with the exact binary values as in IS-41D. They are in the range
00390      of 0x00 to 0xFF. This does not have the cause codes from the range 0x80000
00391      upwards as the radio doesnt support them
00392  **/
00393 typedef enum  {
00394   /* A. Network Problems:
00395   */
00396   SmsCauseAddressVacant                     = 0,
00397   SmsCauseAddressTranslationFailure,
00398   SmsCauseNetworkResourceShortage,
00399   SmsCauseNetworkFailure,
00400   SmsCauseInvalidTeleserviceId,
00401   SmsCauseOtherNetworkProblem,
00402   SmsCauseOtherNetworkProblemMoreFirst   = 6,
00403   /* all values within this range are treated as
00404      OtherNetworkProblem
00405   */
00406   SmsCauseOtherNetworkProblemMoreLast    = 31,
00407 
00408   /* B. Terminal Problems:
00409   */
00410   SmsCauseNoPageResponse                   = 32,
00411   SmsCauseDestinationBusy,
00412   SmsCauseNoAck,
00413   SmsCauseDestinationResourceShortage,
00414   SmsCauseSmsDeliveryPostponed,
00415   SmsCauseDestinationOutOfService,
00416   SmsCauseDestinationNoLongerAtThisAddress,
00417   SmsCauseOtherTerminalProblem,
00418   smsCauseOtherTerminalProblemMoreFirst  = 40,
00419   /* all values within this range are treated as
00420      OtherTerminalProblem
00421   */
00422   SmsCauseOtherTerminalProblemMoreLast   = 47,
00423   SmsCauseSmsDeliveryPostponedMoreFirst  = 48,
00424   SmsCauseSmsDeliveryPostponedMoreLast   = 63,
00425 
00426   /* C. Radio Interface Problems:
00427   */
00428   SmsCauseRadioIfResourceShortage         = 64,
00429   SmsCauseRadioIfIncompatible,
00430   SmsCauseOtherRadioIfProblem,
00431   SmsCauseOtherRadioIfProblemMoreFirst  = 67,
00432   /* all values within this range are treated as
00433      OtherRadioIfProblem
00434   */
00435   SmsCauseOtherRadioIfProblemMoreLast   = 95,
00436 
00437   /* D. General Problems:
00438   */
00439   SmsCauseUnexpected_Parm_Size               = 96,
00440   SmsCauseSmsOriginationDenied,
00441   SmsCauseSmsTerminationDenied,
00442   SmsCauseSupplServiceNotSupported,
00443   SmsCauseSmsNotSupported,
00444   SmsCauseReserved101,
00445   SmsCauseMissingExpectedParm,
00446   SmsCauseMissingMandatoryParm,
00447   SmsCauseUnrecognizedParmValue,
00448   SmsCauseUnexpectedParmValue,
00449   SmsCauseUserDataSizeError,
00450   SmsCauseOtherGeneralProblems,
00451   SmsCauseOtherGeneralProblemsMoreFirst  = 108,
00452   /* all values within this range are treated as
00453      OtherGeneralProblems
00454   */
00455   SmsCauseOtherGeneralProblemsMoreLast   = 255
00456 }_SmsCauseCode;
00457 
00458 typedef UInt32 SmsCauseCode;
00459 
00460 /**
00461  *  SMS error codes types
00462  **/
00463 
00464 typedef enum
00465 {
00466   SmsErrorNone,
00467   SmsErrorReserved,
00468   SmsErrorTemporary,
00469   SmsErrorPermanent
00470 }_SmsErrorCode;
00471 
00472 typedef UInt8 SmsErrorCode;
00473 
00474 /**
00475  * MMS info structure.
00476  */
00477 #define kMMSStringMaxLen                       128 /**< URL, MML, and user agent */
00478 #define kMMSPixPlaceMaxLen                      20  /**< pix place address */
00479 #define PhnLibMMSServerInfoSettingsMajorVersion 0x0001
00480 #define PhnLibMMSServerInfoSettingsMinorVersion 0x0000
00481 #define PhnLibMMSServerInfoVersion              (((UInt32)PhnLibMMSServerInfoSettingsMajorVersion << 16) | PhnLibMMSServerInfoSettingsMinorVersion)
00482 typedef struct _PhnLibMMSServerInfo
00483 {
00484   UInt32  version;                                  /**< must be set to PhnLibMMSServerInfoVersion */
00485   UInt32  max_message_size;                         /**< max message size kB */
00486   UInt8   mms_server_name[kMMSStringMaxLen+1];      /**< MMS server [NULL terminated string] */
00487   UInt8   mml_server_name[kMMSStringMaxLen+1];      /**< MML server [NULL terminated string] */
00488   UInt8   pix_place_server[kMMSPixPlaceMaxLen+1];   /**< MMS Pix place address [NULL terminated string] */
00489   UInt8   user_agent[kMMSStringMaxLen+1];           /**< user agent string [NULL terminated string] */
00490   UInt8   maxRetries;                               /**< number of retry attempts */
00491   UInt8   timeout;                                  /**< MMSC timeout */
00492   Boolean deliveryAck;                              /**< delivery ack setting */
00493 }
00494 PhnLibMMSServerInfoType;
00495 
00496 
00497 #if defined (_MSC_VER)
00498 #pragma pack ( pop )
00499 #endif
00500 
00501 
00502 #endif // _HS_PHONE_SMS_TYPES_H__

Top Palm Developer Network
© 2004-2008, Palm, Inc. All rights reserved.
Generated on Fri Jun 13 10:06:53 2008 for Palm API Guide