Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 24-03-2013, 03:32   #1
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 304
Plugin api coding

Hoi,
I could use some help with coding.
At the moment I am trying to find out if a valid gps position is available. When possible without parsing the nmea sentences again in my plugin.:-)
Dirk
__________________

__________________
rooiedirk is offline   Reply With Quote
Old 25-03-2013, 18:17   #2
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,884
Re: Plugin api coding

Dirk....

PlugIns will get "cooked" position reports if requested.

Look here:


Code:
void PlugInManager::SendPositionFixToAllPlugIns(GenericPosDatEx *ppos)
.
.
.
    for(unsigned int i = 0 ; i < plugin_array.GetCount() ; i++)
    {
        PlugInContainer *pic = plugin_array.Item(i);
        if(pic->m_bEnabled && pic->m_bInitState)
        {
            if(pic->m_cap_flag & WANTS_NMEA_EVENTS)
                pic->m_pplugin->SetPositionFix(pfix);
        }
    }
.
.
.
Your PlugIn will get called thru method SetPositionFix() on each NMEA position fix calculated by the core program.

Good Luck
Dave
__________________

__________________
bdbcat is offline   Reply With Quote
Old 02-04-2013, 14:37   #3
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 304
Re: Plugin api coding

Still have a problem. If I have a look with the debugger PI, I get this form the core program. (PlugIn_Position_Fix_Ex)
Code:
og: 181.900000, Hdm: nan, Hdt: 203.000000, Lat: 52.761158, Lon: 0.396203, Sog: 0.000000, Var: nan, nSats: 0, Fixtime: 1364933328
Cog: 181.900000, Hdm: nan, Hdt: 203.000000, Lat: 52.761158, Lon: 0.396203, Sog: 0.000000, Var: nan, nSats: 0, Fixtime: 1364933329
Cog: nan, Hdm: nan, Hdt: nan, Lat: 52.761158, Lon: 0.396203, Sog: nan, Var: nan, nSats: 0, Fixtime: 1364933330
Cog: nan, Hdm: nan, Hdt: nan, Lat: 52.761158, Lon: 0.396203, Sog: nan, Var: nan, nSats: 0, Fixtime: 1364933331
first two lines is with connected NMEA source, last two lines without.(pulled out the plug) If there is no input, Cog, Hdg etc go blank, but Lat and Lon are still send, and fixtime is also updated, even if there clearly is no fix.
PlugIn_Position_Fix is behaving the same.
Could (should) this be changed?? or is there a good reason for having it like this?
gr
Dirk
__________________
rooiedirk is offline   Reply With Quote
Old 02-04-2013, 18:43   #4
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,884
Re: Plugin api coding

Dirk....

Hmmm, I see your point.
Perhaps we should add a "valid" flag to the fix sent to the PlugIn, or maybe cause the fixtime to actually reflect the correct time of fix.
In any case, it looks like the PlugIn API is deficient on this point.

We can fix this on the next release.
Meanwhile, I'd suggest that you proceed and simply consider the fix to be invalid if COG and SOG are NaN. I'm pretty sure this will work.

Dave
__________________
bdbcat is offline   Reply With Quote
Old 03-04-2013, 02:08   #5
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 304
Re: Plugin api coding

Dave,
If the fixtime is giving the real time of the last fix it would be logical again. (at least to me)
Dirk
__________________
rooiedirk is offline   Reply With Quote
Old 03-04-2013, 03:13   #6
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 304
Re: Plugin api coding

Dave,
I did a quick search and hack. In chart1.cpp line 4653 from
Code:
                wxDateTime now = wxDateTime::Now();
                GPSData.FixTime = now.GetTicks();
to
Code:
if (bGPSValid)
            {
                wxDateTime now = wxDateTime::Now();
                GPSData.FixTime = now.GetTicks();
            }
            else
                GPSData.FixTime = 0;
does look like doing the trick for me. I tried it with a AIS over UDP and a GPS over usb. Both cases the Fixtime go's to zero without fix.
Not sure if it will break something else somewhere.
grjes
Dirk
__________________
rooiedirk is offline   Reply With Quote
Old 03-04-2013, 09:49   #7
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,884
Re: Plugin api coding

dirk...
I agree with you.

I think the correct solution is for the fixtime field to contain the last valid fixtime. So your PlugIn will likely want to implement a watchdog timer on this structure member.

Coming in next Beta.

Dave
__________________

__________________
bdbcat is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 15:00.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.