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 73, "Telephony Basic Services."
For more information about using the telephony manager, see Chapter 10, "Telephony Manager," in Palm OS Programmer's Companion, vol. II, Communications.
Telephony Phone Book Data Structures
This chapter describes the data structures used with the phone book service set of the telephony API.
TelPhbEntryType Struct
Purpose
The TelPhbEntryType structure describes a single entry in a phone book.
Declared In
TelephonyMgrTypes.h Prototype
typedef struct _TelPhbEntryType { UInt16 phoneIndex; Char *fullName; UInt8 fullNameSize; Char *dialNumber; UInt8 dialNumberSize; } TelPhbEntryType
Fields
-
→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 Palm™ 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
telErrBufferSizeerror. -
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
fullNamebuffer. - Upon return, this is the actual size of the string, including the null terminator character. If the
fullNamebuffer 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 atelErrBufferSizeerror. -
←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
telErrBufferSizeerror. -
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
dialNumberbuffer. - Upon return, this is the actual size of the string, including the null terminator character. If the
dialNumberbuffer 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 atelErrBufferSizeerror.
TelPhbGetAvailablePhonebooksType Struct
Purpose
The TelPhbGetAvailablePhonebooks() functions uses the TelPhbGetAvailablePhonebooksType structure to return a list of the phone books available on the phone.
Declared In
TelephonyMgrTypes.h Prototype
typedef struct _TelPhbGetAvailablePhonebooksType { UInt16 count; UInt8 *phonebooksP; } TelPhbGetAvailablePhonebooksType
Fields
-
↔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
phonebooksPbuffer. 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
phonebooksPbuffer is too small to contain all of the IDs, this field is assigned the actual count, and the function using this structure generates atelErrBufferSizeerror. -
←phonebooksP - An array of retrieved phone book IDs. Each ID is one of the Phone Book Type Constants.
TelPhbGetEntriesType Struct
Purpose
The TelPhbGetEntries() function uses the TelPhbGetEntriesType structure to return a list of phone entries.
Declared In
TelephonyMgrTypes.h Prototype
typedef struct _TelPhbGetEntriesType { UInt16 first; UInt16 count; TelPhbEntryType *entriesP; } TelPhbGetEntriesType
Fields
-
→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
TelPhbEntryTypestructures.
TelPhbGetEntryCountType Struct
Purpose
The TelPhbGetEntryCount() function uses the TelPhbGetEntryCountType structure to return information about the entries in the currently selected phone book.
Declared In
TelephonyMgrTypes.h Prototype
typedef struct _TelPhbGetEntryCountType { UInt16 slots; UInt16 count; } TelPhbGetEntryCountType
Fields
-
←slots - The total number of entry slots available in the phone book.
-
count - The number of filled slots in the phone book.
TelPhbGetEntryMaxSizesType Struct
Purpose
The TelPhbGetEntryMaxSizes() function uses the TelPhbGetEntryMaxSizesType structure to return size information about the entries in the currently selected phone book.
Declared In
TelephonyMgrTypes.h Prototype
typedef struct _TelPhbGetEntryMaxSizesType { UInt8 fullNameMaxSize; UInt8 dialNumberMaxSize; } TelPhbGetEntryMaxSizesType
Fields
-
←fullNameMaxSize - The largest size of any
fullNamefield in the phone book. -
←dialNumberMaxSize - The largest size of any
dialNumberfield 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
Purpose
The phone book type constants specify the type of phone book that is currently selected.
Declared In
TelephonyMgr.h Constants
-
#define kTelPhbFixedPhonebook 0 - The phone book stored on the phone.
-
#define kTelPhbSimPhonebook 1 - The phone book stored on the SIM card.
-
#define kTelPhbPhonePhonebook 2 - The phone book stored on the phone.
-
#define kTelPhbLastDialedPhonebook 3 - The phone book from which a telephone number was most recently dialed.
-
#define kTelPhbSimAndPhonePhonebook 4 - The combined phone and SIM card phone books.
-
#define kTelPhbAdaptorPhonebook 5 - The phone book stored on the telephone adaptor.
-
#define 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.
TelPhbAddEntry Function
Purpose
Add or replace an entry in the currently selected phone book.
Declared In
TelephonyMgr.h 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
TelPhbEntryTypestructure that contains the new entry information. -
↔ioTransIdP - Set the value of this parameter to
NULLto 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 -
errNoneupon success or an error code upon failure. -
transId - The transaction ID of the operation.
-
paramP - Points to the
TelPhbEntryTypestructure passed to this function in theiEntryPparameter. -
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()
TelPhbDeleteEntry Function
Purpose
Deletes an entry from the currently selected phone book.
Declared In
TelephonyMgr.h 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
NULLto 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 -
errNoneupon 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
iEntryIndexparameter. -
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()
TelPhbGetAvailablePhonebooks Function
Purpose
Retrieve the list of all phone books available on the phone.
Declared In
TelephonyMgr.h 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
TelPhbGetAvailablePhonebooksTypestructure that lists the available phone books. - On input, the
countfield of this structure specifies the allocated size of thephonebookPbuffer. Upon return, thecountfield 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
NULLto 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 -
errNoneupon success or an error code upon failure. -
transId - The transaction ID of the operation.
-
paramP - Points to the
TelPhbGetAvailablePhonebooksTypestructure passed to this function in theiEntryPparameter. -
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
TelPhbGetEntries Function
Purpose
Retrieve a range of entries from the currently selected phone book.
Declared In
TelephonyMgr.h 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
TelPhbGetEntriesTypestructure that is updated with the phone book entry information. The first entry retrieved is specified in thefirstfield of this structure, which is zero-based; the number of entries retrieved is specified by thecountfield. Thus, the last entry retrieved is specified by: -
ioParamP->first +
ioParamP->count-1 - Upon return, the
countfield of the structure is the number of entries that were actually retrieved. - The
entriesPfield of this structure is a buffer that you allocate to contain the required number of pointers. Each pointer references aTelPhbEntryTypestructure that you must also preallocate. - On input, the
fullNameSizeanddialNumberSizefields of this structure specify the allocated sizes of thefullNameanddialNumberbuffers. Upon return, thefullNameSizeanddialNumberSizefields 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
NULLto 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 -
errNoneupon success or an error code upon failure -
transId - The transaction ID of the operation.
-
paramP - Points to the
TelPhbGetEntriesTypestructure passed to this function in theioEntriesPparameter. -
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()
TelPhbGetEntry Function
Purpose
Retrieve one entry from the currently selected phone book.
Declared In
TelephonyMgr.h 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
TelPhbEntryTypestructure that is updated with the phone book entry information. - On input, the
fullNameSizeanddialNumberSizefields of this structure specify the allocated sizes of thefullNameanddialNumberbuffers. Upon return, thefullNameSizeanddialNumberSizefields 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
NULLto 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 -
errNoneupon success or an error code upon failure. -
transId - The transaction ID of the operation.
-
paramP - Points to the
TelPhbEntryTypestructure passed to this function in theioEntryPparameter. -
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()
TelPhbGetEntryCount Function
Purpose
Retrieve the total number of entries, and the number of filled entries in the currently selected phone book.
Declared In
TelephonyMgr.h 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
TelPhbGetEntryCountTypestructure that is updated with information about the number of entries in the phone book. -
↔ioTransIdP - Set the value of this parameter to
NULLto 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 -
errNoneupon success or an error code upon failure. -
transId - The transaction ID of the operation.
-
paramP - Points to the
TelPhbGetEntryCountTypestructure passed to this function in theoParamPparameter. -
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
TelPhbGetEntryMaxSizes Function
Purpose
Retrieves the maximum buffer sizes of any entries in the currently selected phone book.
Declared In
TelephonyMgr.h 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
TelPhbGetEntryCountTypestructure that is updated with information about the maximum buffer sizes of entries in the phone book. -
↔ioTransIdP - Set the value of this parameter to
NULLto 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 -
errNoneupon success or an error code upon failure. -
transId - The transaction ID of the operation.
-
paramP - Points to the
TelPhbGetEntryCountTypestructure passed to this function in theoParamPparameter. -
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 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
TelPhbGetEntries(), TelPhbGetEntry()
TelPhbGetSelectedPhonebook Function
Purpose
Retrieve the ID of the currently selected phone book.
Declared In
TelephonyMgr.h 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
NULLto 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 -
errNoneupon 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
oPhIdPparameter. -
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 Function
Purpose
Make the specified phone book the currently selected phone book.
Declared In
TelephonyMgr.h 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
NULLto 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 -
errNoneupon 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
iPhbIdparameter. -
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()
