forked from brutella/hkcam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
assets.go
33 lines (25 loc) · 790 Bytes
/
assets.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package hkcam
import (
"github.com/brutella/hc/characteristic"
)
// TypeAssets is the uuid of the Assets characteristic
const TypeAssets = "ACD9DFE7-948D-43D0-A205-D2F6F368541D"
// Assets contains a list of assets encoded as JSON.
// A valid JSON looks like this. `{"assets":[{"id":"1.jpg", "date":"2019-04-01T10:00:00+00:00"}]}`
// Writing to this characteristic is discouraged.
type Assets struct {
*characteristic.Bytes
}
func NewAssets() *Assets {
b := characteristic.NewBytes(TypeAssets)
b.Perms = []string{characteristic.PermRead, characteristic.PermEvents}
b.Value = []byte{}
return &Assets{b}
}
type AssetsMetadataResponse struct {
Assets []CameraAssetMetadata `json:"assets"`
}
type CameraAssetMetadata struct {
ID string `json:"id"`
Date string `json:"date"`
}