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

Developer

Forums

Forums:

hi,

 

I need to get GPS fix for every seconds for tracking app.

I am following below procedure to get GPS fix. 

steps...

1) create instance for "pd_AEECLSID_CPosition".

2) create instance for "AEECLSID_SignalCBFactory".

3) call ISignalCBFactory_CreateSignal with gps_callback.

4) call  "pd_IPosition_OnPositionEvent"

5)  call back will be called, in side callback get gps fix and repeate step 2,3 and 4 for getting gps fix every second.

I was expecting to get a fix every second, however some times for 4 to 5 seconds gps fix was not getting i.e gps_callback is not getting called every seconds.

 

Is there way to get GPS fix every seconds?

 

fix criteria used are 

first time :

fixCriteria.validMask = (pd_FIX_CRIT_VALID_RECURRENCE_TYPE 

| pd_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 

| pd_FIX_CRIT_VALID_PREFERRED_ACCURACY 

| pd_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME

| pd_FIX_CRIT_VALID_MIN_INTERVAL

| pd_FIX_CRIT_VALID_INTERMEDIATE_POS_REPORT_ENABLED);

fixCriteria.preferredAccuracy = 1;

fixCriteria.recurrenceType = pd_SINGLE_FIX;

fixCriteria.preferredResponseTime = 60000; //(60 * 1000 ms)

fixCriteria.preferredOperationMode = pd_OPER_MODE_MSA;

fixCriteria.minInterval = 1;

result = pd_IPosition_SetfixCriteria(gps_info->gps_handle, &fixCriteria) ;

 

next time on wards...

 

fixCriteria.validMask = (pd_FIX_CRIT_VALID_RECURRENCE_TYPE 

| pd_FIX_CRIT_VALID_PREFERRED_OPERATION_MODE 

| pd_FIX_CRIT_VALID_PREFERRED_ACCURACY 

| pd_FIX_CRIT_VALID_PREFERRED_RESPONSE_TIME

| pd_FIX_CRIT_VALID_MIN_INTERVAL);

fixCriteria.preferredAccuracy = 1;

fixCriteria.recurrenceType = pd_SINGLE_FIX;

fixCriteria.preferredResponseTime = 1000; //(1 * 1000 ms)

fixCriteria.preferredOperationMode = pd_OPER_MODE_DEFAULT;

result = pd_IPosition_SetfixCriteria(gps_info->gps_handle, &fixCriteria) ;

result = pd_IPosition_RequestPosition(gps_info->gps_handle);

Plz help me on this...

Note that you can request to get the position fix on each seconds but getting posbix is asynchronous call and you may not get pos fix on each second. In other word, you can specify accuracy and interval but not necessary you would get this on same time as depending on external factors like server response, network speed(if using assisted GPS) or weather condition, open sky etc (if using standalone sattelite mode).

Note that you can request to get the position fix on each seconds but getting posbix is asynchronous call and you may not get pos fix on each second. In other word, you can specify accuracy and interval but not necessary you would get this on same time as depending on external factors like server response, network speed(if using assisted GPS) or weather condition, open sky etc (if using standalone sattelite mode).

Thanks for response.
I am using assisted GPS(mobile station) for first fix only then on switching to standalone.
Will gps callback be called only on acquiring good GPS?
Is there a way to get currently available GPS fix (good or bad) every second in brewMP?
 
 
 

Thanks for response.
I am using assisted GPS(mobile station) for first fix only then on switching to standalone.
Will gps callback be called only on acquiring good GPS?
Is there a way to get currently available GPS fix (good or bad) every second in brewMP?
 
 
 

