move libraries out of internal

This commit is contained in:
saji 2023-05-04 19:15:03 -05:00
parent 4340c610fd
commit 7c8d790865
24 changed files with 54 additions and 8 deletions

1
.gitignore vendored
View file

@ -20,3 +20,4 @@
# Go workspace file
go.work
.vscode/

View file

@ -13,6 +13,7 @@ func Execute() {
Usage: "see everything",
Commands: []*cli.Command{
serveCmd,
xbeeCmd,
},
}

View file

@ -5,10 +5,9 @@ import (
"net"
"time"
"github.com/kschamplin/gotelem/internal/can"
"github.com/kschamplin/gotelem/internal/gotelem"
"github.com/kschamplin/gotelem/internal/socketcan"
"github.com/kschamplin/gotelem/internal/xbee"
"github.com/kschamplin/gotelem/can"
"github.com/kschamplin/gotelem/socketcan"
"github.com/kschamplin/gotelem/xbee"
"github.com/tinylib/msgp/msgp"
"github.com/urfave/cli/v2"
"go.bug.st/serial"

45
cmd/xbee.go Normal file
View 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",
},
},
}

View file

@ -1,11 +1,9 @@
package db
import (
"database/sql"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
"github.com/kschamplin/gotelem/internal/can"
_ "github.com/mattn/go-sqlite3"
)
// 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) {
panic("not implemented") // TODO: Implement
}
func NewCanDB()

View file

@ -236,5 +236,5 @@ func (sess *SerialSession) Close() error {
}
func (sess *SerialSession) DiscoverNodes() {
panic("TODO: implement")
}