< Home < Developers < Development Support < Documentation

## 74 Telephony Phone Book

Table of Contents | < Previous | Next > | Index

| Title - Palm OS® Programmer's API Reference Part III: Communications 74 Telephony Phone Book Telephony Phone Book Data Structures TelPhbEntryType TelPhbGetAvailablePhonebooksType TelPhbGetEntriesType TelPhbGetEntryCountType TelPhbGetEntryMaxSizesType Telephony Phone Book Constants Phone Book Type Constants Telephony Phone Book Functions TelPhbAddEntry TelPhbDeleteEntry TelPhbGetAvailablePhonebooks TelPhbGetEntries TelPhbGetEntry TelPhbGetEntryCount TelPhbGetEntryMaxSizes TelPhbGetSelectedPhonebook TelPhbSelectPhonebook |  |  |  | This chapter describes the phone book service set of the telephony API. For more information about the telephony manager basic services and the different service sets, see Chapter 69, "Telephony Basic Services." This chapter describes: Telephony Phone Book Data Structures Telephony Phone Book Constants Telephony Phone Book Functions For more information about using the telephony manager, see Chapter 8, "Telephony Manager" in the Palm OS Programmer's Companion. ## Telephony Phone Book Data Structures This chapter describes the data structures used with the phone book service set of the telephony API. ## New TelPhbEntryType The TelPhbEntryType structure describes a single entry in a phone book.
    typedef struct _TelPhbEntryType
    {
      UInt16   phoneIndex;
      Char     *fullName;
      UInt8    fullNameSize;
      Char     *dialNumber;
      UInt8    dialNumberSize;
    } TelPhbEntryType;
#### Field Descriptions #####
-> | phoneIndex | The index of the entry in the phone's phone book. This index is always zero-based. The telephony manager is responsible for converting this index into the physical index in the phone, if required.
<- | fullName | A buffer into which the retrieved full name of the entry is stored. This string is stored using the local character set of the PalmTM handheld device. The telephony manager is responsible for converting the character set, if required. Note that if this buffer is too small to contain the entire retrieved string, the string is truncated and the function using this structure generates a telErrBufferSize error.
<-> | fullNameSize | The size of the fullName string. When the structure is used as an input parameter, this is the allocated size, in bytes, of the fullName buffer. Upon return, this is the actual size of the string, including the null terminator character. If the fullName buffer is too small to contain all of the retrieved string, this field is assigned the entire length of the string, and the function using this structure generates a telErrBufferSize error.
<- | dialNumber | A buffer into which the retrieved telephone number of the entry is stored. Note that if this buffer is too small to contain the entire retrieved string, the string is truncated, and the function using this structure generates a telErrBufferSize error.
<-> | dialNumberSize | The size of the dialNumber string. When the structure is used as an input parameter, this is the allocated size, in bytes, of the dialNumber buffer. Upon return, this is the actual size of the string, including the null terminator character. If the dialNumber buffer is too small to contain all of the retrieved string, this field is assigned the entire length of the string, and the function using this structure generates a telErrBufferSize error.
## New TelPhbGetAvailablePhonebooksType The TelPhbGetAvailablePhonebooks functions uses the TelPhbGetAvailablePhonebooksType structure to return a list of the phone books available on the phone.
    typedef struct _TelPhbGetAvailablePhonebooksType
    {
      UInt16   count;
      UInt8    *phonebooksP;
    } TelPhbGetAvailablePhonebooksType;
#### Field Descriptions #####
<-> | count | The number of entries in the array referenced by phonebooksP. When the structure is used as an input parameter, this is the allocated size, in bytes, of the phonebooksP buffer. Upon return, this is the actual size of the retrieved data. Upon return, this is the actual number of phone book IDs that could be retrieved. If the phonebooksP buffer is too small to contain all of the IDs, this field is assigned the actual count, and the function using this structure generates a telErrBufferSize error.
<- | phonebooksP | An array of retrieved phone book IDs. Each ID is one of the Phone Book Type Constants.
## New TelPhbGetEntriesType The TelPhbGetEntries function uses the TelPhbGetEntriesType structure to return a list of phone entries.
    typedef struct _TelPhbGetEntriesType
    {
      UInt16             first;
      UInt16             count;
      TelPhbEntryType    *entriesP;
    } TelPhbGetEntriesType;
