This is what we've encountered while looking for
phone identity on Treo 6xx:


1. If the phone is type hsAttrPhoneTypeCDMA (see
HsAttrGet(hsAttrPhoneType)):

        // Treo 600 returns ESN
        // Treo 650 crashes!
        char *pEsn;
        PhnLibCardInfoEx(telRefNum,0,0,0,&pEsn,0,0,0,0);


2. If the phone is type hsAttrPhoneTypeGSM:

        // Treo 600 returns IMEI and IMSI
        // Treo 650 - don't know what happens (don't have one)
        char *pImei,*pImsi;
        PhnLibCardInfo(telRefNum,0,0,0,&pImei);
        PhnLibSIMInfo(telRefNum,&pImsi);


Code to retrieve phone number:

// 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 is not available until the SIM
// is queried, as much as 30-60 seconds after the phone is powered.

{
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)
                {
                // Need the phone type, as it changes the API
                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: Keyur Patwa
Sent: Thursday, February 17, 2005 9:00 AM
To: Palm Developer Forum
Subject: get phone number for Treo600 CDMA


Hi guys,

I know this question was asked and answered here before.
But my login is not working so I could not access the forum messages.

Can any one help me with the API call to access the phone number for CDNA
Treo600 phone.

Actually, I am trying to access the ESN number using,
PhnLibCardInfo (refrnceNum,0,0,&version,&serial);

but as it is not working, as an alternative I am trying to grab the phone
number.

Please help,
Keyur

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

Reply via email to