Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

For getting sim card number i tried following APIs , but I always get MIN number.

I want to get sim card number which API I need to use.

char mobilenum[32];if(ISHELL_CreateInstance(pApp->a.m_pIShell, AEECLSID_TAPI,(void **)&pITapi) != SUCCESS){pITapi=NULL;}

if(pITapi){ITAPI_GetStatus(pITapi, &tapiStatus);STRLCPY(mobilenum,tapiStatus.szMobileID,32);}

here mobilenum= MIN number 15 digit 

--------------

 PhoneNumber = (char *)MALLOC(sizeof(char)*100); ReturnValue = ISHELL_GetDeviceInfoEx( pApp->a.m_pIShell, AEE_DEVICEITEM_MDN,PhoneNumber, &nSize );

using AEE_DEVICEITEM_MDN ReturnValue is 21 and PhoneNumber value is "".

if use AEE_DEVICEITEM_MOBILE_ID then i get Return value 0 and PhoneNumber value "".

 

Please reply.

AEE_DEVICEITEM_MDN should give phone number. You got 21 (privilege) error because you might not have added AEECLSID_MDN privilege in MIF.

AEE_DEVICEITEM_MDN should give phone number. You got 21 (privilege) error because you might not have added AEECLSID_MDN privilege in MIF.

In mif file i set following privileges enabled:
File , Network,Web access,TAPI
other privileges like Position location , Access to ringer directory,Write access to shared directory,Access to sector information,Acess to address book are disbaled in .mif file
In Extensions tab i add C:\Program Files\BREW 3.1.3\sdk\inc\AEECLSID_MDN.bid file.
I try out with protected and unprotected setiing for AEECLSID_MDN class id.But it does not work on my handset.I am using test bit enabled handset.

In mif file i set following privileges enabled:
File , Network,Web access,TAPI
other privileges like Position location , Access to ringer directory,Write access to shared directory,Access to sector information,Acess to address book are disbaled in .mif file
In Extensions tab i add C:\Program Files\BREW 3.1.3\sdk\inc\AEECLSID_MDN.bid file.
I try out with protected and unprotected setiing for AEECLSID_MDN class id.But it does not work on my handset.I am using test bit enabled handset.

Add AEECLSID_MDN class id in dependency tab.

Add AEECLSID_MDN class id in dependency tab.

In dependency tab I added AEECLSID_MDN  in used list.compile mif script. Now i get Returnvalue 0 but empty string as PhoneNumber for following function call.
int nSize = 0;
PhoneNumber = (char *)MALLOC(sizeof(char)*100); 
ReturnValue = ISHELL_GetDeviceInfoEx( pApp->a.m_pIShell, AEE_DEVICEITEM_MDN,PhoneNumber, &nSize );
Please Reply.

In dependency tab I added AEECLSID_MDN  in used list.compile mif script. Now i get Returnvalue 0 but empty string as PhoneNumber for following function call.
int nSize = 0;
PhoneNumber = (char *)MALLOC(sizeof(char)*100); 
ReturnValue = ISHELL_GetDeviceInfoEx( pApp->a.m_pIShell, AEE_DEVICEITEM_MDN,PhoneNumber, &nSize );
Please Reply.

You have to call ISHELL_GetDeviceInfoEx twice, first for getting number length and then allocating memory. Second time for getting actual number.
int numLen;
char *pBuff;
// Find the length of number
nErr = ISHELL_GetDeviceInfoEx( pMe->a.m_pIShell, AEE_DEVICEITEM_MDN, NULL, &numLen );

// Allocate a buffer to save the directory number
pBuff = MALLOC( numLen );

// Retrieve the directory number
if(pBuff)
{
nErr = ISHELL_GetDeviceInfoEx( pMe->a.m_pIShell, AEE_DEVICEITEM_MDN, pBuff, &numLen );
}

You have to call ISHELL_GetDeviceInfoEx twice, first for getting number length and then allocating memory. Second time for getting actual number.
int numLen;
char *pBuff;
// Find the length of number
nErr = ISHELL_GetDeviceInfoEx( pMe->a.m_pIShell, AEE_DEVICEITEM_MDN, NULL, &numLen );

// Allocate a buffer to save the directory number
pBuff = MALLOC( numLen );

// Retrieve the directory number
if(pBuff)
{
nErr = ISHELL_GetDeviceInfoEx( pMe->a.m_pIShell, AEE_DEVICEITEM_MDN, pBuff, &numLen );
}

Yes i have tried this way of calling GetDeviceInfoEx twice for finding phone number.But i get numLen = 0.
Please reply.

Yes i have tried this way of calling GetDeviceInfoEx twice for finding phone number.But i get numLen = 0.
Please reply.

it depends on the device, most of the device didn't support get telephone number by brew API, if you really need this function, do this way:
try to get the MDN information by the function they told you above, if failed, ask the user to manually input it.
if you are using brew mp 1.0.3 pro, you can also use this API to have a try:
ret=tapi_IAccount_GetPropString(piAcct, tapi_ACCOUNT_PROP_PHONE_NUMBER, (PSTR)hyf, sizeof(hyf), NULL);

it depends on the device, most of the device didn't support get telephone number by brew API, if you really need this function, do this way:
try to get the MDN information by the function they told you above, if failed, ask the user to manually input it.
if you are using brew mp 1.0.3 pro, you can also use this API to have a try:
ret=tapi_IAccount_GetPropString(piAcct, tapi_ACCOUNT_PROP_PHONE_NUMBER, (PSTR)hyf, sizeof(hyf), NULL);