Documentation ¶
Overview ¶
Package components contains the models for the database and the configuration for the application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type Configuration struct { Mqtt struct { AppEUI string `yaml:"AppEUI"` Password string `yaml:"Password"` Address string `yaml:"Address"` } Db struct { User string `yaml:"User"` Password string `yaml:"Password"` Name string `yaml:"Name"` Network string `yaml:"Network"` Port int `yaml:"Port"` NumberOfWorkers int `yaml:"NumberOfWorkers"` } Rest struct { IP string `yaml:"Ip"` APIKey string `yaml:"ApiKey"` } }
Configuration is the Struct that will contain the values that are read from config.yaml file in the root path of the github repository.
func GetConfiguration ¶
func GetConfiguration() Configuration
GetConfiguration reads the configuration from the standard path if ReloadConfig has not been run beforehand. If ReloadConfig has been run beforehand it will not set it to the standard path.
func ReloadConfig ¶
func ReloadConfig(path string) Configuration
ReloadConfig reloads the config with a custom path. Calling GetConfiguration afterwards will allow the user to get the configuration file from the newly set path.
type MessageDownLink ¶
type MessageDownLink struct { ID int64 `json:"id"` Deveui string `json:"deveui"` Payload string `json:"payload"` Time time.Time `json:"time"` }
MessageDownLink is used for Downlink messages and is created by the webserver via restful JSON.
type MessageUplinkI ¶
type MessageUplinkI interface { AddPayload(p []byte, s Sensor) AddPayloadString(str string, s Sensor) GetPayloads() []messagePayloadI GetID() int64 GetDevEUI() string RemovePayloads() ToJSON() url.Values }
MessageUplinkI is used to handle uplink messages more efficiently. It gives methods that help handling and displaying the message.
func NewMessageUplink ¶
func NewMessageUplink(id int64, devEUI string) MessageUplinkI
NewMessageUplink is the constructor for the MessageUplinkI interface.
type Messages ¶
type Messages []MessageDownLink
Messages is a Slice of messages of type MessageDownLink, is used to bundle Downlink Messages in webserver.
type Sensor ¶
type Sensor struct { ID int64 //sensor.id SensorTypeID int64 //sensortype.id IoAddress int // IoType int // SensorType int //Not the ID but the actual sensortype number NumberOfValues int //lenght of bytes that belong to this sensor (between 1 and 8) LenghtOfValues int //number of values that belong to this sensor (1,2,4 or 8) HeaderOrder int //index in which the messages are send that belong to this sensor Description string //NotNeeded - user input ConversionExpression string //math expression that transforms the message DataType int // or int or string, or anything that shows what type of data this sensor is returning SoftDeleted bool //true if the sensor is deleted }
Sensor is a model that contains data from 2 tables in the database: sensors and sensortype.
func NewHeaderSensor ¶
func NewHeaderSensor( id int64, NumberOfValues, LenghtOfValues, HeaderOrder, DataType int, ConversionExpression string) Sensor
NewHeaderSensor will return a sensor object with default values for fields that are not needed durring proccesing
func NewSensor ¶
func NewSensor( id, sTypeID int64, ioAddress, iotype, SensorType, NumberOfValues, LenghtOfValues, HeaderOrder, DataType int, description, ConversionExpression string, SoftDeleted bool) Sensor
NewSensor is the Default constructor
func (*Sensor) SameSensor ¶
SameSensor compares this sensor to the given sensor.