| 
														
															@@ -1,4 +1,4 @@ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-package parser 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+package log_temperature 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import ( 
														 | 
														
														 | 
														
															 import ( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	"bufio" 
														 | 
														
														 | 
														
															 	"bufio" 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -8,10 +8,14 @@ import ( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 ) 
														 | 
														
														 | 
														
															 ) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // JSONParser reads the json output 
														 | 
														
														 | 
														
															 // JSONParser reads the json output 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-type JSONParser struct { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+type jsonParser struct { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	Reader *bufio.Reader 
														 | 
														
														 | 
														
															 	Reader *bufio.Reader 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+func NewJsonParser(reader *bufio.Reader) Parser { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	return &jsonParser{Reader: reader} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // {"time" : "2018-04-13 23:04:50", "model" : "Acurite 606TX Sensor", "id" : -5, "battery" : "OK", "temperature_C" : 21.800} 
														 | 
														
														 | 
														
															 // {"time" : "2018-04-13 23:04:50", "model" : "Acurite 606TX Sensor", "id" : -5, "battery" : "OK", "temperature_C" : 21.800} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 type jsonPacket struct { 
														 | 
														
														 | 
														
															 type jsonPacket struct { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	Time          string 
														 | 
														
														 | 
														
															 	Time          string 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -22,7 +26,7 @@ type jsonPacket struct { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 // Measure returns the temperature. Null if it can't 
														 | 
														
														 | 
														
															 // Measure returns the temperature. Null if it can't 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-func (jp JSONParser) Measure() (*Measurement, error) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+func (jp jsonParser) Measure() (*Measurement, error) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	text, err := jp.Reader.ReadString('\n') 
														 | 
														
														 | 
														
															 	text, err := jp.Reader.ReadString('\n') 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	if err != nil { 
														 | 
														
														 | 
														
															 	if err != nil { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		return nil, err 
														 | 
														
														 | 
														
															 		return nil, err 
														 |