Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 31-07-2018, 00:04   #91
Registered User

Join Date: Jun 2018
Posts: 68
Re: OpenCPN PlugIn Development

I am hoping that one of the experts here can help me out. I have a working plugin that is using API 115. I can build the plugin outside of the OCPN source tree and copy it over to a debug version of OCPN 4.8.4 and it runs with no issues. Now, if I build the plugin as a release plugin and then build the install package... it will install into the production version of OCPN 4.8.4 but it wont load. It generates the following errors:

1:56:02 AM: PlugInManager: Loading PlugIn: C:\Program Files (x86)\OpenCPN\plugins\aismsg_pi.dll
1:56:02 AM: Error: Failed to load shared library 'C:\Program Files (x86)\OpenCPN\plugins\aismsg_pi.dll' (error 127: the specified procedure could not be found.)
1:56:02 AM: PlugInManager: Cannot load library: C:\Program Files (x86)\OpenCPN\plugins\aismsg_pi.dll

I have also tried to build a release installer version of 4.8.4 code base. I can build my own OCPN install packaged and install it... but even that one won't accept my plugin after install.

So, to recap, my plugin works in 4.8.4 as a debug plugin. Once it is compiled as a release plugin, it wont load in either the production 4.8.4 OCPN or in my own release compile of 4.8.4.

The error above, I think, indicates a mismatch with the plugin API... but I am not sure how to fix it. I have the 115 header and the 115 lib file. Any help here would be most appreciated.

Is it possible there is some other library or dll that is missing?

- Thx
Ken
__________________

cryptik is offline   Reply With Quote
Old 31-07-2018, 00:38   #92
Registered User

Join Date: Jun 2018
Posts: 68
Re: OpenCPN PlugIn Development

This is so frustrating. I can take the opencpndebugger plugin and build it on my system. It will run with no issues inside my debug version of 4.8.4 as well as the production install of 4.8.4. So, I downgraded my plugin API to 114 (to match opencpndebugger) and copied over the lib and plugin API header file to my project. It builds and runs with no issues in the debug environment. It also builds in release mode but generates the same procedure not found error when running in the production 4.8.4. I am not sure where to look to see why its failing other than this generic message.

- Ken
__________________

cryptik is offline   Reply With Quote
Old 31-07-2018, 00:57   #93
Registered User

Join Date: May 2012
Posts: 534
Re: OpenCPN PlugIn Development

Ken ...

Did you build a release opencpn.lib file and use that when you made the release .dll?

Mike
Rasbats is offline   Reply With Quote
Old 31-07-2018, 22:05   #94
Registered User

Join Date: Jun 2018
Posts: 68
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by Rasbats View Post
Ken ...

Did you build a release opencpn.lib file and use that when you made the release .dll?

Mike
Thanks Mike. I made sure to build the release dll for the install package but I mixed up the release and debug versions of the lib. I have since fixed that with some new file names. It now works, thanks to you. I am a bit embarrassed at how much time I wasted on that one.

I do have one other question... there is a capability called WANTS_AIS_SENTENCES. I have enabled that and added the handler method, but it does not appear to get called. I had assumed that it would be called when incoming AVDO or AVDM messages are received. I tested this with the ocpndebugger plugin as well... but it does not display any messages. What is this capability supposed to do? In my plugin, the WANTS_NMEA_SENTENCES and associated method is called for both NMEA and AIS (AVDO/AVDM) messages are received.

Thanks again for the tip!
- Ken
cryptik is offline   Reply With Quote
Old 01-08-2018, 00:34   #95
Registered User

Join Date: May 2012
Posts: 534
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by cryptik View Post
I do have one other question... there is a capability called WANTS_AIS_SENTENCES. I have enabled that and added the handler method, but it does not appear to get called. I had assumed that it would be called when incoming AVDO or AVDM messages are received. I tested this with the ocpndebugger plugin as well... but it does not display any messages. What is this capability supposed to do? In my plugin, the WANTS_NMEA_SENTENCES and associated method is called for both NMEA and AIS (AVDO/AVDM) messages are received.
- Ken
One for Dave R. or another lead I think. Is it for passing on the output of an AIS receiver to a plugin?

Mike
Rasbats is offline   Reply With Quote
Old 01-08-2018, 08:02   #96
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 5,327
Re: OpenCPN PlugIn Development

Ken....

WANTS_AIS_SENTENCES is not used by core OpenCPN. This API flag was added for logical completeness. Does no harm to set it in plugin prefs.

All AIS messages will be found in the NMEA message stream.

Good Luck
Dave
bdbcat is offline   Reply With Quote
Old 03-08-2018, 08:28   #97
Registered User

Join Date: Jun 2018
Posts: 68
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by bdbcat View Post
Ken....

WANTS_AIS_SENTENCES is not used by core OpenCPN. This API flag was added for logical completeness. Does no harm to set it in plugin prefs.

All AIS messages will be found in the NMEA message stream.

Good Luck
Dave
Awesome, thanks Dave. I do see the AVDO/AVDM messages from the AIS in the NMEA message stream. Right now I am trying to use the OCPN existing decoder code to partially decode the AVDM messages. At least getting them from the 6-bit to 8-bit step. I can then do my own processing to unpack the payload. My plugin is processing the AVDM message for Type 8, 12, and 14. Any advice or tips would be most appreciated.

