Documentation
¶
Index ¶
- Constants
- func GetPasswordHash(pwd string) (string, error)
- func InfluxDbEscapeString(str string) string
- func NewLogger(log_format string, level string) (*logging.Logger, error)
- func PrimitiveToString(value interface{}) (string, error)
- type Auth
- type HttpClient
- type IHttpClient
- type IInfluxDb
- type IMqtt
- type IMysqlDb
- type InfluxDb
- type Mqtt
- func (t *Mqtt) Connect(subscribe bool) error
- func (t *Mqtt) Disconnect() error
- func (t *Mqtt) GetThingTopic(thing *model.Thing, topic string) (string, error)
- func (t *Mqtt) ProcessDevices(org *model.Org, topic, payload string)
- func (t *Mqtt) ProcessMessage(topic, payload string)
- func (t *Mqtt) ProcessSensors(org *model.Org, topic, payload string)
- func (t *Mqtt) ProcessSwitches(org *model.Org, topic, payload string)
- func (t *Mqtt) PushThingData(thing *model.Thing, topic, value string) error
- func (t *Mqtt) SetClient(id string)
- func (t *Mqtt) SetPassword(password string)
- func (t *Mqtt) SetUsername(username string)
- type MysqlDb
- type Orgs
- type PiotDevices
- type RowMetric
- type Things
- func (t *Things) Find(name string) (*model.Thing, error)
- func (t *Things) FindPiot(id string) (*model.Thing, error)
- func (t *Things) Get(id primitive.ObjectID) (*model.Thing, error)
- func (t *Things) GetFiltered(filter interface{}) ([]*model.Thing, error)
- func (t *Things) RegisterPiot(id string, deviceType string) (*model.Thing, error)
- func (t *Things) SetAvailabilityTopic(id primitive.ObjectID, topic string) error
- func (t *Things) SetAvailabilityYesNo(id primitive.ObjectID, yes, no string) error
- func (t *Things) SetLocation(id primitive.ObjectID, lat, lng float64, sat, ts int32) error
- func (t *Things) SetLocationMqttTopic(id primitive.ObjectID, topic string) error
- func (t *Things) SetLocationMqttValues(id primitive.ObjectID, lat, lng, sat, ts string) error
- func (t *Things) SetParent(id primitive.ObjectID, id_parent primitive.ObjectID) error
- func (t *Things) SetSensorClass(id primitive.ObjectID, class string) error
- func (t *Things) SetSensorMeasurementTopic(id primitive.ObjectID, topic string) error
- func (t *Things) SetSensorValue(id primitive.ObjectID, value string) error
- func (t *Things) SetSwitchState(id primitive.ObjectID, value bool) error
- func (t *Things) SetTelemetry(id primitive.ObjectID, telemetry string) error
- func (t *Things) TouchThing(id primitive.ObjectID) error
- type Users
Constants ¶
View Source
const PIOT_MEASUREMENT_TOPIC = "value"
topic name used for publishing sensor readings
View Source
const TOPIC_AVAILABLE = "available"
View Source
const TOPIC_HUMIDITY = "humidity"
View Source
const TOPIC_IP = "net/ip"
View Source
const TOPIC_NET = "net"
View Source
const TOPIC_PRESSURE = "pressure"
View Source
const TOPIC_ROOT = "org"
View Source
const TOPIC_TEMP = "temperature"
View Source
const TOPIC_UNIT = "unit"
View Source
const TOPIC_WIFI_SSID = "net/wifi/ssid"
View Source
const TOPIC_WIFI_STRENGTH = "net/wifi/strength"
View Source
const VALUE_NO = "no"
View Source
const VALUE_YES = "yes"
Variables ¶
This section is empty.
Functions ¶
func GetPasswordHash ¶
func InfluxDbEscapeString ¶ added in v1.0.2
func NewLogger ¶
NewLogger creates instance of logger that should be used in all server handlers and routines. The idea is to have unified style of logging - logger is configured only once and at one place
func PrimitiveToString ¶ added in v1.0.2
Types ¶
type HttpClient ¶
type HttpClient struct {
// contains filtered or unexported fields
}
func (*HttpClient) PostString ¶
func (c *HttpClient) PostString(url, body string, username *string, password *string)
type IHttpClient ¶
type IHttpClient interface { //PostMeasurement(ctx context.Context, thing *model.Thing, value string) PostString(url, body string, username *string, password *string) }
func NewHttpClient ¶
func NewHttpClient(log *logging.Logger) IHttpClient
type IInfluxDb ¶
type IInfluxDb interface { PostMeasurement(thing *model.Thing, value string) PostSwitchState(thing *model.Thing, value string) PostLocation(thing *model.Thing, lat, lng float64, sat, ts int32) }
func NewInfluxDb ¶
func NewInfluxDb(log *logging.Logger, orgs *Orgs, httpClient IHttpClient, uri, username, password string) IInfluxDb
type IMqtt ¶
type IMysqlDb ¶
type IMysqlDb interface { Open() error Close() StoreMeasurement(thing *model.Thing, value string) StoreSwitchState(thing *model.Thing, value string) }
func NewMysqlDb ¶
type InfluxDb ¶
type InfluxDb struct { Uri string Username string Password string // contains filtered or unexported fields }
func (*InfluxDb) PostLocation ¶ added in v1.0.2
func (*InfluxDb) PostMeasurement ¶
type Mqtt ¶
type Mqtt struct { Uri string Username *string Password *string Client *string // contains filtered or unexported fields }
func (*Mqtt) Disconnect ¶
func (*Mqtt) GetThingTopic ¶
func (*Mqtt) ProcessMessage ¶
Process message received from MQTT broker for org subscription
func (*Mqtt) ProcessSwitches ¶
func (*Mqtt) PushThingData ¶
func (*Mqtt) SetPassword ¶
func (*Mqtt) SetUsername ¶
type MysqlDb ¶
type MysqlDb struct { Host string Username string Password string Name string Db *sql.DB // contains filtered or unexported fields }
func (*MysqlDb) StoreMeasurement ¶
type PiotDevices ¶
type PiotDevices struct {
// contains filtered or unexported fields
}
func NewPiotDevices ¶
func NewPiotDevices(logger *logging.Logger, things *Things, mqtt IMqtt, params *config.Parameters) *PiotDevices
constructor
func (*PiotDevices) ProcessPacket ¶
func (p *PiotDevices) ProcessPacket(packet model.PiotDevicePacket) error
type RowMetric ¶ added in v1.0.2
type RowMetric struct {
// contains filtered or unexported fields
}
func NewRowMetric ¶ added in v1.0.2
type Things ¶
func (*Things) GetFiltered ¶
func (*Things) RegisterPiot ¶
func (*Things) SetAvailabilityTopic ¶
func (*Things) SetAvailabilityYesNo ¶
func (*Things) SetLocation ¶
func (*Things) SetLocationMqttTopic ¶ added in v1.0.4
func (*Things) SetLocationMqttValues ¶ added in v1.0.4
func (*Things) SetSensorClass ¶
func (*Things) SetSensorMeasurementTopic ¶
func (*Things) SetSensorValue ¶
func (*Things) SetSwitchState ¶
func (*Things) SetTelemetry ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.