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: 47
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: chesapeake bay
Boat: bristol 27
Posts: 3,362
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: 47
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,615
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: 47
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: 47
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: 47
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,615
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: 47
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,615
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
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:30.


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.