fix: update dependancies

This commit is contained in:
Markus Pesch 2018-12-07 23:04:56 +01:00
parent 500d1a5823
commit 60fa83244e
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982
3 changed files with 12 additions and 148 deletions

4
Gopkg.lock generated
View File

@ -3,11 +3,11 @@
[[projects]]
branch = "master"
digest = "1:36cccfe52f1b5332dd9374abca00bdb31b99a757c15b8a2b103f3f7b4541816b"
digest = "1:4821a07614f34a7cd1e84604dc43e26dcaf63a9e943373786987cc0e6397bbb2"
name = "git.cryptic.systems/fh-trier/go-flucky-server"
packages = ["pkg/types"]
pruneopts = "UT"
revision = "3ce11606f75951619536ec3e3e501bc31dc53dd7"
revision = "899da985091daddedd2f6500b2facfa97e03e860"
[[projects]]
branch = "master"

View File

@ -1,12 +1,19 @@
package types
import (
"encoding/json"
"fmt"
"io"
"time"
)
// Checkpoint ...
type Checkpoint struct {
CheckpointID string `json:"checkpoint_id"`
CheckpointDate time.Time `json:"checkpoint_date,string"`
RFID string `json:"rfid"`
ProductID string `json:"product_id"`
SensorID string `json:"sensor_id"`
CreationDate time.Time `json:"creation_date"`
}
// Device ...
type Device struct {
DeviceID string `json:"device_id"`
@ -16,26 +23,6 @@ type Device struct {
CreationDate time.Time `json:"creation_date"`
}
// EncodeToJSON needs a writer to write the struct into json string
func (d *Device) EncodeToJSON(w io.Writer) error {
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err := encoder.Encode(&d)
if err != nil {
return fmt.Errorf("Error in encoding struct to json: %v", err)
}
return nil
}
// DecodeFromJSON decode a json string from a reader into a struct
func (d *Device) DecodeFromJSON(r io.Reader) error {
decoder := json.NewDecoder(r)
if err := decoder.Decode(&d); err != nil {
return fmt.Errorf("Can not unmarshal JSON: %v", err)
}
return nil
}
// Failnoise ...
type Failnoise struct {
FailnoiseID string `json:"failnoise_id"`
@ -46,26 +33,6 @@ type Failnoise struct {
CreationDate time.Time `json:"creation_date"`
}
// EncodeToJSON needs a writer to write the struct into json string
func (f *Failnoise) EncodeToJSON(w io.Writer) error {
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err := encoder.Encode(&f)
if err != nil {
return fmt.Errorf("Error in encoding struct to json: %v", err)
}
return nil
}
// DecodeFromJSON decode a json string from a reader into a struct
func (f *Failnoise) DecodeFromJSON(r io.Reader) error {
decoder := json.NewDecoder(r)
if err := decoder.Decode(&f); err != nil {
return fmt.Errorf("Can not unmarshal JSON: %v", err)
}
return nil
}
// Humidity ...
type Humidity struct {
HumidityID string `json:"humidity_id"`
@ -75,26 +42,6 @@ type Humidity struct {
CreationDate time.Time `json:"creation_date"`
}
// EncodeToJSON needs a writer to write the struct into json string
func (h *Humidity) EncodeToJSON(w io.Writer) error {
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err := encoder.Encode(&h)
if err != nil {
return fmt.Errorf("Error in encoding struct to json: %v", err)
}
return nil
}
// DecodeFromJSON decode a json string from a reader into a struct
func (h *Humidity) DecodeFromJSON(r io.Reader) error {
decoder := json.NewDecoder(r)
if err := decoder.Decode(&h); err != nil {
return fmt.Errorf("Can not unmarshal JSON: %v", err)
}
return nil
}
// Knock ...
type Knock struct {
KnockID string `json:"knock_id"`
@ -105,26 +52,6 @@ type Knock struct {
CreationDate time.Time `json:"creation_date"`
}
// EncodeToJSON needs a writer to write the struct into json string
func (k *Knock) EncodeToJSON(w io.Writer) error {
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err := encoder.Encode(&k)
if err != nil {
return fmt.Errorf("Error in encoding struct to json: %v", err)
}
return nil
}
// DecodeFromJSON decode a json string from a reader into a struct
func (k *Knock) DecodeFromJSON(r io.Reader) error {
decoder := json.NewDecoder(r)
if err := decoder.Decode(&k); err != nil {
return fmt.Errorf("Can not unmarshal JSON: %v", err)
}
return nil
}
// Sensor ...
type Sensor struct {
SensorID string `json:"sensor_id"`
@ -139,26 +66,6 @@ type Sensor struct {
CreationDate time.Time `json:"creation_date"`
}
// EncodeToJSON needs a writer to write the struct into json string
func (s *Sensor) EncodeToJSON(w io.Writer) error {
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err := encoder.Encode(&s)
if err != nil {
return fmt.Errorf("Error in encoding struct to json: %v", err)
}
return nil
}
// DecodeFromJSON decode a json string from a reader into a struct
func (s *Sensor) DecodeFromJSON(r io.Reader) error {
decoder := json.NewDecoder(r)
if err := decoder.Decode(&s); err != nil {
return fmt.Errorf("Can not unmarshal JSON: %v", err)
}
return nil
}
// ReadableSensorName returns a readable sensor name
func (s *Sensor) ReadableSensorName() string {
if s.SensorName != nil {
@ -179,26 +86,6 @@ type Temperature struct {
CreationDate time.Time `json:"creation_date"`
}
// EncodeToJSON needs a writer to write the struct into json string
func (t *Temperature) EncodeToJSON(w io.Writer) error {
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err := encoder.Encode(&t)
if err != nil {
return fmt.Errorf("Error in encoding struct to json: %v", err)
}
return nil
}
// DecodeFromJSON decode a json string from a reader into a struct
func (t *Temperature) DecodeFromJSON(r io.Reader) error {
decoder := json.NewDecoder(r)
if err := decoder.Decode(&t); err != nil {
return fmt.Errorf("Can not unmarshal JSON: %v", err)
}
return nil
}
// Throughput ...
type Throughput struct {
ThroughputID string `json:"throughput_id"`
@ -208,23 +95,3 @@ type Throughput struct {
SensorID string `json:"sensor_id"`
CreationDate time.Time `json:"creation_date"`
}
// EncodeToJSON needs a writer to write the struct into json string
func (t *Throughput) EncodeToJSON(w io.Writer) error {
encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err := encoder.Encode(&t)
if err != nil {
return fmt.Errorf("Error in encoding struct to json: %v", err)
}
return nil
}
// DecodeFromJSON decode a json string from a reader into a struct
func (t *Throughput) DecodeFromJSON(r io.Reader) error {
decoder := json.NewDecoder(r)
if err := decoder.Decode(&t); err != nil {
return fmt.Errorf("Can not unmarshal JSON: %v", err)
}
return nil
}

View File

@ -4,7 +4,6 @@ package dht
import (
"fmt"
"log"
"runtime/debug"
"strings"
"time"
@ -93,8 +92,6 @@ func (dht *DHT) readBits() ([]int, error) {
// enable garbage collection, done with critical part
debug.SetGCPercent(gcPercent)
log.Printf("%v\n", levels)
// set pin to high so ready for next time
err = dht.pin.Out(gpio.High)
if err != nil {