NMEA pass-through mode
This commit is contained in:
42
main.go
42
main.go
@@ -29,15 +29,16 @@ const (
|
||||
)
|
||||
|
||||
type TCPServer struct {
|
||||
Protocol chan string
|
||||
ToPactor *ByteFIFO
|
||||
FromPactor *ByteFIFO
|
||||
VARAMode bool
|
||||
DaemonMode bool
|
||||
GPSdMode bool
|
||||
DeviceType string
|
||||
Status uint8
|
||||
Command struct {
|
||||
Protocol chan string
|
||||
ToPactor *ByteFIFO
|
||||
FromPactor *ByteFIFO
|
||||
VARAMode bool
|
||||
DaemonMode bool
|
||||
GPSdMode bool
|
||||
NMEAPassthrough bool
|
||||
DeviceType string
|
||||
Status uint8
|
||||
Command struct {
|
||||
Cmd *StringFIFO
|
||||
Response *StringFIFO
|
||||
}
|
||||
@@ -48,16 +49,17 @@ type TCPServer struct {
|
||||
GPSStream *StringFIFO // NMEA steam from PTC to gpsd server, see gpsd.go
|
||||
}
|
||||
|
||||
func NewTCPServer(varamode bool, daemonmode bool, gpsdmode bool) *TCPServer {
|
||||
func NewTCPServer(varamode bool, daemonmode bool, gpsdmode bool, nmeapassthrough bool) *TCPServer {
|
||||
return &TCPServer{
|
||||
Protocol: make(chan string, 1024),
|
||||
ToPactor: NewByteFIFO(1024),
|
||||
FromPactor: NewByteFIFO(1024),
|
||||
VARAMode: varamode,
|
||||
DaemonMode: daemonmode,
|
||||
GPSdMode: gpsdmode,
|
||||
DeviceType: "",
|
||||
Status: 0,
|
||||
Protocol: make(chan string, 1024),
|
||||
ToPactor: NewByteFIFO(1024),
|
||||
FromPactor: NewByteFIFO(1024),
|
||||
VARAMode: varamode,
|
||||
DaemonMode: daemonmode,
|
||||
GPSdMode: gpsdmode,
|
||||
NMEAPassthrough: nmeapassthrough,
|
||||
DeviceType: "",
|
||||
Status: 0,
|
||||
Command: struct {
|
||||
Cmd *StringFIFO
|
||||
Response *StringFIFO
|
||||
@@ -77,6 +79,7 @@ type Userconfig struct {
|
||||
ServerAddress string `yaml:"server_address"`
|
||||
DataAddress string `yaml:"data_address"`
|
||||
GPSdAddress string `yaml:"gpsd_address"`
|
||||
NMEAPassthrough bool `yaml:"nmeapassthrough"`
|
||||
CmdLineInit string `yaml:"cmdline_init"`
|
||||
StartwithVaraMode bool `yaml:"vara_mode"`
|
||||
}
|
||||
@@ -94,6 +97,7 @@ func configmanage(Config *Userconfig, path string) error {
|
||||
ServerAddress: "127.0.0.1:8300",
|
||||
DataAddress: "127.0.0.1:8301",
|
||||
GPSdAddress: "",
|
||||
NMEAPassthrough: false,
|
||||
CmdLineInit: "",
|
||||
StartwithVaraMode: false}
|
||||
|
||||
@@ -158,7 +162,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
s = NewTCPServer(Config.StartwithVaraMode, daemonMode, Config.GPSdAddress != "")
|
||||
s = NewTCPServer(Config.StartwithVaraMode, daemonMode, Config.GPSdAddress != "", Config.NMEAPassthrough)
|
||||
fmt.Println("Initializing PACTOR modem, please wait...")
|
||||
m, err := OpenModem(Config.Device, Config.Baudrate, Config.Mycall, "", Config.CmdLineInit)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user