|
API Guide Home (Online version only) |
![]() |
00001 /****************************************************************************** 00002 * Copyright (c) 2004 palmOne, Inc. or its subsidiaries. 00003 * All rights reserved. 00004 *****************************************************************************/ 00005 /** @ingroup Telephony 00006 * 00007 */ 00008 00009 00010 /** 00011 * @file HsPhoneSMS.h 00012 * 00013 * @brief Header File for Phone Library API ---- SMS CATEGORY 00014 * 00015 * Notes: 00016 * All implementations of the Handspring Phone Library support a common API. 00017 * This API is broken up into various categories for easier management. This file 00018 * defines the SMS category. These API calls are used to send/receive Short Message 00019 * Service (SMS) messages. 00020 */ 00021 00022 #ifndef HS_PHONESMS_H 00023 #define HS_PHONESMS_H 00024 #include <PalmOS.h> 00025 #include <PalmTypes.h> 00026 #ifndef __CORE_COMPATIBILITY_H__ 00027 #include <PalmCompatibility.h> 00028 /** workaround for differing header files in sdk-3.5 and sdk-internal */ 00029 #ifndef __CORE_COMPATIBILITY_H__ 00030 #define __CORE_COMPATIBILITY_H__ 00031 #endif 00032 #endif 00033 #include <HsPhoneTraps.h> /** trap table definition for phone library calls */ 00034 #include <HsPhoneErrors.h> /** error codes returned by phone library functions */ 00035 #include <HsPhoneTypes.h> 00036 00037 00038 /** 00039 * @brief 00040 * 00041 * @param refNum: IN: 00042 * @param number: IN: 00043 * @param id: IN: 00044 * @retval PhnAddressHandle 00045 **/ 00046 extern PhnAddressHandle PhnLibNewAddress (UInt16 refNum, const CharPtr number, PhnDatabaseID id) 00047 PHN_LIB_TRAP(PhnLibTrapNewAddress); 00048 00049 /** 00050 * @brief This function returns the field’s value for a given address in a newly allocated 00051 * block. This function returns 0 if there was an error while retrieving the data. 00052 * 00053 * @param refNum: IN: 00054 * @param address: IN: 00055 * @param fied: IN: 00056 * @retval CharPtr 00057 **/ 00058 extern CharPtr PhnLibGetField (UInt16 refNum, PhnAddressHandle address, PhnAddressField field) 00059 PHN_LIB_TRAP(PhnLibTrapGetField); 00060 00061 /** 00062 * @brief 00063 * 00064 * @param refNum: IN: 00065 * @param address: IN: 00066 * @retval PhnDatabaseID 00067 **/ 00068 extern PhnDatabaseID PhnLibGetID(UInt16 refNum, PhnAddressHandle address) 00069 PHN_LIB_TRAP(PhnLibTrapGetID); 00070 00071 /** 00072 * @brief This function lets the specified field of address to the given data. This function 00073 * returns 0 if the field was modified without an error. 00074 * 00075 * @param refNum: IN: 00076 * @param address: IN: 00077 * @param field: IN: 00078 * @param data: IN: 00079 * @retval Err Error Code. 00080 **/ 00081 extern Err PhnLibSetField(UInt16 refNum, PhnAddressHandle address, PhnAddressField field, const char* data) 00082 PHN_LIB_TRAP(PhnLibTrapSetField); 00083 00084 /** 00085 * @brief 00086 * 00087 * @param refNum: IN: 00088 * @param address: IN: 00089 * @param number: IN: 00090 * @retval Err Error Code. 00091 **/ 00092 extern Err PhnLibSetNumber(UInt16 refNum, PhnAddressHandle address, const char* number) 00093 PHN_LIB_TRAP(PhnLibTrapSetNumber); 00094 00095 /** 00096 * @brief 00097 * 00098 * @param refNum: IN: 00099 * @param address: IN: 00100 * @param id: IN: 00101 * @retval Err Error code. 00102 **/ 00103 extern Err PhnLibSetID(UInt16 refNum, PhnAddressHandle address, PhnDatabaseID id) 00104 PHN_LIB_TRAP(PhnLibTrapSetID); 00105 00106 /** 00107 * @brief 00108 * 00109 * @param refNum: IN: 00110 * @param address: IN: 00111 * @param format: IN: 00112 * @retval Char 00113 **/ 00114 extern char* PhnLibAddressToText(UInt16 refNum, PhnAddressHandle address ,SMSAddressFormat format) 00115 PHN_LIB_TRAP(PhnLibTrapAddressToText); 00116 00117 /** 00118 * @brief 00119 * 00120 * @param refNum: IN: 00121 * @param address: IN: 00122 * @retval Boolean 00123 **/ 00124 extern Boolean PhnLibHasName(UInt16 refNum, PhnAddressHandle address) 00125 PHN_LIB_TRAP(PhnLibTrapHasName); 00126 00127 /** 00128 * @brief 00129 * 00130 * @param refNum: IN: 00131 * @param a: IN: 00132 * @param b: IN: 00133 * @retval Boolean 00134 **/ 00135 extern Boolean PhnLibEqual(UInt16 refNum, PhnAddressHandle a, PhnAddressHandle b) 00136 PHN_LIB_TRAP(PhnLibTrapEqual); 00137 00138 /** 00139 * @brief 00140 * 00141 * @param refNum: IN: 00142 * @retval DmOpenRef 00143 **/ 00144 extern DmOpenRef PhnLibGetDBRef(UInt16 refNum) 00145 PHN_LIB_TRAP(PhnLibTrapGetDBRef); 00146 00147 /** 00148 * @brief 00149 * 00150 * @param refNum: IN: 00151 * @param db: IN: 00152 * @retval Err Error code. 00153 **/ 00154 extern Err PhnLibReleaseDBRef(UInt16 refNum, DmOpenRef db) 00155 PHN_LIB_TRAP(PhnLibTrapReleaseDBRef); 00156 00157 /** 00158 * @brief Create a new message of the given message type and return the ID of the new 00159 * record in the message database. All fields are either empty (e.g. message’s text) or 00160 * contain default values (e.g. sending options). 00161 * 00162 * @param refNum: IN: 00163 * @param type: IN: Incoming or Outcoming message. See SMSMessageType for more details. 00164 * @retval Returns either the ID of the new message record or phnErrUnknownID if there was 00165 * not sufficient memory to allocate a new message. 00166 **/ 00167 extern PhnDatabaseID PhnLibNewMessage(UInt16 refNum, SMSMessageType type) 00168 PHN_LIB_TRAP(PhnLibTrapNewMessage); 00169 00170 /** 00171 * @brief This function deletes the message with the given msgID from the message database. 00172 * 00173 * @param refNum: IN: 00174 * @param msgID: IN: 00175 * @param archive: IN: 00176 * @retval This function returns 0 if there was no error during the deletion of the record. If 00177 * there is no message with the given id, this function returns phnErrUnknownID. 00178 **/ 00179 extern Err PhnLibDeleteMessage(UInt16 refNum, PhnDatabaseID msgID, Boolean archive) 00180 PHN_LIB_TRAP(PhnLibTrapDeleteMessage); 00181 00182 /** 00183 * @brief This function sends the message to all the recipients. 00184 * 00185 * @param refNum: IN: 00186 * @param msgID: IN: 00187 * @param progress: IN: 00188 * @retval phnErrUnknownID: If there is no message with the given ID. 00189 * phnErrIllegalStatus: If the message’s status is not kNone or kPending 00190 * phnErrNotAllowed: If the error flag is set. It is not permitted to send messages 00191 * when the error flag is set. 00192 **/ 00193 extern Err PhnLibSendMessage(UInt16 refNum, PhnDatabaseID msgID, Boolean progress) 00194 PHN_LIB_TRAP(PhnLibTrapSendMessage); 00195 00196 /** 00197 * @brief 00198 * 00199 * @param refNum: IN: 00200 * @retval Err Error code. 00201 **/ 00202 extern Err PhnLibSendPendingMessages(UInt16 refNum) 00203 PHN_LIB_TRAP(PhnLibTrapSendPendingMessages); 00204 00205 /** 00206 * @brief This function sets the text of the message to the given text. 00207 * 00208 * @param refNum: IN: 00209 * @param msgID: IN: 00210 * @param data: IN: 00211 * @param size: IN: 00212 * @retval 0: if the text was updated successfully. 00213 * phnErrIllegalChars: If the text contains illegal characters 00214 **/ 00215 extern Err PhnLibSetText(UInt16 refNum, PhnDatabaseID msgID, const char* data, Int16 size) 00216 PHN_LIB_TRAP(PhnLibTrapSetText); 00217 00218 /** 00219 * @brief This function sets the date of the given message. The date must be given in Palm 00220 * OS format (as returned by TimGetSeconds). 00221 * 00222 * @param refNum: IN: 00223 * @param msgID: IN: 00224 * @param date: IN: 00225 * @retval Err Error code. 00226 **/ 00227 extern Err PhnLibSetDate(UInt16 refNum, PhnDatabaseID msgID, UInt32 date) 00228 PHN_LIB_TRAP(PhnLibTrapSetDate); 00229 00230 /** 00231 * @brief This function updates the sending options for the given message. 00232 * 00233 * @param refNum: IN: 00234 * @param msgID: IN: 00235 * @param options: IN: 00236 * @retval Err Error code. 00237 **/ 00238 extern Err PhnLibSetOptions(UInt16 refNum, PhnDatabaseID msgID, const SMSSendOptions* options) 00239 PHN_LIB_TRAP(PhnLibTrapSetOptions); 00240 00241 /** 00242 * @brief This function updates the list of addresses with the given list of addresses. 00243 * 00244 * @param refNum: IN: 00245 * @param msgID: IN: 00246 * @param list: IN: 00247 * @retval Err Error code. 00248 **/ 00249 extern Err PhnLibSetAddresses(UInt16 refNum, PhnDatabaseID msgID, const PhnAddressList list) 00250 PHN_LIB_TRAP(PhnLibTrapSetAddresses); 00251 00252 /** 00253 * @brief This function sets the status of the given message. 00254 * 00255 * @param refNum: IN: 00256 * @param msgID: IN: 00257 * @param status: IN: 00258 * @retval Err Error code. 00259 **/ 00260 extern Err PhnLibSetStatus(UInt16 refNum, PhnDatabaseID msgID, SMSMessageStatus status) 00261 PHN_LIB_TRAP(PhnLibTrapSetStatus); 00262 00263 /** 00264 * @brief This function updates a message’s flags. 00265 * 00266 * @param refNum: IN: 00267 * @param msgID: IN: 00268 * @param flags: IN: 00269 * @retval Err Error code. 00270 **/ 00271 extern Err PhnLibSetFlags(UInt16 refNum, PhnDatabaseID msgID, UInt32 flags) 00272 PHN_LIB_TRAP(PhnLibTrapSetFlags); 00273 00274 /** 00275 * @brief This function updates the given message’s owner. 00276 * 00277 * @param refNum: IN: 00278 * @param msgID: IN: 00279 * @param owner: IN 00280 * @retval Err Error code. 00281 **/ 00282 extern Err PhnLibSetOwner(UInt16 refNum, PhnDatabaseID msgID, UInt32 owner) 00283 PHN_LIB_TRAP(PhnLibTrapSetOwner); 00284 00285 /** 00286 * @brief This function copies the text of the message into a new block of memory that must 00287 * be disposed of by the caller. 00288 * 00289 * @param refNum: IN: 00290 * @param msgID: IN: 00291 * @param data: IN: 00292 * @retval Err Error code. 00293 **/ 00294 extern Err PhnLibGetText(UInt16 refNum, PhnDatabaseID msgID, MemHandle* data) 00295 PHN_LIB_TRAP(PhnLibTrapGetText); 00296 00297 /** 00298 * @brief This function returns the date of the given message in Palm OS format. 00299 * 00300 * @param refNum: IN: 00301 * @param msgID: IN: 00302 * @param date: IN: 00303 * @retval Err Error code. 00304 **/ 00305 extern Err PhnLibGetDate(UInt16 refNum, PhnDatabaseID msgID, UInt32* date) 00306 PHN_LIB_TRAP(PhnLibTrapGetDate); 00307 00308 /** 00309 * @brief This function returns the sending options for the given message. 00310 * 00311 * @param refNum: IN: 00312 * @param msgID: IN: 00313 * @param options: IN: 00314 * @retval Err Error code. 00315 **/ 00316 extern Err PhnLibGetOptions(UInt16 refNum, PhnDatabaseID msgID, SMSSendOptions* options) 00317 PHN_LIB_TRAP(PhnLibTrapGetOptions); 00318 00319 /** 00320 * @brief This function returns the list of addresses for the given message. 00321 * 00322 * @param refNum: IN: 00323 * @param msgID: IN: 00324 * @param list: IN: 00325 * @retval Err Error code. 00326 **/ 00327 extern Err PhnLibGetAddresses(UInt16 refNum, PhnDatabaseID msgID, PhnAddressList* list) 00328 PHN_LIB_TRAP(PhnLibTrapGetAddresses); 00329 00330 /** 00331 * @brief This function returns the status field of the message. 00332 * 00333 * @param refNum: IN: 00334 * @param msgID: IN: 00335 * @param status: IN: 00336 * @retval Err Error code. 00337 **/ 00338 extern Err PhnLibGetStatus(UInt16 refNum, PhnDatabaseID msgID, SMSMessageStatus* status) 00339 PHN_LIB_TRAP(PhnLibTrapGetStatus); 00340 00341 /** 00342 * @brief This function returns the message’s flags. 00343 * 00344 * @param refNum: IN: Library reference number returned by HsGetPhoneLibrary(). 00345 * @param msgID: IN: 00346 * @param flags: IN: 00347 * @retval Err Error code. 00348 **/ 00349 extern Err PhnLibGetFlags(UInt16 refNum, PhnDatabaseID msgID, UInt32* flags) 00350 PHN_LIB_TRAP(PhnLibTrapGetFlags); 00351 00352 /** 00353 * @brief This function returns the message’s owner. 00354 * 00355 * @param refNum: IN: Library reference number returned by HsGetPhoneLibrary(). 00356 * @param msgID: IN: 00357 * @param owner: IN: 00358 * @retval Error code. 00359 **/ 00360 extern Err PhnLibGetOwner(UInt16 refNum, PhnDatabaseID msgID, UInt32* owner) 00361 PHN_LIB_TRAP(PhnLibTrapGetOwner); 00362 00363 /** 00364 * @brief This function returns the message’s type. A client application typically uses the 00365 * type to map messages to categories. 00366 * 00367 * @param refNum: IN: 00368 * @param msgID: IN: 00369 * @param type: IN: 00370 * @retval Err Error code. 00371 **/ 00372 extern Err PhnLibGetType(UInt16 refNum, PhnDatabaseID msgID, SMSMessageType* type) 00373 PHN_LIB_TRAP(PhnLibTrapGetType); 00374 00375 /** 00376 * @brief This function returns true if the given Palm OS character is a legal GSM character. 00377 * If this function returns false, the given character does not exist within 00378 * the GSM alphabet. 00379 * 00380 * @param refNum: IN: 00381 * @param c: IN: 00382 * @retval Boolean 00383 **/ 00384 extern Boolean PhnLibIsLegalCharacter(UInt16 refNum, char c) 00385 PHN_LIB_TRAP(PhnLibTrapIsLegalCharacter); 00386 00387 /** 00388 * @brief This function maps the given Palm OS character to its equivalent 00389 * in the GSM alphabet. 00390 * 00391 * @param refNum: IN: 00392 * @param c: IN: 00393 * @retval char 00394 **/ 00395 extern char PhnLibMapCharacter(UInt16 refNum, char c) 00396 PHN_LIB_TRAP(PhnLibTrapMapCharacter); 00397 00398 /** 00399 * @brief This function sets the number of the service center to be used 00400 * for sending the SMS messages. 00401 * 00402 * @param refNum: IN: 00403 * @param address: IN: 00404 * @retval Err Error code. 00405 **/ 00406 extern Err PhnLibSetServiceCentreAddress(UInt16 refNum, const PhnAddressHandle address) 00407 PHN_LIB_TRAP(PhnLibTrapSetServiceCentreAddress); 00408 00409 /** 00410 * @brief This function returns the number of the service center currently used 00411 * for sending messages in a newly allocated address. 00412 * 00413 * @param refNum: IN: 00414 * @param address: IN: 00415 * @retval Error code. 00416 **/ 00417 extern Err PhnLibGetServiceCentreAddress(UInt16 refNum, PhnAddressHandle* address) 00418 PHN_LIB_TRAP(PhnLibTrapGetServiceCentreAddress); 00419 00420 /** 00421 * @brief This function returns the length of the given text in characters or messages. 00422 * 00423 * @param refNum: IN: 00424 * @param text: IN: 00425 * @param inMessages: IN: 00426 * @param substitution: IN: 00427 * @retval Int16 00428 **/ 00429 extern Int16 PhnLibLength(UInt16 refNum, const char* text, Boolean inMessages, Boolean substitution) 00430 PHN_LIB_TRAP(PhnLibTrapLength); 00431 00432 /** 00433 * @brief 00434 * 00435 * @param refNum: IN: 00436 * @param text: IN: 00437 * @param address: IN: 00438 * @param info: IN: 00439 * @retval Err Error code. 00440 **/ 00441 extern Err PhnLibGetLengthDetails(UInt16 refNum, const char* text, const char* address, PhnLibLengthInfoType* info) 00442 PHN_LIB_TRAP(PhnLibTrapGetLengthDetails); 00443 00444 /** 00445 * @brief This function returns the substitution string for a given GSM character. 00446 * 00447 * @param refNum: IN: 00448 * @param c: IN: 00449 * @retval const 00450 **/ 00451 extern const char* PhnLibGetSubstitution(UInt16 refNum, char c) 00452 PHN_LIB_TRAP(PhnLibTrapGetSubstitution); 00453 00454 /** 00455 * @brief This function returns a new address list. The list is initially empty 00456 * and must be disposed of by the caller using PhnLibDisposeAddressList() 00457 * or MemHandleFree(). 00458 * 00459 * @param refNum: IN: 00460 * @retval PhnAddressList 00461 **/ 00462 extern PhnAddressList PhnLibNewAddressList(UInt16 refNum) 00463 PHN_LIB_TRAP(PhnLibTrapNewAddressList); 00464 00465 /** 00466 * @brief This function disposes of the memory used by the given address list. 00467 * It should be called after your done with PhnLibNewAddressList(). 00468 * 00469 * @param refNum: IN: 00470 * @param list: IN: 00471 * @retval Err Error code. 00472 **/ 00473 extern Err PhnLibDisposeAddressList(UInt16 refNum, PhnAddressList list) 00474 PHN_LIB_TRAP(PhnLibTrapDisposeAddressList); 00475 00476 /** 00477 * @brief This function adds a copy of address to the end of list. 00478 * The address is not disposed of. 00479 * 00480 * @param refNum: IN: 00481 * @param list: IN: 00482 * @param address: IN: 00483 * @retval Err Error code. 00484 **/ 00485 extern Err PhnLibAddAddress(UInt16 refNum, PhnAddressList list, const PhnAddressHandle address) 00486 PHN_LIB_TRAP(PhnLibTrapAddAddress); 00487 00488 /** 00489 * @brief This function retrieves an item with the given index from list and 00490 * returns it as a new block on the heap specified by address. 00491 * 00492 * @param refNum: IN: 00493 * @param list: IN: 00494 * @param index: IN: 00495 * @param address: IN: 00496 * @retval Err Error code. 00497 **/ 00498 extern Err PhnLibGetNth(UInt16 refNum, const PhnAddressList list, Int16 index, PhnAddressHandle* address) 00499 PHN_LIB_TRAP(PhnLibTrapGetNth); 00500 00501 /** 00502 * @brief This function replaces the data of the item with the given index from 00503 * list by the given address. 00504 * 00505 * @param refNum: IN: 00506 * @param list: IN: 00507 * @param index: IN: 00508 * @param address: IN: 00509 * @retval Err Error code. 00510 **/ 00511 extern Err PhnLibSetNth(UInt16 refNum, PhnAddressList list, Int16 index, const PhnAddressHandle address) 00512 PHN_LIB_TRAP(PhnLibTrapSetNth); 00513 00514 /** 00515 * @brief This function returns the length of the given list. If list is 0, 00516 * this function returns phnErrParam. 00517 * 00518 * @param refNum: IN: 00519 * @param list: IN: 00520 * @param count: IN: 00521 * @retval Err Error code. 00522 **/ 00523 extern Err PhnLibCount(UInt16 refNum, PhnAddressList list, UInt16* count) 00524 PHN_LIB_TRAP(PhnLibTrapCount); 00525 00526 /** 00527 * @brief 00528 * 00529 * @param refNum: IN: 00530 * @param info: IN: 00531 * @retval Err Error code. 00532 **/ 00533 extern Err PhnLibGetSMSRingInfo (UInt16 refNum, PhnRingingInfoPtr info) 00534 PHN_LIB_TRAP(PhnLibTrapGetSMSRingInfo); 00535 00536 /** 00537 * @brief 00538 * 00539 * @param refNum: IN: 00540 * @param info: IN: 00541 * @retval Err Error code. 00542 **/ 00543 extern Err PhnLibSetSMSRingInfo (UInt16 refNum, PhnRingingInfoPtr info) 00544 PHN_LIB_TRAP(PhnLibTrapSetSMSRingInfo); 00545 00546 /** 00547 * @brief 00548 * 00549 * @param refNum: IN: 00550 * @param smsGateway: IN: 00551 * @retval Err Error code. 00552 **/ 00553 extern Err PhnLibGetSMSGateway (UInt16 refNum, char** smsGateway) 00554 PHN_LIB_TRAP(PhnLibTrapGetSMSGateway); 00555 00556 /** 00557 * @brief 00558 * 00559 * @param refNum: IN: 00560 * @param prefP: IN: 00561 * @retval Err Error code. 00562 **/ 00563 extern Err PhnLibGetSMSPreference (UInt16 refNum, PhnSMSPrefPtr prefP) 00564 PHN_LIB_TRAP (PhnLibTrapGetSMSPreference); 00565 00566 /** 00567 * @brief 00568 * 00569 * @param refNum: IN: 00570 * @param prefP: IN: 00571 * @retval Err Error code. 00572 **/ 00573 extern Err PhnLibSetSMSPreference (UInt16 refNum, PhnSMSPrefPtr prefP) 00574 PHN_LIB_TRAP (PhnLibTrapSetSMSPreference); 00575 00576 00577 /** 00578 * @brief 00579 * 00580 * @param refNum: IN: 00581 * @param list: IN: 00582 * @param index: IN: 00583 * @retval Err Error code. 00584 **/ 00585 extern Err PhnLibAPGetNth (UInt16 refNum, PhnAddressList list, Int16 index, 00586 PhnAddressHandle * address) 00587 PHN_LIB_TRAP (PhnLibTrapAPGetNth); 00588 00589 /** 00590 * @brief 00591 * 00592 * @param refNum: IN: 00593 * @param transactionID: IN: 00594 * @param acK: IN: 00595 * @retval Err Error code. 00596 **/ 00597 extern Err PhnLibSendSMSMTAck (UInt16 refNum, UInt8 transactionId, 00598 Boolean ack) 00599 PHN_LIB_TRAP (PhnLibTrapSendSMSMTAck); 00600 00601 /** 00602 * @brief 00603 * 00604 * @param refNum: IN: 00605 * @retval Err Error code. 00606 **/ 00607 extern Err PhnLibQuerySMSMT (UInt16 refNum) 00608 PHN_LIB_TRAP (PhnLibTrapQuerySMSMT); 00609 00610 /** 00611 * @brief 00612 * 00613 * @param refNum: IN: 00614 * @param number: IN: 00615 * @param msgID: IN: 00616 * @retval Err Error code. 00617 **/ 00618 extern Err PhnLibSetSMSCallbackNumber (UInt16 refNum, const CharPtr number, PhnDatabaseID msgID) 00619 PHN_LIB_TRAP (PhnLibTrapSetSMSCallbackNumber); 00620 00621 #endif
| Top | Palm Developer Network © 2004-2008, Palm, Inc. All rights reserved. Generated on Fri Jun 13 10:06:53 2008 for Palm API Guide |