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

View File

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