Skip to content

Commit

Permalink
add --print flag
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Apr 24, 2019
1 parent 7903781 commit c56818e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ Flags:
--help Show context-sensitive help (also try
--help-long and --help-man).
--version print mavp2p version
-q, --quiet suppress info messages during
execution
--print-errors print parse errors on screen
-q, --quiet suppress info messages
--print print routed frames
--print-errors print parse errors
--hb-disable disable heartbeats
--hb-version=1 set mavlink version of heartbeats
--hb-systemid=125 set system id of heartbeats. it is
Expand Down
11 changes: 9 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ func main() {

version := kingpin.Flag("version", "print mavp2p version").Bool()

quiet := kingpin.Flag("quiet", "suppress info messages during execution").Short('q').Bool()
printErrors := kingpin.Flag("print-errors", "print parse errors on screen").Bool()
quiet := kingpin.Flag("quiet", "suppress info messages").Short('q').Bool()
print := kingpin.Flag("print", "print routed frames").Bool()
printErrors := kingpin.Flag("print-errors", "print parse errors").Bool()

hbDisable := kingpin.Flag("hb-disable", "disable heartbeats").Bool()
hbVersion := kingpin.Flag("hb-version", "set mavlink version of heartbeats").Default("1").Enum("1", "2")
Expand Down Expand Up @@ -239,6 +240,12 @@ func main() {
log.Printf("channel closed: %s", evt.Channel)

case *gomavlib.EventFrame:
// print
if *print == true {
fmt.Printf("V=%T, %+v, ID=%d, %+v", evt.Frame, evt.Frame,
evt.Message().GetId(), evt.Message())
}

// build remoteNode
rnode := remoteNode{
Channel: evt.Channel,
Expand Down

0 comments on commit c56818e

Please sign in to comment.