Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 13-09-2018, 16:03   #121
Registered User

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

Got hopefully an easy question. I know I can have OCPN output a message using the PushNMEABuffer() method. I have OCPN configured with one COM port setup to receive strings from a class A AIS. So, it is setup as "input". I then have a plugin that receives strings from the AIS by monitoring the SendNMEAMessage(). This all works just fine. What I want to do now is to send NMEA strings to the AIS that include configuration commands. I have the code doing that..but when I call the PushNMEABuffer() method, I see the strings appear in the OCPN NMA debug window as (Virtual while the strings coming in say (Serial:COM1). I assume that if the port in the configuration settings is only configured as "input" then the PushNMEABuffer() does not actually send anything (i.e. "virtual"). So, if I configure the port as "input/output" by checking the "output on this port (as autopilot or NMEA repeater)", will OCPN repeat the incoming commands from the AIS as output? Is there a way to configure the settings so the only strings going out are the ones sent via the PushNMEABuffer() method?

- thx
Ken
__________________

cryptik is offline   Reply With Quote
Old 13-09-2018, 17:20   #122
Registered User
 
boat_alexandra's Avatar

Join Date: Aug 2009
Location: charleston
Boat: bristol 27
Posts: 3,399
Re: OpenCPN PlugIn Development

I believe it will output on the port if the plugin pushes it but I never actually tried this case.

As for the only strings going out.. you could set a filter in the connection to only pass those messages, but I don't think there is a way to prevent them from being sent if the same messages arrived from a different connection rather than your plugin.
__________________

boat_alexandra is offline   Reply With Quote
Old 13-09-2018, 17:44   #123
Registered User

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

Quote:
Originally Posted by boat_alexandra View Post
I believe it will output on the port if the plugin pushes it but I never actually tried this case.

As for the only strings going out.. you could set a filter in the connection to only pass those messages, but I don't think there is a way to prevent them from being sent if the same messages arrived from a different connection rather than your plugin.
All good info. I did some testing and it does send out the message once you setup the port as a repeater. The down side is that it repeats all incoming messages. Your filter idea is a good one. Enabling the outgoing filter does block sentences from being repeated but you can only select from a subset of messages. My AIS sends out a couple of strings that OCPN does not include in the filter list (i.e. GPGSA) BUT, adding an input "accept only" rule and a "drop" rule on output got me to where I needed to be. Thanks for the tip.
cryptik is offline   Reply With Quote
Old 13-09-2018, 20:04   #124
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,745
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by cryptik View Post
All good info. I did some testing and it does send out the message once you setup the port as a repeater. The down side is that it repeats all incoming messages. Your filter idea is a good one. Enabling the outgoing filter does block sentences from being repeated but you can only select from a subset of messages. My AIS sends out a couple of strings that OCPN does not include in the filter list (i.e. GPGSA) BUT, adding an input "accept only" rule and a "drop" rule on output got me to where I needed to be. Thanks for the tip.
You can add absolutely anything to the filter (Click on the "Add" button), the predefined list is there just to save you some typing for the most common message types...
nohal is offline   Reply With Quote
Old 13-09-2018, 22:50   #125
Registered User

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

Quote:
Originally Posted by nohal View Post
You can add absolutely anything to the filter (Click on the "Add" button), the predefined list is there just to save you some typing for the most common message types...
LOL, I did not even see the add button and it's right there. Thanks for the tip, that solved my issue and made my day
cryptik is offline   Reply With Quote
Old 14-09-2018, 09:48   #126
Registered User

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

So with the OCPN filters, I am able to receive sentences from my pilot port connected AIS and I can send out command messages to the AIS over the same port. Basically, I have no filters on the input and I have an output filter that only transmits ECBBM messages to the AIS. When running, I can see my ECBBM messages going out and the output filter blocks the retransmission of input strings from the AIS.

But, I have a new issue. It appears that everything sent out using PushNMEABuffer() is also passed to SendNMEAMessage() and comes back to my plugin. Setting an input filter on the port does not have any effect since this incoming message is being send by OCPN and not really coming in on the port.

Is there a way to suppress this? If not, I guess I could just add code to my SendNMEAMessage() method that ignores ECBBM messages (which are assumed to be coming from OCPN rather than the AIS).

- thx
Ken
cryptik is offline   Reply With Quote
Old 14-09-2018, 09:52   #127
Registered User

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

Okay, ignore that last post. I can see why OCPN has to function that way. Sending a sentence from a plugin may need to be received and handled by another plugin, so it has to be broadcast. I gather the correct design assumes that each plug only processes the messages they are interested in and should then ignore all other messages in the SetNMEASentence() function.
cryptik is offline   Reply With Quote
Old 14-09-2018, 11:06   #128
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,745
Re: OpenCPN PlugIn Development

There is no setting to exclude your messages from what gets retransmitted to all the plugins - it's their responsibility to process only the messages they are interested in. In your case, simply ignore your own messages coming back.
nohal is offline   Reply With Quote
Old 08-11-2018, 16:27   #129
Registered User

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

Got a quick question. In most of the example plugins that I have looked at, the windows descend from wxDialog. Is it possible to use wxFrame for the main plugin window instead?

The reason I want to use wxFrame is that I need to have a wxWidgets status bar and I cant put a status bar on a wxDialog… at least not with wxFormBuilder.

- thx
ken
cryptik is offline   Reply With Quote
Old 08-11-2018, 21:11   #130
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,745
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by cryptik View Post
Got a quick question. In most of the example plugins that I have looked at, the windows descend from wxDialog. Is it possible to use wxFrame for the main plugin window instead?

The reason I want to use wxFrame is that I need to have a wxWidgets status bar and I cant put a status bar on a wxDialog… at least not with wxFormBuilder.

- thx
ken
yes, it is.
nohal is offline   Reply With Quote
Old 23-01-2019, 20:01   #131
Registered User

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

I have an OpenCPN plugin that I use to control a depth sounder that accepts proprietary NMEA-like strings. I need to configure the OCPN comms module to send out commands... which I have working... using PushNMEABuffer(). My use case requires that I turn on the transmit filters to limit output to just the proprietary command strings (so as to limit rebroadcast other standard NMEA strings). My problem is that the talker ID for the proprietary command strings that I have to support is 4 characters long. I need to modify the transmit filters to allow 4 character filters. The filters currently only support 2, 3, and 5 character lengths. Does anybody know if its feasible (via a simple code fix) to enable this in the filter code in the OCPN base? Any pointers on where to start looking?

Thx,
Ken
cryptik is offline   Reply With Quote
Old 23-01-2019, 20:36   #132
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,745
Re: OpenCPN PlugIn Development

https://github.com/OpenCPN/OpenCPN/b...ions.cpp#L9443 and https://github.com/OpenCPN/OpenCPN/b....cpp#L727-L741

Haven't seen this code for a long time so maybe I forgot some other place... Looking forward for a PR implementing this custom format.
nohal is offline   Reply With Quote
Old 23-01-2019, 21:14   #133
Registered User

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

Perfect, thanks Nohal. I also have a plugin that sends/receives binary broadcast messages to an AIS that I would like to package and add to the repository. However, I assume there is not a lot of demand for it since I don't think class B AISs support BBMs and I am not sure how many OCPN users are using class As... although, the price is coming down on these radios considerably. I will probably need some pointers, at some point, on how to submit a plugin and/or a PR. I have not done that sort of thing before with git. I am somewhat still old school with SVN...lol
cryptik is offline   Reply With Quote
Old 24-01-2019, 02:33   #134
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 3,186
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by cryptik View Post
Perfect, thanks Nohal. I also have a plugin that sends/receives binary broadcast messages to an AIS that I would like to package and add to the repository. However, I assume there is not a lot of demand for it since I don't think class B AISs support BBMs and I am not sure how many OCPN users are using class As... although, the price is coming down on these radios considerably. I will probably need some pointers, at some point, on how to submit a plugin and/or a PR. I have not done that sort of thing before with git. I am somewhat still old school with SVN...lol
What might be handy is an interface to edit the voyage related data of the Class A AIS from OpenCPN.
bcn is offline   Reply With Quote
Old 24-01-2019, 04:35   #135
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 383
Re: OpenCPN PlugIn Development

https://github.com/RooieDirk/AIS_VD_pi/tree/master
Quote:
Originally Posted by bcn View Post
What might be handy is an interface to edit the voyage related data of the Class A AIS from OpenCPN.
__________________

__________________
Navigation is know where you are and what to do to get where you want.
But also: Know where you don't want to be and what to do to don't get there.
rooiedirk 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 18:23.


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.