Version: v0.0.0-...-96f3fa0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2016 License: MIT Imports: 9 Imported by: 0



Package components contains the models for the database and the configuration for the application.



This section is empty.


This section is empty.


This section is empty.


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 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
	ToJSON() url.Values

MessageUplinkI is used to handle uplink messages more efficiently. It gives methods that help handling and displaying the message.

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  //
	SensorTypeID         int64  //
	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,
	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(
	sTypeID int64,
	DataType int,
	ConversionExpression string,
	SoftDeleted bool) Sensor

NewSensor is the Default constructor

func (*Sensor) SameSensor

func (s *Sensor) SameSensor(otherSensor Sensor) bool

SameSensor compares this sensor to the given sensor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL