Yes, and sometimes it even works! Here's what I've done:

// Try to get our phone number - sometimes this even works!
// The "own" phone number is the first in the "own numbers" list.
// NOTE: The phone number is not always available right away.
// For example, a GSM phone number may not be available until 30-60 seconds
// after the phone is powered. Depends on when in the startup sequence
// such attributes are read/initialized.

{
PhnAddressList list;
PhnAddressHandle address;
UInt16 count;
UInt32 phoneType;
Char *pPhoneNumber = 0;

// Get number list
if (PhnLibGetOwnNumbers(telRefNum,&list) == 0)
        {
        // How many entries in the list?
        if (PhnLibCount(telRefNum, list, &count) == 0 && count > 0)
                {
                // Get the phone type, as it changes the API for number
retrieval - bad design :(
                HsAttrGet(hsAttrPhoneType,0,&phoneType);
                // Retrieve the 1st entry from the list
                if (phoneType == hsAttrPhoneTypeCDMA)
                        err = PhnLibAPGetNth(telRefNum, list, 1, &address);
                else
                        err = PhnLibGetNth(telRefNum, list, 1, &address);
                if (err == 0)
                        {
                        // Extract the phone number from the entry. The
returned phone number is a
                        // pointer to a malloc'd piece of memory which must
be free'd after use.
                        if (phoneType == hsAttrPhoneTypeCDMA)
                                pPhoneNumber = PhnLibAPGetField(telRefNum,
address, phnAddrFldPhone);
                        else
                                pPhoneNumber = PhnLibGetField(telRefNum,
address, phnAddrFldPhone);
                        // Free the address handle
                        MemHandleFree(address);
                        }
                }
        // Deallocate the list
        PhnLibDisposeAddressList(telRefNum,list);
        }
return pPhoneNumber;
}

--------------------
Jeff Loucks
Work 425-284-1128 [EMAIL PROTECTED]
Home 253-851-8908 [EMAIL PROTECTED]
Mobile 253-691-8812


-----Original Message-----
From: Neil Whitworth 
Sent: Monday, February 14, 2005 12:08 AM
To: Palm Developer Forum
Subject: PhnLibGetOwnNumbers On Treo 600


I need to be able to get the phone number on a treo 600, and have found 
this function. It claims to be able to get a list of numbers on both GSM 
and CDMA phones, but there is very little documentaion for it.

It is declared in HsPhoneNetwork.h as :-
Err PhnLibGetOwnNumbers (UInt16 refNum, PhnAddressList* ownNumbers)

and a PhnAddressList is typedefed in HsPhoneTypes as :-
typedef VoidHand        PhnAddressList;    /**< Description  */



Has anyone else used this function? I sthere a better way of getting the 
phone number?

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to