Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // WorkingDir is the current working directory of the project. WorkingDir string // ConfigPath is the configuration file name. ConfigPath = "clientcfg.toml" // Config is the configuration loaded from file. Config Configuration )
var LoadedClients []Client
LoadedClients is a list of all Clients, which includes their state, config, etc.
Functions ¶
func Connect ¶
func Connect()
Connect attempts to load all clients defined in the configuration file, and refreshes the state.
func LoadConfig ¶
func LoadConfig()
LoadConfig loads the configuration file from disk. It will also generate one if it doesn't exist.
func SetupCron ¶
func SetupCron() error
SetupCron sets up a timer that refreshes the clients states at a configured interval.
func StartRecording ¶
func StartRecording() error
StartRecording instructs all clients to start recording at some configured time in the future, giving drones time to start recording on-sync.
func StopRecording ¶
func StopRecording() error
StopRecording instructs all clients to stop recording to make the recordings available.
Types ¶
type Client ¶
type Client struct { Config ClientConfig State ClientState // StateErr contains an error message in case the state is C StateErr error // This is the video UUID that is sent by the client when starting // or ending the video. VideoUUID string }
Client represents a client state, and contains a copy of the client configuration that is loaded.
func (*Client) GetURIWithKey ¶
GetURIWithKey returns the URI of a client with the API key from the configuration pre-filled.
type ClientConfig ¶
type ClientState ¶
type ClientState int64
ClientState represents the state of a specific client.
const ( // Disconnected means we never connected to the client. Disconnected ClientState = iota // ConnectionFailed means connection to the client was // unsuccessful, such as client is down or API key is invalid. ConnectionFailed // ConnectedStandby means the client is standby and ready to // start recording. ConnectedStandby // ConnectedRecording means the client is currently recording. ConnectedRecording // ConnectedFailed means the connection to the client is // successful, but there was issue with starting recording, // saving the video, etc. ConnectedFailed )
type Configuration ¶
type Configuration struct { WebPort string APIKey string Clients []ClientConfig }
Configuration represents a config file format for client management (server) part of the application.
type SystemState ¶
type SystemState int64
SystemState defines the current system state, which should be reflected on the clients.
const ( // SystemStandby means that the system is not performing any // action, and is ready to start recording -- assuming clients are // online. SystemStandby SystemState = iota // SystemRecording means that the system assumes all clients are // currently recording. SystemRecording // SystemFetching means that the system is fetching the video // files from the clients. SystemFetching // SystemStitching means that the system is stitching all the // video files that were fetched from the clients. SystemStitching )
var CurrentSystemState SystemState
CurrentSystemState is the state of the system. This should be mostly reflective of the LoadedClients state.