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

Developer

Forums

Forums:

Is there a way to power down the GPS receiver ? I'm trying to extend battery life and only want the GPS on by command.

see AEECLSID_GPSOneLock in api ref:-
 
A simplified example of using AEECLSID_GPSOneLock to query for the value:

nRet = ISHELL_CreateInstance(pIShell, AEECLSID_GPSOneLock, (void **) &piItemStore);
// Check return value, handle errors...

nRet = IItemStore_Get(piItemStore, &ItemBuf, nItemBufLen, &nItemLen);
// Check return value, handle errors...

if (STRICMP("true", ItemBuf))
{
//Not "true"...
}
Note: IItemStore_Get might return AEE_EBADSTATE. This is not an error, it just
indicates the iitemstore is yet to be updated with the initial status of
GPSEngine Lock value.

A simplified example of using AEECLSID_GPSOneLock to set lock

nErr = ISHELL_CreateInstance(pIShell, AEECLSID_SignalCBFactory, (void**)&pSignalFactory);
if (AEE_SUCCESS == nErr) {
nErr = ISignalCBFactory_CreateSignal(pSignalFactory, MyLockPfn, pMe, &piSignal,
&ppiSignalCtl);
}else{
//Handle error code
}

//Register for an on change

nRet = IItemStore_OnChange(piItemStore, piSignal);
// Check return value, handle errors...

//Do a set
nRet = IItemStore_Set(piItemStore, ItemBuf);
// Check return value, handle errors...

// called when signal is set
static void MyLockPfn(void *po){
myapp *pMe = (myapp *)po;
// perform action in response to change
nRet = IItemStore_Get(piItemStore, &ItemBuf, nItemBufLen, &nItemLen);
// Check return value, handle errors...
}

see AEECLSID_GPSOneLock in api ref:-
 
A simplified example of using AEECLSID_GPSOneLock to query for the value:

nRet = ISHELL_CreateInstance(pIShell, AEECLSID_GPSOneLock, (void **) &piItemStore);
// Check return value, handle errors...

nRet = IItemStore_Get(piItemStore, &ItemBuf, nItemBufLen, &nItemLen);
// Check return value, handle errors...

if (STRICMP("true", ItemBuf))
{
//Not "true"...
}
Note: IItemStore_Get might return AEE_EBADSTATE. This is not an error, it just
indicates the iitemstore is yet to be updated with the initial status of
GPSEngine Lock value.

A simplified example of using AEECLSID_GPSOneLock to set lock

nErr = ISHELL_CreateInstance(pIShell, AEECLSID_SignalCBFactory, (void**)&pSignalFactory);
if (AEE_SUCCESS == nErr) {
nErr = ISignalCBFactory_CreateSignal(pSignalFactory, MyLockPfn, pMe, &piSignal,
&ppiSignalCtl);
}else{
//Handle error code
}

//Register for an on change

nRet = IItemStore_OnChange(piItemStore, piSignal);
// Check return value, handle errors...

//Do a set
nRet = IItemStore_Set(piItemStore, ItemBuf);
// Check return value, handle errors...

// called when signal is set
static void MyLockPfn(void *po){
myapp *pMe = (myapp *)po;
// perform action in response to change
nRet = IItemStore_Get(piItemStore, &ItemBuf, nItemBufLen, &nItemLen);
// Check return value, handle errors...
}