communication with influxdb is working, schema of data in influxdb is unusable so far, too many spare columns
This commit is contained in:
25
attic/ttn/models/rawPayloadPrinter/rawPayloadPrinter.go
Normal file
25
attic/ttn/models/rawPayloadPrinter/rawPayloadPrinter.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package rawPayloadPrinter
|
||||
|
||||
import (
|
||||
"log"
|
||||
"fmt"
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"udi/database"
|
||||
)
|
||||
|
||||
|
||||
func Parse(fPort int, _ []byte, frmPayload string, variables *map[string]database.VariableType, _ *map[string]interface{}, _ *database.Device) error {
|
||||
if fPort != 2 {
|
||||
return fmt.Errorf("Unexpected fPort %d", fPort)
|
||||
}
|
||||
|
||||
bytes, err := base64.StdEncoding.DecodeString(frmPayload)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to base64-decode payload: %v", err)
|
||||
}
|
||||
hexString := hex.EncodeToString(bytes)
|
||||
|
||||
log.Printf("Payload: %s", hexString)
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user