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

Developer

Forums

Forums:

Hi,I'm trying to locate the Tech Guide with details of Ring Tone Volume control and Profile Changes (Silent, Vibration, Loud).Also, is there a way to control the Vibrator of the Phone through Brew MP SDK ?All help will be appreciatedThanks-Zeshan-

Unable to extract the required info from this page as the writer doesn't tell any specifications of the Settings Interface (what's included and what's not) neither as how to use them. Is there any example which would help clear further ?
 
Thanks
-Zeshan-

Unable to extract the required info from this page as the writer doesn't tell any specifications of the Settings Interface (what's included and what's not) neither as how to use them. Is there any example which would help clear further ?
 
Thanks
-Zeshan-

Sample code to get device setting and listening for changes:
static void helloworld_Settings(helloworld * me)
{
int nErr = 0;
char buff[64] = {0};
ISignalCBFactory *piSignalCBFactory = NULL;
ISignal *piSignal = NULL;

ISettings *piSettings = NULL;
char *value;
int valueLenReq;

nErr = ISHELL_CreateInstance(me->piShell, AEECLSID_SettingsReg, (void **)&piSettings);
if(nErr != SUCCESS)
{
DBGPRINTF("***SettingsReg failed[%d]***", nErr);
SPRINTF(buff, "SettingsReg failed[%d] ", nErr);
LogToFile(buff);
return;
}
nErr = ISettings_Get((ISettings *)piSettings, "/system/display/lcdOn", value, 0, &valueLenReq);
SPRINTF(buff, "ISettings_Get [%d][%d] ", nErr, valueLenReq);
LogToFile(buff);
if(AEE_SUCCESS == nErr)
{
value = MALLOC(valueLenReq);
nErr = ISettings_Get((ISettings *)piSettings, "/system/display/lcdOn", value, valueLenReq, &valueLenReq);
SPRINTF(buff, "ISettings_Get [%d][%s] ", nErr, value);
LogToFile(buff);
}
DBGPRINTF("***ISettings_Get [%d]***", nErr);

nErr = ISHELL_CreateInstance(me->piShell, AEECLSID_SignalCBFactory, (void **)&piSignalCBFactory);
if (AEE_SUCCESS == nErr)
{
nErr = ISignalCBFactory_CreateSignal(piSignalCBFactory, helloworld_MySignalCB, (void *)me, &piSignal, &me->pISignalCtl);
if (AEE_SUCCESS == nErr)
{
nErr = ISettings_OnChange((ISettings *)piSettings, "/system/display/lcdOn", piSignal, &me->piReg);
SPRINTF(buff, "ISettings_OnChange [%d] ", nErr);
LogToFile(buff);
}
}
SPRINTF(buff, "AEECLSID_SignalCBFactory [%d] ", nErr);
LogToFile(buff);
// don't need these anymore
if (piSignal != NULL)
{
ISignal_Release(piSignal);
piSignal = NULL;
}
if (piSignalCBFactory != NULL)
{
ISignalCBFactory_Release(piSignalCBFactory);
piSignalCBFactory = NULL;
}
FREEIF(value);
//Note that the application needs to keep track of the ISignalCtl that it created as well as the registration object returned from the call.
//The application must then implement the callback routine that is to be invoked when ISettings changes the specified setting:

// Callback fired when a setting changes

static void helloworld_MySignalCB(void *pCx)
{
helloworld *me = (helloworld *)pCx;
// Do my thing ...
// re-enable the Signal I gave to ISettings to hear if this setting changes again ...
ISignalCtl_Enable(me->pISignalCtl);

static void helloworld_DetachSignals(helloworld * me)
{
ISignalCtl_Detach(me->pISignalCtl);
ISignalCtl_Release(me->pISignalCtl);
IQI_Release(me->piReg);

Iterating through settings:
const char gpszUri[100] = "/settings/Network/proxy/Address";
int nNumChildren;
int nErr = SUCCESS;
ISettings *pSettings;
if ( SUCCESS == ISHELL_CreateInstance(me->piShell, AEECLSID_SettingsReg, (void**)&pSettings))
{
DBGPRINTF("Settings Created");

if (AEE_SUCCESS == ISettings_GetNumChildren(pSettings, gpszUri,&nNumChildren))
{
char ch[25];
SPRINTF(ch, "nNumChildren : %d",nNumChildren);
DBGPRINTF(ch);

while (nNumChildren)
{
int nLenReq;
// determine size of the current child
if (AEE_SUCCESS == ISettings_GetChildName(pSettings, gpszUri, nNumChildren, NULL, 0, &nLenReq))
{
// allocate a buffer for this child
char *pAccount = (char*) MALLOC(nLenReq);
if (pAccount != NULL)
{
// get the name/value of the child
nErr = ISettings_GetChildName(pSettings, gpszUri,nNumChildren,pAccount, nLenReq, NULL);
if (AEE_SUCCESS == nErr)
{
DBGPRINTF(pAccount);
}

// release the buffer
FREE(pAccount);
// next child
nNumChildren--;
}
}
}//while (nNumChildren)

}//if (AEE_SUCCESS ==

ISettings_Release(pSettings);
pSettings = NULL;
}
else
{
DBGPRINTF("AEEIID_ISettings failed");
}
 

Sample code to get device setting and listening for changes:
static void helloworld_Settings(helloworld * me)
{
int nErr = 0;
char buff[64] = {0};
ISignalCBFactory *piSignalCBFactory = NULL;
ISignal *piSignal = NULL;

ISettings *piSettings = NULL;
char *value;
int valueLenReq;

nErr = ISHELL_CreateInstance(me->piShell, AEECLSID_SettingsReg, (void **)&piSettings);
if(nErr != SUCCESS)
{
DBGPRINTF("***SettingsReg failed[%d]***", nErr);
SPRINTF(buff, "SettingsReg failed[%d] ", nErr);
LogToFile(buff);
return;
}
nErr = ISettings_Get((ISettings *)piSettings, "/system/display/lcdOn", value, 0, &valueLenReq);
SPRINTF(buff, "ISettings_Get [%d][%d] ", nErr, valueLenReq);
LogToFile(buff);
if(AEE_SUCCESS == nErr)
{
value = MALLOC(valueLenReq);
nErr = ISettings_Get((ISettings *)piSettings, "/system/display/lcdOn", value, valueLenReq, &valueLenReq);
SPRINTF(buff, "ISettings_Get [%d][%s] ", nErr, value);
LogToFile(buff);
}
DBGPRINTF("***ISettings_Get [%d]***", nErr);

nErr = ISHELL_CreateInstance(me->piShell, AEECLSID_SignalCBFactory, (void **)&piSignalCBFactory);
if (AEE_SUCCESS == nErr)
{
nErr = ISignalCBFactory_CreateSignal(piSignalCBFactory, helloworld_MySignalCB, (void *)me, &piSignal, &me->pISignalCtl);
if (AEE_SUCCESS == nErr)
{
nErr = ISettings_OnChange((ISettings *)piSettings, "/system/display/lcdOn", piSignal, &me->piReg);
SPRINTF(buff, "ISettings_OnChange [%d] ", nErr);
LogToFile(buff);
}
}
SPRINTF(buff, "AEECLSID_SignalCBFactory [%d] ", nErr);
LogToFile(buff);
// don't need these anymore
if (piSignal != NULL)
{
ISignal_Release(piSignal);
piSignal = NULL;
}
if (piSignalCBFactory != NULL)
{
ISignalCBFactory_Release(piSignalCBFactory);
piSignalCBFactory = NULL;
}
FREEIF(value);
//Note that the application needs to keep track of the ISignalCtl that it created as well as the registration object returned from the call.
//The application must then implement the callback routine that is to be invoked when ISettings changes the specified setting:

// Callback fired when a setting changes

static void helloworld_MySignalCB(void *pCx)
{
helloworld *me = (helloworld *)pCx;
// Do my thing ...
// re-enable the Signal I gave to ISettings to hear if this setting changes again ...
ISignalCtl_Enable(me->pISignalCtl);

static void helloworld_DetachSignals(helloworld * me)
{
ISignalCtl_Detach(me->pISignalCtl);
ISignalCtl_Release(me->pISignalCtl);
IQI_Release(me->piReg);

Iterating through settings:
const char gpszUri[100] = "/settings/Network/proxy/Address";
int nNumChildren;
int nErr = SUCCESS;
ISettings *pSettings;
if ( SUCCESS == ISHELL_CreateInstance(me->piShell, AEECLSID_SettingsReg, (void**)&pSettings))
{
DBGPRINTF("Settings Created");

if (AEE_SUCCESS == ISettings_GetNumChildren(pSettings, gpszUri,&nNumChildren))
{
char ch[25];
SPRINTF(ch, "nNumChildren : %d",nNumChildren);
DBGPRINTF(ch);

while (nNumChildren)
{
int nLenReq;
// determine size of the current child
if (AEE_SUCCESS == ISettings_GetChildName(pSettings, gpszUri, nNumChildren, NULL, 0, &nLenReq))
{
// allocate a buffer for this child
char *pAccount = (char*) MALLOC(nLenReq);
if (pAccount != NULL)
{
// get the name/value of the child
nErr = ISettings_GetChildName(pSettings, gpszUri,nNumChildren,pAccount, nLenReq, NULL);
if (AEE_SUCCESS == nErr)
{
DBGPRINTF(pAccount);
}

// release the buffer
FREE(pAccount);
// next child
nNumChildren--;
}
}
}//while (nNumChildren)

}//if (AEE_SUCCESS ==

ISettings_Release(pSettings);
pSettings = NULL;
}
else
{
DBGPRINTF("AEEIID_ISettings failed");
}
 

Highly appreciated, but how do I use the Signal and Settings interface to control the profile and volume settings of the mobile device ?

Highly appreciated, but how do I use the Signal and Settings interface to control the profile and volume settings of the mobile device ?