#### Field Descriptions #####
-> | first | The index of the first entry in the array referenced by entriesP.
<-> | count | When the structure is used as an input parameter, this is number of entries that you want retrieved. Upon return, this is the actual number of entries that were retrieved.
<- | entriesP | An array of pointers to retrieved TelPhbEntryType structures.
## New TelPhbGetEntryCountType The TelPhbGetEntryCount function uses the TelPhbGetEntryCountType structure to return information about the entries in the currently selected phone book.
    typedef struct _TelPhbGetEntryCountType
    {
      UInt16         slots;
      UInt16         count;
    } TelPhbGetEntryCountType;
#### Field Descriptions #####
<- | slots | The total number of entry slots available in the phone book.
c | count | The number of filled slots in the phone book.
## New TelPhbGetEntryMaxSizesType The TelPhbGetEntryMaxSizes function uses the TelPhbGetEntryMaxSizesType structure to return size information about the entries in the currently selected phone book.
    typedef struct _TelPhbGetEntryMaxSizeType
    {
      UInt8          fullNameMaxSize;
      UInt8          dialNumberMaxSize;
    } TelPhbGetEntryMaxSizesType;
#### Field Descriptions #####
<- | fullNameMaxSize | The largest size of any fullName field in the phone book.
<- | dialNumberMaxSize | The largest size of any dialNumber field in the phone book.
## Telephony Phone Book Constants This section describes the constants used with the phone book service set of the telephony API. ## Phone Book Type Constants The phone book type constants specify the type of phone book that is currently selected. #####
Constant | Value | Description
--- | --- | ---
kTelPhbFixedPhonebook | 0 | The phone book stored on the phone.
kTelPhbSimPhonebook | 1 | The phone book stored on the SIM card.
kTelPhbPhonePhonebook | 2 | The phone book stored on the phone.
kTelPhbLastDialedPhonebook | 3 | The phone book from which a telephone number was most recently dialed.
kTelPhbSimAndPhonePhonebook | 4 | The combined phone and SIM card phone books.
kTelPhbAdaptorPhonebook | 5 | The phone book stored on the telephone adaptor.
kTelPhbFirstOemPhonebook | 6 | The ID of the first OEM phone book. You can specify additional OEM phone books by incrementing this value; for example, the second OEM phone book is specified as: kTelPhbFirstOemPhonebook+1
## Telephony Phone Book Functions This section describes the functions used with the phone book service set of the telephony API. ## New TelPhbAddEntry #### Purpose Add or replace an entry in the currently selected phone book. #### Prototype Err TelPhbAddEntry(UInt16 iRefnum, TelAppID iAppId, TelPhbEntryType *iEntryP, UInt16 *ioTransIdP); #### Parameters #####
-> iRefnum | The telephony manager library reference number.
#####
-> iAppId | The telephone application attachment identifier for your application.
#####
-> iEntryP | A pointer to a TelPhbEntryType structure that contains the new entry information.
#####
<-> ioTransIdP | Set the value of this parameter to NULL to cause the function to execute synchronously.
#####
| If this parameter is not NULL, the call executes asynchronously. Upon return from this function, this points to the transaction identifier associated with the asynchronous operation.
#### Synchronous Result Returns errNone if the function was successful or returns an error code if not successful. #### Asynchronous Result The following fields are updated in the TelEventType event that is sent when the operation completes: #####
returnCode | errNone upon success or an error code upon failure.
transId | The transaction ID of the operation.
paramP | Points to the TelPhbEntryType structure passed to this function in the iEntryP parameter.
functionId | kTelPhbAddEntryMessage
WARNING! When using this function asynchronously, you must ensure that the structure referenced by iEntryP remains in memory until the asynchronous call completes. #### Comments The phoneIndex field of the TelPhbEntryType structure referenced by iEntryP specifies the index at which to write the entry. Before using this function, you should verify that it is available by calling the TelIsPhbServiceAvailable macro. #### Compatibility Implemented only if 4.0 New Feature Set is present. #### See Also TelPhbDeleteEntry, TelPhbSelectPhonebook ## New TelPhbDeleteEntry #### Purpose Deletes an entry from the currently selected phone book. #### Prototype Err TelPhbDeleteEntry(UInt16 iRefnum, TelAppID iAppId, UInt16 iEntryIndex, UInt16 *ioTransIdP); #### Parameters #####
-> iRefnum | The telephony manager library reference number.
#####
-> iAppId | The telephone application attachment identifier for your application.
#####
-> iEntryIndex | The zero-based, logical index of the entry that you want deleted. The Telephony Manager computes the physical index.
#####
<-> ioTransIdP | Set the value of this parameter to NULL to cause the function to execute synchronously.
#####
| If this parameter is not NULL, the call executes asynchronously. Upon return from this function, this points to the transaction identifier associated with the asynchronous operation.
#### Synchronous Result Returns errNone if the function was successful or returns an error code if not successful. #### Asynchronous Result The following fields are updated in the TelEventType event that is sent when the operation completes: #####
returnCode | errNone upon success or an error code upon failure.
transId | The transaction ID of the operation.
paramP | Points to the unsigned integer value passed to this function in the iEntryIndex parameter.
functionId | kTelPhbDeleteEntryMessage
WARNING! When using this function asynchronously, you must ensure that the structure referenced by iEntryP remains in memory until the asynchronous call completes. #### Comments Before using this function, you should verify that it is available by calling the TelIsPhbServiceAvailable macro. #### Compatibility Implemented only if 4.0 New Feature Set is present. #### See Also TelPhbAddEntry, TelPhbSelectPhonebook ## New TelPhbGetAvailablePhonebooks #### Purpose Retrieve the list of all phone books available on the phone. #### Prototype Err TelPhbGetAvailablePhonebooks(UInt16 iRefnum, TelAppID iAppId, TelPhbGetAvailablePhonebooksType *ioParamP, UInt16 *ioTransIdP); #### Parameters #####
-> iRefnum | The telephony manager library reference number.
#####
-> iAppId | The telephone application attachment identifier for your application.
#####
<-> ioParamP | A pointer to a TelPhbGetAvailablePhonebooksType structure that lists the available phone books.
#####
| On input, the count field of this structure specifies the allocated size of the phonebookP buffer. Upon return, the count field specifies the actual number of entries retrieved, even if they were truncated to fit into the buffer.
#####
<-> ioTransIdP | Set the value of this parameter to NULL to cause the function to execute synchronously.
#####
| If this parameter is not NULL, the call executes asynchronously. Upon return from this function, this points to the transaction identifier associated with the asynchronous operation.
#### Synchronous Result Returns errNone if the function was successful or returns an error code if not successful. #### Asynchronous Result The following fields are updated in the TelEventType event that is sent when the operation completes: #####
returnCode | errNone upon success or an error code upon failure.
transId | The transaction ID of the operation.
paramP | Points to the TelPhbGetAvailablePhonebooksType structure passed to this function in the iEntryP parameter.
functionId | kTelPhbGetAvailablePhonebooksMessage
WARNING! When using this function asynchronously, you must ensure that the structure referenced by ioParamP remains in memory until the asynchronous call completes. #### Comments The phone book IDs are stored into the phonebookP field of the TelPhbGetAvailablePhonebooksType structure referenced by ioParamP. If the phonebookP buffer is too small to contain all of the IDs, the information is truncated and this function returns the telErrBufferSize error. The count field of the structure is always updated to contain the actual number of entries that were retrieved. Before using this function, you should verify that it is available by calling the TelIsPhbServiceAvailable macro. #### Compatibility Implemented only if 4.0 New Feature Set is present. #### See Also TelPhbSelectPhonebook ## New TelPhbGetEntries #### Purpose Retrieve a range of entries from the currently selected phone book. #### Prototype Err TelPhbGetEntries(UInt16 iRefnum, TelAppID iAppId, TelPhbGetEntriesType *ioParamP, UInt16 *ioTransIdP); #### Parameters #####
-> iRefnum | The telephony manager library reference number.
#####
-> iAppId | The telephone application attachment identifier for your application.
#####
<-> ioParamP | A pointer to a TelPhbGetEntriesType structure that is updated with the phone book entry information. The first entry retrieved is specified in the first field of this structure, which is zero-based; the number of entries retrieved is specified by the count field. Thus, the last entry retrieved is specified by:
#####
| ioParamP->first + ioParamP->count-1
#####
| Upon return, the count field of the structure is the number of entries that were actually retrieved.
#####
| The entriesP field of this structure is a buffer that you allocate to contain the required number of pointers. Each pointer references a TelPhbEntryType structure that you must also preallocate.
#####
| On input, the fullNameSize and dialNumberSize fields of this structure specify the allocated sizes of the fullName and dialNumber buffers. Upon return, the fullNameSize and dialNumberSize fields specify the actual sizes of the buffers, even if a string was truncated to fit into the buffer.
#####
<-> ioTransIdP | Set the value of this parameter to NULL to cause the function to execute synchronously.
#####
| If this parameter is not NULL, the call executes asynchronously. Upon return from this function, this points to the transaction identifier associated with the asynchronous operation.
#### Synchronous Result Returns errNone if the function was successful or returns an error code if not successful. #### Asynchronous Result The following fields are updated in the TelEventType event that is sent when the operation completes: #####
returnCode | errNone upon success or an error code upon failure
transId | The transaction ID of the operation.
paramP | Points to the TelPhbGetEntriesType structure passed to this function in the ioEntriesP parameter.
functionId | kTelPhbGetEntriesMessage
WARNING! When using this function asynchronously, you must ensure that the structure referenced by ioParamP and any structures that it references remain in memory until the asynchronous call completes. #### Comments The phone book information is stored into the TelPhbEntryType structures that you preallocate and refer to in the entriesP field of the TelPhbGetEntriesType referenced by the ioParamP parameter. If any buffer in any of the TelPhbEntryType structures is too small, the string intended for that buffer is truncated, and this function returns the telErrBufferSize error. In any case, the fullNameSize and dialNumberSize fields of each TelPhbEntryType structure contain the actual size of their respective strings. If any entries in the specified range are empty, the entry is not retrieved, and the count value in the structure is updated. Before using this function, you should verify that it is available by calling the TelIsPhbServiceAvailable macro. #### Compatibility Implemented only if 4.0 New Feature Set is present. #### See Also TelPhbGetEntry, TelPhbSelectPhonebook ## New TelPhbGetEntry #### Purpose Retrieve one entry from the currently selected phone book. #### Prototype Err TelPhbGetEntry(UInt16 iRefnum, TelAppID iAppId, TelPhbEntryType *ioEntryP, UInt16 *ioTransIdP); #### Parameters #####
-> iRefnum | The telephony manager library reference number.
#####
-> iAppId | The telephone application attachment identifier for your application.
#####
<-> ioEntryP | A pointer to a TelPhbEntryType structure that is updated with the phone book entry information.
#####
| On input, the fullNameSize and dialNumberSize fields of this structure specify the allocated sizes of the fullName and dialNumber buffers. Upon return, the fullNameSize and dialNumberSize fields specify the actual sizes of the buffers, even if a string was truncated to fit into the buffer.
#####
<-> ioTransIdP | Set the value of this parameter to NULL to cause the function to execute synchronously.
#####
| If this parameter is not NULL, the call executes asynchronously. Upon return from this function, this points to the transaction identifier associated with the asynchronous operation.
#### Synchronous Result Returns errNone if the function was successful or returns an error code if not successful. #### Asynchronous Result The following fields are updated in the TelEventType event that is sent when the operation completes: #####
returnCode | errNone upon success or an error code upon failure.
transId | The transaction ID of the operation.
paramP | Points to the TelPhbEntryType structure passed to this function in the ioEntryP parameter.
functionId | kTelPhbGetEntryMessage
#### Comments The phone book information is stored into the TelPhbEntryType that you preallocate. If either buffer in the structure is too small, the string intended for that buffer is truncated, and this function returns the telErrBufferSize error. In any case, the fullNameSize and dialNumberSize fields of the structure contain the actual size of their respective strings. Before using this function, you should verify that it is available by calling the TelIsPhbServiceAvailable macro. #### Compatibility Implemented only if 4.0 New Feature Set is present. #### See Also TelPhbGetEntries, TelPhbSelectPhonebook ## New TelPhbGetEntryCount #### Purpose Retrieve the total number of entries, and the number of filled entries in the currently selected phone book. #### Prototype Err TelPhbGetEntryCount(UInt16 iRefnum, TelAppID iAppId, TelPhbGetEntryCountType *oParamP, UInt16 *ioTransIdP); #### Parameters #####
-> iRefnum | The telephony manager library reference number.
#####
-> iAppId | The telephone application attachment identifier for your application.
#####
<- oParamP | A pointer to a TelPhbGetEntryCountType structure that is updated with information about the number of entries in the phone book.
#####
<-> ioTransIdP | Set the value of this parameter to NULL to cause the function to execute synchronously.
#####
| If this parameter is not NULL, the call executes asynchronously. Upon return from this function, this points to the transaction identifier associated with the asynchronous operation.
#### Synchronous Result Returns errNone if the function was successful or returns an error code if not successful. #### Asynchronous Result The following fields are updated in the TelEventType event that is sent when the operation completes: #####
returnCode | errNone upon success or an error code upon failure.
transId | The transaction ID of the operation.
paramP | Points to the TelPhbGetEntryCountType structure passed to this function in the oParamP parameter.
functionId | kTelPhbGetEntryCountMessage
WARNING! When using this function asynchronously, you must ensure that the structure referenced by oParamP remains in memory until the asynchronous call completes. #### Comments The total number of slots and the number of filled slots in the currently selected phone book are stored in the TelPhbGetEntryCountType structure referenced by oParamP. Before using this function, you should verify that it is available by calling the TelIsPhbServiceAvailable macro. #### Compatibility Implemented only if 4.0 New Feature Set is present. #### See Also TelPhbSelectPhonebook ## New TelPhbGetEntryMaxSizes #### Purpose Retrieves the maximum buffer sizes of any entries in the currently selected phone book. #### Prototype Err TelPhbGetEntryMaxSizes(UInt16 iRefnum, TelAppID iAppId, TelPhbGetEntryMaxSizesType *oParamP, UInt16 *ioTransIdP); #### Parameters #####
-> iRefnum | The telephony manager library reference number.
#####
-> iAppId | The telephone application attachment identifier for your application.
#####
<- oParamP | A pointer to a TelPhbGetEntryMaxSizesType structure that is updated with information about the maximum buffer sizes of entries in the phone book.
#####
<-> ioTransIdP | Set the value of this parameter to NULL to cause the function to execute synchronously.
#####
| If this parameter is not NULL, the call executes asynchronously. Upon return from this function, this points to the transaction identifier associated with the asynchronous operation.
#### Synchronous Result Returns errNone if the function was successful or returns an error code if not successful. #### Asynchronous Result The following fields are updated in the TelEventType event that is sent when the operation completes: #####
returnCode | errNone upon success or an error code upon failure.
transId | The transaction ID of the operation.
paramP | Points to the TelPhbGetEntryMaxSizesType structure passed to this function in the oParamP parameter.
functionId | kTelPhbGetEntryMaxSizesMessage
WARNING! When using this function asynchronously, you must ensure that the structure referenced by oParamP remains in memory until the asynchronous call completes. #### Comments The maximum size of any full name entry and the maximum size of any telephone number entry in the currently selected phone book are stored in the TelPhbGetEntryMaxSizesType structure referenced by oParamP. Before using this function, you should verify that it is available by calling the TelIsPhbServiceAvailable macro. #### Compatibility Implemented only if 4.0 New Feature Set is present. #### See Also TelPhbGetEntries, TelPhbGetEntry ## New TelPhbGetSelectedPhonebook #### Purpose Retrieve the ID of the currently selected phone book. #### Prototype Err TelPhbGetSelectedPhonebook(UInt16 iRefnum, TelAppID iAppId, UInt8 *oPhbIdP, UInt16 *ioTransIdP); #### Parameters #####
-> iRefnum | The telephony manager library reference number.
#####
-> iAppId | The telephone application attachment identifier for your application.
#####
<- oPhbIdP | A pointer to an unsigned byte value. Upon return, this is filled in with the identifier of the currently selected phone book. The identifier is one of the Phone Book Type Constants.
#####
<-> ioTransIdP | Set the value of this parameter to NULL to cause the function to execute synchronously.
#####
| If this parameter is not NULL, the call executes asynchronously. Upon return from this function, this points to the transaction identifier associated with the asynchronous operation.
#### Synchronous Result Returns errNone if the function was successful or returns an error code if not successful. #### Asynchronous Result The following fields are updated in the TelEventType event that is sent when the operation completes: #####
returnCode | errNone upon success or an error code upon failure.
transId | The transaction ID of the operation.
paramP | Points to the unsigned integer value passed to this function in the oPhIdP parameter.
functionId | kTelPhbGetSelectedPhonebookMessage
WARNING! When using this function asynchronously, you must ensure that the value referenced by oPhbIdP remains in memory until the asynchronous call completes. #### Comments Before using this function, you should verify that it is available by calling the TelIsPhbServiceAvailable macro. #### Compatibility Implemented only if 4.0 New Feature Set is present. #### See Also TelPhbSelectPhonebook ## New TelPhbSelectPhonebook #### Purpose Make the specified phone book the currently selected phone book. #### Prototype Err TelPhbSelectPhonebook(UInt16 iRefnum, TelAppID iAppId, UInt8 iPhbId, UInt16 *ioTransIdP); #### Parameters #####
-> iRefnum | The telephony manager library reference number.
#####
-> iAppId | The telephone application attachment identifier for your application.
#####
-> iPhbId | The identifier of the phone book that you want selected as the current phone book. This must be one of the Phone Book Type Constants.
#####
<-> ioTransIdP | Set the value of this parameter to NULL to cause the function to execute synchronously.
#####
| If this parameter is not NULL, the call executes asynchronously. Upon return from this function, this points to the transaction identifier associated with the asynchronous operation.
#### Synchronous Result Returns errNone if the function was successful or returns an error code if not successful. #### Asynchronous Result The following fields are updated in the TelEventType event that is sent when the operation completes: #####
returnCode | errNone upon success or an error code upon failure.
transId | The transaction ID of the operation.
paramP | Points to the unsigned integer value passed to this function in the iPhbId parameter.
functionId | kTelPhbSelectPhonebookMessage
#### Comments Before using this function, you should verify that it is available by calling the TelIsPhbServiceAvailable macro. #### Compatibility Implemented only if 4.0 New Feature Set is present. #### See Also TelPhbGetAvailablePhonebooks, TelPhbGetSelectedPhonebook |