Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-02-2016, 01:59   #1
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 883
PlugIn LateInit

Hi,
One of the options available to plugins is to request a 'Late Init', where OCPN will call this function at the end of initialisation when all the other stuff has been completed. Looking in the pluginmanager code it would appear that this function call is only available in version 1.10 of the plugin API. Is there a reason for this or is it just an oversight?

I would like to make use of this function in OD to do some work when I know that the rest of OCPN is up and running.

Jon
__________________

__________________
jongough is offline   Reply With Quote
Old 11-02-2016, 08:58   #2
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,884
Re: PlugIn LateInit

jon...

PlugIn APIs are cumulative. So whatever exists in v110 carries forward to all later API versions. Note how each PlugIn version class derives from the previous one.

Code:
class DECL_EXP opencpn_plugin_110 : public opencpn_plugin_19
{
    public:
            opencpn_plugin_110(void *pmgr);
            virtual ~opencpn_plugin_110();

            virtual void LateInit(void); // If WANTS_LATE_INIT is returned by Init()
};

class DECL_EXP opencpn_plugin_111 : public opencpn_plugin_110
{
public:
    opencpn_plugin_111(void *pmgr);
    virtual ~opencpn_plugin_111();
    
};
So, this function should be available to you now.

Dave
__________________

__________________
bdbcat is online now   Reply With Quote
Old 11-02-2016, 13:06   #3
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 883
Re: PlugIn LateInit

Dave,
Except for:
Code:
        switch(pic->m_api_version)
        {
            case 110:
                if(pic->m_cap_flag & WANTS_LATE_INIT) {
                    wxString msg(_T("PlugInManager: Calling LateInit PlugIn: "));
                    msg += pic->m_plugin_file;
                    wxLogMessage(msg);

                    opencpn_plugin_110* ppi = dynamic_cast<opencpn_plugin_110*>(pic->m_pplugin);
                    ppi->LateInit();
                    }
                break;
        }
in PlugInManager::CallLateInit which only does the late init for version1.10.
Other PlugIn 'wants' have multiple case statements to handle new versions.

I can provide a patch for this if that is OK.

Jon
__________________
jongough is offline   Reply With Quote
Old 11-02-2016, 15:29   #4
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,884
Re: PlugIn LateInit

jon...

Sure, missed that spot.

Patch acceptable. I may do a 4.2.1 Release in a couple of weeks.

But I certainly would not code your PlugIn so that it depends on this function. O42 is what it is, bugs and all. PlugIn makers will need to work around the bugs externally.

Dave
__________________
bdbcat is online now   Reply With Quote
Old 11-02-2016, 18:15   #5
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 883
Re: PlugIn LateInit

Dave,
I would like to use this facility but it is not critical or even really required at the moment (I thought it was going to be due to a couple of crashes, but I have worked around that) for OD. I have put up a pull request for the change.

Jon
__________________
jongough is offline   Reply With Quote
Reply

Tags
plug

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenCPN PlugIn Development bdbcat OpenCPN 78 29-07-2017 03:15
Plugin: DashBoard SethDart OpenCPN 470 24-08-2016 21:34
BSB 4 PlugIn bdbcat OpenCPN 93 20-02-2016 04:41
New History Plugin for OpenCPN boat_alexandra OpenCPN 11 04-10-2010 15:11
Writing Plugin for nv.digital Map Format ? Netsurfer OpenCPN 7 17-08-2010 17:09



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 12:20.


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.