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

Developer

Forums

Forums:

Hi,

My application needs to get the locale country and language of the current system/device, so what 're APIs or codes I can use? thanks,

you may get it using ISHELL_GetDeviceInfo() memeber: dwLang.
values defined in AEELngCode.h.
 

you may get it using ISHELL_GetDeviceInfo() memeber: dwLang.
values defined in AEELngCode.h.
 

It's resolved, thanks shivendra.

It's resolved, thanks shivendra.

I see that dwLang is defined to contain a language code and an "optional" country code. If the optional country code is not provided here, is there any other way to retrieve a locale country for the device?
e.g., the definition for LNG_SPANISH_MEXICO includes the country code for mexico, but the definition for LNG_SPANISH includes no country code. Is there any other way to retrieve a or infer locale country for a device having dwLang of LNG_SPANISH?
Or is it correct to conclude the device reporting dwLang of LNG_SPANISH has no inherent country locale?
 
Thanks.
-steve

I see that dwLang is defined to contain a language code and an "optional" country code. If the optional country code is not provided here, is there any other way to retrieve a locale country for the device?
e.g., the definition for LNG_SPANISH_MEXICO includes the country code for mexico, but the definition for LNG_SPANISH includes no country code. Is there any other way to retrieve a or infer locale country for a device having dwLang of LNG_SPANISH?
Or is it correct to conclude the device reporting dwLang of LNG_SPANISH has no inherent country locale?
 
Thanks.
-steve

for CDMA u can get the (AEEDviceItem)AEE_DEVICEITEM_MOBILE_ID using IShell_GetDeviceInfoEx().
it contains mcc: mobile country code (3 digits).
 
for GSM, you can get PLMNID [(AEETSSInfo*)->(AEETMMInfo*)->(AEETPLMNID)] using ITELEPHONE_GetServingSystemInfo().
PLMNID contains mobile country code.

for CDMA u can get the (AEEDviceItem)AEE_DEVICEITEM_MOBILE_ID using IShell_GetDeviceInfoEx().
it contains mcc: mobile country code (3 digits).
 
for GSM, you can get PLMNID [(AEETSSInfo*)->(AEETMMInfo*)->(AEETPLMNID)] using ITELEPHONE_GetServingSystemInfo().
PLMNID contains mobile country code.

thanks. That gsm suggestion presumably would give the country associated with the network rather than the device..?
 
I stumbled onto
ILocale_GetLanguageCode()
which from its description seems to provide what's needed, but when I try it (using either
AEECLSID_OEMLocale or AEECLSID_DefaultLocale) the returned strings look like unreadable garbage even though result codes indicate SUCCESS. I tried this with similar results on three different devices. Anyone know what it takes to make this function work? (is there any working example of its use?)
 
-steve

thanks. That gsm suggestion presumably would give the country associated with the network rather than the device..?
 
I stumbled onto
ILocale_GetLanguageCode()
which from its description seems to provide what's needed, but when I try it (using either
AEECLSID_OEMLocale or AEECLSID_DefaultLocale) the returned strings look like unreadable garbage even though result codes indicate SUCCESS. I tried this with similar results on three different devices. Anyone know what it takes to make this function work? (is there any working example of its use?)
 
-steve

here is the usage: (you need to just typecase the returned (AECHAR*) string to a (char*) )
 
#include "AEEILocale.h"
#include "AEEDefaultLocale.bid"

void getCountryCode(c_Instal *pMe)
{
int nErr;
ILocale *pLocale;
AECHAR *pwStr;
char str[20];

nErr = ISHELL_CreateInstance(pMe->applet.m_pIShell, AEECLSID_DefaultLocale, (void**)&pLocale);

if(nErr != SUCCESS) {
DBGPRINTF("ILocale Instance Falied %d", nErr);
}

nErr = ILocale_GetGetLanguageCode(pLocale, &pwStr);

if(nErr != SUCCESS) {
DBGPRINTF("Get Lang Error%d", nErr);
}

DBGPRINTF("Lang Code: %s", (char*)pwStr);

FREE(pwStr);
IQI_RELEASEIF(pLocale);

here is the usage: (you need to just typecase the returned (AECHAR*) string to a (char*) )
 
#include "AEEILocale.h"
#include "AEEDefaultLocale.bid"

void getCountryCode(c_Instal *pMe)
{
int nErr;
ILocale *pLocale;
AECHAR *pwStr;
char str[20];

nErr = ISHELL_CreateInstance(pMe->applet.m_pIShell, AEECLSID_DefaultLocale, (void**)&pLocale);

if(nErr != SUCCESS) {
DBGPRINTF("ILocale Instance Falied %d", nErr);
}

nErr = ILocale_GetGetLanguageCode(pLocale, &pwStr);

if(nErr != SUCCESS) {
DBGPRINTF("Get Lang Error%d", nErr);
}

DBGPRINTF("Lang Code: %s", (char*)pwStr);

FREE(pwStr);
IQI_RELEASEIF(pLocale);

thanks. That works.
 
(Pity the hapless programmer who must try to infer that implementation from the current API description in the sdk...)

thanks. That works.
 
(Pity the hapless programmer who must try to infer that implementation from the current API description in the sdk...)