-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error parsing encapsulated message #22
Comments
Did a little more digging and it looks like logMsg.Type doesn't have a value. index fef931d..8694029 100644
--- a/main.go
+++ b/main.go
@@ -390,12 +390,17 @@ func main() {
msg = new(IDM)
case "R900", "R900BCD":
msg = new(R900)
+ default:
+ log.Printf("logMsg.Type not set. %+v\n", logMsg)
}
// Parse the encapsulated message.
err = json.Unmarshal(logMsg.Message, msg)
if err != nil {
log.Println(errors.Wrap(err, "json unmarshal"))
+ log.Printf("logMsg: %+v\n", logMsg)
+ log.Printf("logMsg.Message: %v\n", string(logMsg.Message))
+ log.Printf("msg: %T %+v\n", msg, msg)
continue
}
The output is then: $ rtlamr | tee /dev/pts/1 | rtlamr-collect
11:44:18.240748 flags.go:111: Environment variable "RTLAMR_FORMAT" overrides flag "format" with "json"
11:44:18.241134 decode.go:45: CenterFreq: 912600155
11:44:18.241148 decode.go:46: SampleRate: 2359296
11:44:18.241153 decode.go:47: DataRate: 32768
11:44:18.241157 decode.go:48: ChipLength: 72
11:44:18.241161 decode.go:49: PreambleSymbols: 21
11:44:18.241167 decode.go:50: PreambleLength: 3024
11:44:18.241172 decode.go:51: PacketSymbols: 96
11:44:18.241176 decode.go:52: PacketLength: 13824
11:44:18.241180 decode.go:59: Protocols: scm
11:44:18.241186 decode.go:60: Preambles: 111110010101001100000
11:44:18.241192 main.go:111: GainCount: 29
11:44:18.242200 main.go:353: connecting to "rtluser"@"http://localhost:8086/"
{"Time":"2019-08-19T11:44:34.307117087-04:00","Offset":0,"Length":0,"Message":{"ID":6581xxxx,"Type":12,"TamperPhy":3,"TamperEnc":0,"Consumption":185077,"ChecksumVal":53xxx}}
11:44:34.308239 main.go:394: logMsg.Type not set. {Time:2019-08-19 11:44:34.307117087 -0400 EDT Type:}
11:44:34.308312 main.go:400: json unmarshal: json: Unmarshal(nil)
11:44:34.308332 main.go:401: logMsg: {Time:2019-08-19 11:44:34.307117087 -0400 EDT Type:}
11:44:34.308358 main.go:402: logMsg.Message: {"ID":6581xxxx,"Type":12,"TamperPhy":3,"TamperEnc":0,"Consumption":185077,"ChecksumVal":53xxx}
11:44:34.308371 main.go:403: msg: <nil> <nil> |
Ah yeah, you're using incompatible versions of rtlamr and rtlamr-collect. The lastest flavor of rtlamr-collect expects there to be a "Type" field in each message and the latest version of rtlamr provides that field, but I've not yet made a tagged release including those changes. The release of go modules has been somewhat turbulent for this project. Try: go get -v github.com/bemasher/rtlamr@latest
go get -v github.com/bemasher/rtlamr-collect@latest |
I just collected the latest versions using
And received an infinite stream of
However, getting them normally seemed to work fine:
|
Turns out |
When using rtlamr and rtlamr-collect, I get the following JSON unmarshaling error for any output from rtlamr. I redacted the ID and CHECKSUM in the output and also
tee
'd the pipe to see what exactly rtlamr-collect was receiving (though I get the same errors with or without tee).To get a bit more info, I also made this patch to print out a bit more info:
That produced the following output:
Let me know if there is any other info that would help
The text was updated successfully, but these errors were encountered: