Documentation
¶
Index ¶
Constants ¶
const RX_BYTE = "1"
Variables ¶
This section is empty.
Functions ¶
func PrettyPrintTimeSeriesData ¶
func PrettyPrintTimeSeriesData(tsd *SparkFunWeatherShieldTimeSeriesData)
Function used to print to the console the time series data.
Types ¶
type ArduinoReader ¶
type ArduinoReader struct {
// contains filtered or unexported fields
}
The abstraction of the `SparkFun Weather Shield` reader.
func NewArduinoReader ¶
func NewArduinoReader(devicePath string) *ArduinoReader
Constructor used to intialize the serial reader designed to communicate with Arduino configured for the `SparkFun Weather Shield` settings.
func (*ArduinoReader) GetSparkFunWeatherShieldData ¶
func (ar *ArduinoReader) GetSparkFunWeatherShieldData() *SparkFunWeatherShieldTimeSeriesData
Function returns the JSON data of the instrument readings from our Arduino device configured for the `SparkFun Weather Shield` settings.
type SerialReaderServer ¶
type SerialReaderServer struct {
// contains filtered or unexported fields
}
func New ¶
func New(arduinoDevicePath string, port int) *SerialReaderServer
func (*SerialReaderServer) RunMainRuntimeLoop ¶
func (s *SerialReaderServer) RunMainRuntimeLoop()
Function will consume the main runtime loop and run the business logic of the application.
func (*SerialReaderServer) StopMainRuntimeLoop ¶
func (s *SerialReaderServer) StopMainRuntimeLoop()
Function will tell the application to stop the main runtime loop when the process has been finished.
type SerialReaderServerImpl ¶
type SerialReaderServerImpl struct { pb.SerialReaderServer // contains filtered or unexported fields }
func (*SerialReaderServerImpl) GetSparkFunWeatherShieldData ¶
func (s *SerialReaderServerImpl) GetSparkFunWeatherShieldData(ctx context.Context, in *pb.GetTimeSeriesData) (*pb.SparkFunWeatherShieldTimeSeriesData, error)
type SparkFunWeatherShieldTimeSeriesData ¶
type SparkFunWeatherShieldTimeSeriesData struct { Status string `json:"status,omitempty"` Runtime int `json:"runtime,omitempty"` Id int `json:"id,omitempty"` HumidityValue float32 `json:"humidity_value,omitempty"` HumidityUnit string `json:"humidity_unit,omitempty"` TemperatureValue float32 `json:"temperature_primary_value,omitempty"` TemperatureUnit string `json:"temperature_primary_unit,omitempty"` PressureValue float32 `json:"pressure_value,omitempty"` PressureUnit string `json:"pressure_unit,omitempty"` TemperatureBackupValue float32 `json:"temperature_secondary_value,omitempty"` TemperatureBackupUnit string `json:"temperature_secondary_unit,omitempty"` AltitudeValue float32 `json:"altitude_value,omitempty"` AltitudeUnit string `json:"altitude_unit,omitempty"` IlluminanceValue float32 `json:"illuminance_value,omitempty"` IlluminanceUnit string `json:"illuminance_unit,omitempty"` Timestamp int64 `json:"timestamp,omitempty"` }
The time-series data structure used to store all the data that will be returned by the `SparkFun Weather Shield` Arduino device.
Please note that the value fields must be float32 as this was specified by the hardware manufacturar, if you use float64 you will get an error.