Documentation ¶
Index ¶
- Variables
- func IsNotRegisteredError(err error) bool
- func IsPermanentError(err error) bool
- type CacophonyAPI
- func (api *CacophonyAPI) DeviceID() int
- func (api *CacophonyAPI) DeviceName() string
- func (api *CacophonyAPI) DownloadFile(fileResponse *FileResponse, filePath string) error
- func (api *CacophonyAPI) GetDeviceSettings() (map[string]interface{}, error)
- func (api *CacophonyAPI) GetFileDetails(fileID int) (*FileResponse, error)
- func (api *CacophonyAPI) GetSchedule() ([]byte, error)
- func (api *CacophonyAPI) GroupName() string
- func (api *CacophonyAPI) Heartbeat(nextHeartBeat time.Time) ([]byte, error)
- func (api *CacophonyAPI) Password() string
- func (api *CacophonyAPI) ReRegisterByAuthorized(newName, newGroup, newPassword, authToken string) error
- func (api *CacophonyAPI) ReportEvent(jsonDetails []byte, times []time.Time) error
- func (api *CacophonyAPI) Reregister(newName, newGroup, newPassword string) error
- func (api *CacophonyAPI) UpdateDeviceSettings(settings map[string]interface{}) (map[string]interface{}, error)
- func (api *CacophonyAPI) UploadVideo(r io.Reader, data map[string]interface{}) (int, error)
- type CacophonyDevice
- type Config
- type Dimensions
- type Error
- type FileDetails
- type FileInfo
- type FileResponse
- type Point
- type Region
- type Settings
- type Warp
Constants ¶
This section is empty.
Variables ¶
var Fs = afero.NewOsFs()
Functions ¶
func IsNotRegisteredError ¶
func IsPermanentError ¶
IsPermanentError examines the supplied error and returns true if it is permanent.
Types ¶
type CacophonyAPI ¶
type CacophonyAPI struct {
// contains filtered or unexported fields
}
func New ¶
func New() (*CacophonyAPI, error)
New will get an API from the config files and authenticate. Will return an error if the device has not been registered yet.
func Register ¶
func Register(devicename, password, group, apiURL string, saltId int) (*CacophonyAPI, error)
Register will check that there is not already device config files, will then register with the given parameters and then save them in new config files.
func (*CacophonyAPI) DeviceID ¶
func (api *CacophonyAPI) DeviceID() int
func (*CacophonyAPI) DeviceName ¶
func (api *CacophonyAPI) DeviceName() string
func (*CacophonyAPI) DownloadFile ¶
func (api *CacophonyAPI) DownloadFile(fileResponse *FileResponse, filePath string) error
DownloadFile specified by fileResponse and save it to filePath
func (*CacophonyAPI) GetDeviceSettings ¶ added in v1.1.0
func (api *CacophonyAPI) GetDeviceSettings() (map[string]interface{}, error)
func (*CacophonyAPI) GetFileDetails ¶
func (api *CacophonyAPI) GetFileDetails(fileID int) (*FileResponse, error)
GetFileDetails of the supplied fileID from the Cacophony API and return FileResponse info. This can then be parsed into DownloadFile to download the file
func (*CacophonyAPI) GetSchedule ¶
func (api *CacophonyAPI) GetSchedule() ([]byte, error)
GetSchedule will get the audio schedule
func (*CacophonyAPI) GroupName ¶
func (api *CacophonyAPI) GroupName() string
func (*CacophonyAPI) Heartbeat ¶ added in v1.0.1
func (api *CacophonyAPI) Heartbeat(nextHeartBeat time.Time) ([]byte, error)
Send heart beat from device with expected next heart beat time
func (*CacophonyAPI) Password ¶
func (api *CacophonyAPI) Password() string
func (*CacophonyAPI) ReRegisterByAuthorized ¶ added in v1.1.0
func (api *CacophonyAPI) ReRegisterByAuthorized(newName, newGroup, newPassword, authToken string) error
This allows the device to be registered even
func (*CacophonyAPI) ReportEvent ¶
func (api *CacophonyAPI) ReportEvent(jsonDetails []byte, times []time.Time) error
ReportEvent described by jsonDetails and timestamps to the Cacophony API
func (*CacophonyAPI) Reregister ¶
func (api *CacophonyAPI) Reregister(newName, newGroup, newPassword string) error
Reregister will register getting a new name and/or group
func (*CacophonyAPI) UpdateDeviceSettings ¶ added in v1.1.1
func (api *CacophonyAPI) UpdateDeviceSettings(settings map[string]interface{}) (map[string]interface{}, error)
UpdateDeviceSettings updates the device settings on the API and returns the updated settings
func (*CacophonyAPI) UploadVideo ¶ added in v1.0.3
UploadVideo uploads the file to Cacophony API as a multipartmessage
type CacophonyDevice ¶
type CacophonyDevice struct {
// contains filtered or unexported fields
}
type Config ¶
type Config struct { ServerURL string Group string DeviceName string DevicePassword string DeviceID int // contains filtered or unexported fields }
func (*Config) Registered ¶
type Dimensions ¶ added in v1.1.0
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is returned by API calling methods. As well as an error message, it includes whether the error is permanent or not.
type FileDetails ¶
type FileInfo ¶
type FileInfo struct { Details FileDetails Type string }