Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrDeviceActivationSecretIncorrect = errors.New("device activation_secret is incorrect")
)
Functions ¶
This section is empty.
Types ¶
type Device ¶
type Device struct { ID uint `json:"id"` Name string `json:"name"` DeviceType devicetype.DeviceType `json:"device_type"` BuildingID uint `json:"building_id"` ActivationSecret string `json:"activation_secret,omitempty"` // This can be removed if a device uses JWT's too. ActivationSecretHash string `json:"-"` // This can be removed if a device uses JWT's too. ActivatedAt *time.Time `json:"activated_at"` AuthorizationToken string `json:"authorization_token,omitempty"` Uploads []upload.Upload `json:"uploads,omitempty"` LatestUpload *time.Time `json:"latest_upload"` }
A Device is collects measurements in a subject's building.
func MakeDevice ¶
func MakeDevice(name string, deviceType devicetype.DeviceType, buildingID uint, activationSecret string) Device
Create a new Device.
type DeviceRepository ¶
type DeviceRepository interface { Find(device Device) (Device, error) FindCloudFeedAuthCreationTimeFromDeviceID(deviceID uint) (*time.Time, error) GetProperties(device Device) ([]property.Property, error) GetMeasurements(device Device, filters map[string]string) ([]measurement.Measurement, error) GetAll() ([]Device, error) Create(Device) (Device, error) Update(Device) (Device, error) Delete(Device) error }
A DeviceRepository can load, store and delete devices.
Click to show internal directories.
Click to hide internal directories.