//getCacheReadings grabs the readings and returns a map[string]string func getCacheReadings(c *sensorCache.Cache) map[string]string { m := make(map[string]string) for k, v := range c.Values() { if _, OK := v.(string); OK { m[k] = v.(string) } } return m }
//cacheReadings catch readings from subscribed channels and cache func cacheReadings(c *sensorCache.Cache, s *mqttservices.MqttClient) { defer wg.Done() chIn := subscribeSensors(&config, s) for m := range chIn { c.Insert(addressParameter[m.TopicName], fmt.Sprintf("%s", m.Payload)) } log.Println("wuMQTTAgregate: MQTT broker connection closed") c.StopMonitoring() close(done) }