KPLEX filter syntax

20 views
Skip to first unread message

Steinar Solnørdal

unread,
Jun 28, 2020, 6:03:15 AM6/28/20
to kplex
Hello.
Being new at Kplex I have problems to understand the filter syntax. Please be patient with me.

My Configuration is:


[serial]
#NMEA
filename=/dev/ttyUSB0
baud=4800
direction=both

[serial]
#AIS
filename=/dev/ttyACM0
baud=38400
direction=in

[serial]
#GPS
filename=/dev/ttyUSB1
baud=4800
direction=in

[TCP]
#openCPN
mode=server
direction=both

With this setup all incoming data transmitted at the output of /dev/ttyUSB0 which is planned to connect to my autopilot.
The only NMEA sentence I want to transmit is RMB, coming from openCPN over TCP.

What should the filter look like??

regards Steinar Solnordal
S/Y FREYA 2

Keith Young

unread,
Jun 28, 2020, 8:35:36 AM6/28/20
to kplex
With this setup all incoming data transmitted at the output of /dev/ttyUSB0 which is planned to connect to my autopilot.
The only NMEA sentence I want to transmit is RMB, coming from openCPN over TCP.

What should the filter look like??

If you want to specify that only RMB sentences coming via your TCP connection are sent out of ttyUSB0, you need to give the TCP interface a name, ie:

[tcp]
#openCPN
mode=server
direction=both
name=ocpn

Then the filter which only transmits RMB coming into kplex from that interface is:
ofilter=+**RMB%ocpn:-all

...which should be added to your first serial interface like this:
[serial]
#NMEA
filename=/dev/ttyUSB0
baud=4800
direction=both
ofilter=+**RMB%ocpn:-all

However, unless you've got RMB sentences coming from other sources, you might want to save a few cycles and just use:
ofilter=+**RMB:-all

Do of course be careful about feedback loops between kplex and opencpn, ie if you have GPS and AIS going from kplex to opencpn, make sure your opencpn data connections don't send them back to kplex.  IIRC opencpn uses "EC" for its talker id when outputting autopilot data so if you only wanted to have double protection and only accept sentences into kplex over the tcp interface with an "EC" talker id you could add an input filter to the tcp interface:
ifilter=+EC***:-all

I don't personally have any experience of hooking up opencpn to an autopilot, but do you need the RMC, APB and XTE sentences opencpn puts out as well?  In which case the ofilter for your autopilot serial port might be:
ofilter=+EC***:-all
...to just send all the sentences with an EC talker id, or:
ofilter=+EC***%ocpn:-all
...to just send sentences from the interface named "ocpn" with talker id "EC", or:
ofilter=+ECRMB:+ECRMC:+ECAPB:+ECXTE:-all
...to be more explicit, or you could specify the input interface by appending %ocpn to those as above.

Hopes this helps.  Please feel free to ask for further clarification

Steinar Solnørdal

unread,
Jun 29, 2020, 3:38:45 AM6/29/20
to kplex
Thanks a lot Keith.
I think my autopilot is happy with RMB only. I somtimes use "Navigate to here" on openCPN.
Anyway, I think I have understood the syntax now.
Thanks again!
Reply all
Reply to author
Forward
0 new messages