revid: improved naming of encoder globals for location and timestamp

This commit is contained in:
saxon 2018-12-14 15:59:44 +10:30
parent dc6964d41c
commit f1ee09ad7b
2 changed files with 8 additions and 10 deletions

View File

@ -148,14 +148,12 @@ func (s *httpSender) send() error {
var reply string var reply string
if send { if send {
reply, _, err = s.client.Send(netsender.RequestRecv, pins) reply, _, err = s.client.Send(netsender.RequestRecv, pins)
}
err = extractMeta(reply, s)
if err != nil { if err != nil {
return err return err
} }
}
return err return extractMeta(reply, s)
} }
func extractMeta(r string, s *httpSender) error { func extractMeta(r string, s *httpSender) error {
@ -169,7 +167,7 @@ func extractMeta(r string, s *httpSender) error {
s.log(smartlogger.Warning, pkg+"No timestamp in reply") s.log(smartlogger.Warning, pkg+"No timestamp in reply")
} else { } else {
s.log(smartlogger.Debug, fmt.Sprintf("%v got timestamp: %v", pkg, t)) s.log(smartlogger.Debug, fmt.Sprintf("%v got timestamp: %v", pkg, t))
mts.TimeMeta(uint64(t)) mts.SetTimeStamp(uint64(t))
} }
// Extract gps from reply // Extract gps from reply
@ -178,7 +176,7 @@ func extractMeta(r string, s *httpSender) error {
s.log(smartlogger.Warning, pkg+"No gps in reply") s.log(smartlogger.Warning, pkg+"No gps in reply")
} else { } else {
s.log(smartlogger.Debug, fmt.Sprintf("%v got gps: %v", pkg, g)) s.log(smartlogger.Debug, fmt.Sprintf("%v got gps: %v", pkg, g))
mts.GpsMeta(g) mts.SetLocation(g)
} }
return nil return nil

View File

@ -53,11 +53,11 @@ type MetaData struct {
var metaData = MetaData{time: 0, gps: ""} var metaData = MetaData{time: 0, gps: ""}
func TimeMeta(t uint64) { func SetTimeStamp(t uint64) {
metaData.time = t metaData.time = t
} }
func GpsMeta(g string) { func SetLocation(g string) {
metaData.gps = g metaData.gps = g
} }