I do have one other question.. I want to be able to click on an AIS target on the OCPN canvas and have the target information sent to my plugin. I am not sure specifically how to do this. I also want to get lat and lon information when the user clicks on a mouse location. Any tip there would be helpful as well.

Thanks to the help from folks on the forum, I have the plugin framework now working well in debug and release modes.


Thx,
Ken
cryptik is offline   Reply With Quote
Old 03-08-2018, 09:22   #98
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 5,327
Re: OpenCPN PlugIn Development

Ken....

Suggest you study the GRIB plugin. This one has mouse integration, so you will see the mouse hooks required in that code, and be able to adapt for your plugin.

Good Luck
Dave
bdbcat is offline   Reply With Quote
Old 03-08-2018, 10:06   #99
Registered User

Join Date: Jun 2018
Posts: 68
Re: OpenCPN PlugIn Development

Looks like the GRadar plugin uses a context menu... so I can use that as a coding example. Not sure yet how to get the current mouse cursor location. Also, I gather ODAPI and the Ocpn Draw plugin might be the thing to use for creating objects on the canvas. Any better suggestions are welcome

Thx
Ken
cryptik is offline   Reply With Quote
Old 03-08-2018, 10:22   #100
Registered User

Join Date: Jun 2018
Posts: 68
Re: OpenCPN PlugIn Development

So, a more specific question... I see the APIs for creating context menus and getting access to the cursor position. My question is I am not clear on what the AUI manager is and …. more importantly, do I need it to add context menu options and access the cursor locations?

I am also not sure what the delayed init functionality is for.

- Ken
cryptik is offline   Reply With Quote
Old 03-08-2018, 10:47   #101
Registered User

Join Date: Jun 2018
Posts: 68
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by bdbcat View Post
Ken....

Suggest you study the GRIB plugin. This one has mouse integration, so you will see the mouse hooks required in that code, and be able to adapt for your plugin.

Good Luck
Dave
Ok, awesome, thanks Dave... I will look at it now. - Ken
cryptik is offline   Reply With Quote
Old 03-08-2018, 11:42   #102
Registered User

Join Date: Jun 2018
Posts: 68
Re: OpenCPN PlugIn Development

Another more specific question. I have updated my plugin to use SVG toolbar icons. I have them working correctly except for perhaps two issues...

If the touchscreen interface is enabled in settings, the rollover function does not appear to work. This is consistent in other toolbar icons, so I assume this is by design.

The other issue is that when I click on my icon, it switches to toggled mode and the plugin window appears. If I click again on the toolbar icon, the window closes (as it should) and the icon goes back to its normal state (as it should). If instead, I close my plugin main window by clicking on the window close icon, the toolbar icon stays in toggled state. Is there a function all that I need to make in my plugin to inform the toolbar that I am closing the plugin? I did not see any of these kinds of calls in the other plugin examples.

thx
Ken
cryptik is offline   Reply With Quote
Old 03-08-2018, 11:59   #103
Registered User

Join Date: Jun 2018
Posts: 68
Re: OpenCPN PlugIn Development

So I will answer my own question here... I see I need to call the following function when the main dialog is closed.

Code:
SetToolbarItemState( m_leftclick_tool_id, m_bShowGrib );
- Ken
cryptik is offline   Reply With Quote
Old 03-08-2018, 18:11   #104
Registered User

Join Date: Jun 2018
Posts: 68
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by bdbcat View Post
Ken....

Suggest you study the GRIB plugin. This one has mouse integration, so you will see the mouse hooks required in that code, and be able to adapt for your plugin.

Good Luck
Dave
Hey Dave, I took your advice and looked at the Grib plugin. I am now able to capture mouse events and get the cursor lat and lon. I have another question relative to this. When you right click on an AIS target on the map, it brings up an "AIS" context menu with options like "target query" etc. Is there a simple way to add a menu item to this context menu so that it calls my plugin with information that allows me to perform a "target query" from inside my plugin?

What I want to do is essentially allow the user to right click on an AIS target and select a menu option for my plugin. For example, I would add a "Send Message" item to the AIS context menu.

Thx,
Ken
cryptik is offline   Reply With Quote
Old 03-08-2018, 19:05   #105
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 5,327
Re: OpenCPN PlugIn Development

Ken...

Consider:
1. #define INSTALLS_CONTEXTMENU_ITEMS 0x00000040

2. extern "C" DECL_EXP int AddCanvasContextMenuItem(wxMenuItem *pitem, opencpn_plugin *pplugin );

Squiddio does this.....

Dave
__________________

bdbcat is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
New Marina Development in China GordMay Pacific & South China Sea 4 29-09-2009 05:33
New Battery Research & Development BlueSovereign Electrical: Batteries, Generators & Solar 7 31-07-2009 15:47
Nautical Development 39 (Morgan 39?) riptide Monohull Sailboats 1 22-07-2009 12:53
Turks and Caicos Development Petition Canibul Atlantic & the Caribbean 5 24-04-2008 19:15



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 21:51.


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.