move libraries out of internal
This commit is contained in:
parent
4340c610fd
commit
7c8d790865
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -20,3 +20,4 @@
|
||||||
# Go workspace file
|
# Go workspace file
|
||||||
go.work
|
go.work
|
||||||
|
|
||||||
|
.vscode/
|
||||||
|
|
|
@ -13,6 +13,7 @@ func Execute() {
|
||||||
Usage: "see everything",
|
Usage: "see everything",
|
||||||
Commands: []*cli.Command{
|
Commands: []*cli.Command{
|
||||||
serveCmd,
|
serveCmd,
|
||||||
|
xbeeCmd,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,9 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/kschamplin/gotelem/internal/can"
|
"github.com/kschamplin/gotelem/can"
|
||||||
"github.com/kschamplin/gotelem/internal/gotelem"
|
"github.com/kschamplin/gotelem/socketcan"
|
||||||
"github.com/kschamplin/gotelem/internal/socketcan"
|
"github.com/kschamplin/gotelem/xbee"
|
||||||
"github.com/kschamplin/gotelem/internal/xbee"
|
|
||||||
"github.com/tinylib/msgp/msgp"
|
"github.com/tinylib/msgp/msgp"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"go.bug.st/serial"
|
"go.bug.st/serial"
|
||||||
|
|
45
cmd/xbee.go
Normal file
45
cmd/xbee.go
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
// this file contains xbee utilities.
|
||||||
|
// we can do network discovery and netcat-like things.
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var xbeeCmd = &cli.Command{
|
||||||
|
Name: "xbee",
|
||||||
|
Aliases: []string{"x"},
|
||||||
|
Usage: "Utilities for XBee",
|
||||||
|
Description: `
|
||||||
|
Allows for testing and debugging XBee networks and devices.
|
||||||
|
The "device" parameter is not optional, and can be any of the following formats:
|
||||||
|
tcp://192.168.4.5:8430
|
||||||
|
COM1
|
||||||
|
/dev/ttyUSB0:115200
|
||||||
|
For serial devices (COM1 and /dev/ttyUSB0), you can specify the baud rate
|
||||||
|
using a ':'. If excluded the baud rate will default to 9600. Note that
|
||||||
|
if using the native USB of the XLR Pro, the baud rate setting has no effect.
|
||||||
|
|
||||||
|
TCP/UDP connections require a port.
|
||||||
|
`,
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "device",
|
||||||
|
Aliases: []string{"d"},
|
||||||
|
Usage: "The XBee to connect to",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Subcommands: []*cli.Command{
|
||||||
|
{
|
||||||
|
Name: "info",
|
||||||
|
Usage: "get information about an xbee device",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Name: "netcat",
|
||||||
|
Aliases: []string{"nc"},
|
||||||
|
ArgsUsage: "[addr]",
|
||||||
|
Usage: "send data from stdio over the xbee",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,11 +1,9 @@
|
||||||
package db
|
package db
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
|
||||||
"github.com/kschamplin/gotelem/internal/can"
|
"github.com/kschamplin/gotelem/internal/can"
|
||||||
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
// this file implements a CAN adapter for the sqlite db.
|
// this file implements a CAN adapter for the sqlite db.
|
||||||
|
@ -21,3 +19,5 @@ func (cdb *CanDB) Send(_ *can.Frame) error {
|
||||||
func (cdb *CanDB) Recv() (*can.Frame, error) {
|
func (cdb *CanDB) Recv() (*can.Frame, error) {
|
||||||
panic("not implemented") // TODO: Implement
|
panic("not implemented") // TODO: Implement
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewCanDB()
|
|
@ -236,5 +236,5 @@ func (sess *SerialSession) Close() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sess *SerialSession) DiscoverNodes() {
|
func (sess *SerialSession) DiscoverNodes() {
|
||||||
|
panic("TODO: implement")
|
||||||
}
|
}
|
Loading…
Reference in a new issue