Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 11-02-2016, 00:59   #1
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 1,077
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, 07:58   #2
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
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 offline   Reply With Quote
Old 11-02-2016, 12:06   #3
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 1,077
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, 14:29   #4
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,401
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 offline   Reply With Quote
Old 11-02-2016, 17:15   #5
Registered User

Join Date: May 2013
Location: NSW, Australia
Boat: Richter 42
Posts: 1,077
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


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
Plugin: DashBoard SethDart OpenCPN 644 02-04-2024 16:55
OpenCPN PlugIn Development bdbcat OpenCPN 161 04-09-2019 12:50
BSB 4 PlugIn bdbcat OpenCPN 98 25-04-2018 18:46
New History Plugin for OpenCPN seandepagnier OpenCPN 11 04-10-2010 14:11
Writing Plugin for nv.digital Map Format ? Netsurfer OpenCPN 7 17-08-2010 16:09

Advertise Here


All times are GMT -7. The time now is 16:24.


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.