yes you can do this, put timer in your callback, like below code snippet
static void Track_cbInfo( TrackState *pts )
{
if( pts->theInfo.status == AEEGPS_ERR_NO_ERR
|| (pts->theInfo.status == AEEGPS_ERR_INFO_UNAVAIL && pts->theInfo.fValid) ) {

#if MIN_BREW_VERSION(2,1)
pts->pResp->lat = WGS84_TO_DEGREES( pts->theInfo.dwLat );
pts->pResp->lon = WGS84_TO_DEGREES( pts->theInfo.dwLon );
#else
double wgsFactor;
wgsFactor = FASSIGN_STR("186413.5111");
pts->pResp->lat = FASSIGN_INT(pts->theInfo.dwLat);
pts->pResp->lat = FDIV(pts->pResp->lat, wgsFactor);

pts->pResp->lon = FASSIGN_INT(pts->theInfo.dwLon);
pts->pResp->lon = FDIV(pts->pResp->lon, wgsFactor);
#endif /* MIN_BREW_VERSION 2.1 */
pts->pResp->height = pts->theInfo.wAltitude - 500;

pts->pResp->dwFixNum++;

pts->pResp->nErr = SUCCESS;

Track_Notify( pts );

if( (!pts->nPendingFixes || --pts->nPendingFixes > 0)
&& FALSE == pts->bSetForCancellation ) {

if( pts->bModeAuto && pts->bModeLocal == FALSE ) {

/* Try with local first */
Track_Local( pts );
}

(void)ISHELL_SetTimerEx( pts->pShell, pts->nTrackInterval * 1000, &pts->cbIntervalTimer );
}
else {

(void)Track_Stop( pts );
}
}
else {

if( pts->bModeAuto && pts->bModeLocal ) {

/* Retry with TRACK_NETWORK */
Track_Network( pts );
Track_cbInterval( pts );
}

else {

/* Inform the application of failure code. */
pts->pResp->nErr = pts->theInfo.status;

Track_Notify( pts );

/* On timeout re-try. For other reasons bailout. */
if( pts->theInfo.status == AEEGPS_ERR_TIMEOUT ) {

Track_cbInterval( pts );
}
else {

(void)Track_Stop( pts );
}
}
}
You can refer sample code given here, sample tries to get the current posfix and if it is not avialable it will get you very close posfix to your position.https://developer.brewmp.com/file/346291/c_sampleposdet.zip

yes you can do this, put timer in your callback, like below code snippet
static void Track_cbInfo( TrackState *pts )
{
if( pts->theInfo.status == AEEGPS_ERR_NO_ERR
|| (pts->theInfo.status == AEEGPS_ERR_INFO_UNAVAIL && pts->theInfo.fValid) ) {

#if MIN_BREW_VERSION(2,1)
pts->pResp->lat = WGS84_TO_DEGREES( pts->theInfo.dwLat );
pts->pResp->lon = WGS84_TO_DEGREES( pts->theInfo.dwLon );
#else
double wgsFactor;
wgsFactor = FASSIGN_STR("186413.5111");
pts->pResp->lat = FASSIGN_INT(pts->theInfo.dwLat);
pts->pResp->lat = FDIV(pts->pResp->lat, wgsFactor);

pts->pResp->lon = FASSIGN_INT(pts->theInfo.dwLon);
pts->pResp->lon = FDIV(pts->pResp->lon, wgsFactor);
#endif /* MIN_BREW_VERSION 2.1 */
pts->pResp->height = pts->theInfo.wAltitude - 500;

pts->pResp->dwFixNum++;

pts->pResp->nErr = SUCCESS;

Track_Notify( pts );

if( (!pts->nPendingFixes || --pts->nPendingFixes > 0)
&& FALSE == pts->bSetForCancellation ) {

if( pts->bModeAuto && pts->bModeLocal == FALSE ) {

/* Try with local first */
Track_Local( pts );
}

(void)ISHELL_SetTimerEx( pts->pShell, pts->nTrackInterval * 1000, &pts->cbIntervalTimer );
}
else {

(void)Track_Stop( pts );
}
}
else {

if( pts->bModeAuto && pts->bModeLocal ) {

/* Retry with TRACK_NETWORK */
Track_Network( pts );
Track_cbInterval( pts );
}

else {

/* Inform the application of failure code. */
pts->pResp->nErr = pts->theInfo.status;

Track_Notify( pts );

/* On timeout re-try. For other reasons bailout. */
if( pts->theInfo.status == AEEGPS_ERR_TIMEOUT ) {

Track_cbInterval( pts );
}
else {

(void)Track_Stop( pts );
}
}
}
You can refer sample code given here, sample tries to get the current posfix and if it is not avialable it will get you very close posfix to your position.https://developer.brewmp.com/file/346291/c_sampleposdet.zip

Once you get position fix, A timer can be used to initiate the new request after the appropriate interval. 
sample code:
{
if( pts->theInfo.status == AEEGPS_ERR_NO_ERR ) {
// position determination was successful
// position response is in AEEGPSInfo struct,
// pts->theInfo in this example

// set a time to place the next request
ISHELL_SetTimerEx( pts->pShell, pts->nTrackInterval * 1000,
&pts->cbIntervalTimer);
}
else {
// position determination request was not successful
}

Once you get position fix, A timer can be used to initiate the new request after the appropriate interval. 
sample code:
{
if( pts->theInfo.status == AEEGPS_ERR_NO_ERR ) {
// position determination was successful
// position response is in AEEGPSInfo struct,
// pts->theInfo in this example

// set a time to place the next request
ISHELL_SetTimerEx( pts->pShell, pts->nTrackInterval * 1000,
&pts->cbIntervalTimer);
}
else {
// position determination request was not successful
}