models

package
v0.0.0-...-413ed12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PackageMQTTMessage

func PackageMQTTMessage(configuration *Configuration, msg Message) ([]byte, error)

Types

type APIResponse

type APIResponse struct {
	Data         interface{} `json:"data" bson:"data"`
	Message      interface{} `json:"message" bson:"message"`
	PTZFunctions interface{} `json:"ptz_functions" bson:"ptz_functions"`
	CanZoom      bool        `json:"can_zoom" bson:"can_zoom"`
	CanPanTilt   bool        `json:"can_pan_tilt" bson:"can_pan_tilt"`
}

type AudioDataPartial

type AudioDataPartial struct {
	Timestamp int64   `json:"timestamp" bson:"timestamp"`
	Data      []int16 `json:"data" bson:"data"`
}

type AudioPayload

type AudioPayload struct {
	Timestamp int64   `json:"timestamp"` // timestamp of the recording request.
	Data      []int16 `json:"data"`
}

We received a audio input

type Authentication

type Authentication struct {
	Username string `json:"username" bson:"username"`
	Password string `json:"password" bson:"password"`
}

type Authorization

type Authorization struct {
	Code     int    `json:"code" bson:"code"`
	Token    string `json:"token" bson:"token"`
	Expire   string `json:"expire" bson:"expire"`
	Username string `json:"username" bson:"username"`
	Role     string `json:"role" bson:"role"`
}

type Camera

type Camera struct {
	Width       int
	Height      int
	Num         int
	Denum       int
	Framerate   float64
	RTSP        string
	SubRTSP     string
	Codec       av.CodecType
	Initialized bool
}

type CameraStreams

type CameraStreams struct {
	RTSP    string `json:"rtsp"`
	SubRTSP string `json:"sub_rtsp"`
}

type Candidate

type Candidate struct {
	Cuuid     string `json:"cuuid"`
	CloudKey  string `json:"cloud_key"`
	Candidate string `json:"candidate"`
}

type Capture

type Capture struct {
	Name                  string      `json:"name"`
	IPCamera              IPCamera    `json:"ipcamera"`
	USBCamera             USBCamera   `json:"usbcamera"`
	RaspiCamera           RaspiCamera `json:"raspicamera"`
	Recording             string      `json:"recording,omitempty"`
	Snapshots             string      `json:"snapshots,omitempty"`
	Motion                string      `json:"motion,omitempty"`
	Liveview              string      `json:"liveview,omitempty"`
	Continuous            string      `json:"continuous,omitempty"`
	PostRecording         int64       `json:"postrecording"`
	PreRecording          int64       `json:"prerecording"`
	MaxLengthRecording    int64       `json:"maxlengthrecording"`
	TranscodingWebRTC     string      `json:"transcodingwebrtc"`
	TranscodingResolution int64       `json:"transcodingresolution"`
	ForwardWebRTC         string      `json:"forwardwebrtc"`
	Fragmented            string      `json:"fragmented,omitempty" bson:"fragmented,omitempty"`
	FragmentedDuration    int64       `json:"fragmentedduration,omitempty" bson:"fragmentedduration,omitempty"`
	PixelChangeThreshold  int         `json:"pixelChangeThreshold,omitempty"`
}

Capture defines which camera type (Id) you are using (IP, USB or Raspberry Pi camera), and also contains recording specific parameters.

type Communication

type Communication struct {
	Context               *context.Context
	CancelContext         *context.CancelFunc
	PackageCounter        *atomic.Value
	LastPacketTimer       *atomic.Value
	PackageCounterSub     *atomic.Value
	LastPacketTimerSub    *atomic.Value
	CloudTimestamp        *atomic.Value
	HandleBootstrap       chan string
	HandleStream          chan string
	HandleSubStream       chan string
	HandleMotion          chan MotionDataPartial
	HandleAudio           chan AudioDataPartial
	HandleUpload          chan string
	HandleHeartBeat       chan string
	HandleLiveSD          chan int64
	HandleLiveHDKeepalive chan string
	HandleLiveHDHandshake chan RequestHDStreamPayload
	HandleLiveHDPeers     chan string
	HandleONVIF           chan OnvifAction
	IsConfiguring         *abool.AtomicBool
	Queue                 *packets.Queue
	SubQueue              *packets.Queue
	Image                 string
	CameraConnected       bool
	MainStreamConnected   bool
	SubStreamConnected    bool
	HasBackChannel        bool
}

The communication struct that is managing all the communication between the different goroutines.

type Config

type Config struct {
	Type              string       `json:"type"`
	Key               string       `json:"key"`
	Name              string       `json:"name"`
	FriendlyName      string       `json:"friendly_name"`
	Time              string       `json:"time" bson:"time"`
	Offline           string       `json:"offline"`
	AutoClean         string       `json:"auto_clean"`
	RemoveAfterUpload string       `json:"remove_after_upload"`
	MaxDirectorySize  int64        `json:"max_directory_size"`
	Timezone          string       `json:"timezone"`
	Capture           Capture      `json:"capture"`
	Timetable         []*Timetable `json:"timetable"`
	Region            *Region      `json:"region"`
	Cloud             string       `json:"cloud" bson:"cloud"`
	S3                *S3          `json:"s3,omitempty" bson:"s3,omitempty"`
	KStorage          *KStorage    `json:"kstorage,omitempty" bson:"kstorage,omitempty"`
	Dropbox           *Dropbox     `json:"dropbox,omitempty" bson:"dropbox,omitempty"`
	MQTTURI           string       `json:"mqtturi" bson:"mqtturi,omitempty"`
	MQTTUsername      string       `json:"mqtt_username" bson:"mqtt_username"`
	MQTTPassword      string       `json:"mqtt_password" bson:"mqtt_password"`
	STUNURI           string       `json:"stunuri" bson:"stunuri"`
	ForceTurn         string       `json:"turn_force" bson:"turn_force"`
	TURNURI           string       `json:"turnuri" bson:"turnuri"`
	TURNUsername      string       `json:"turn_username" bson:"turn_username"`
	TURNPassword      string       `json:"turn_password" bson:"turn_password"`
	HeartbeatURI      string       `json:"heartbeaturi" bson:"heartbeaturi"` /*obsolete*/
	HubEncryption     string       `json:"hub_encryption" bson:"hub_encryption"`
	HubURI            string       `json:"hub_uri" bson:"hub_uri"`
	HubKey            string       `json:"hub_key" bson:"hub_key"`
	HubPrivateKey     string       `json:"hub_private_key" bson:"hub_private_key"`
	HubSite           string       `json:"hub_site" bson:"hub_site"`
	ConditionURI      string       `json:"condition_uri" bson:"condition_uri"`
	Encryption        *Encryption  `json:"encryption,omitempty" bson:"encryption,omitempty"`
}

Config is the highlevel struct which contains all the configuration of your Kerberos Open Source instance.

type Configuration

type Configuration struct {
	Name         string
	Port         string
	Config       Config
	CustomConfig Config
	GlobalConfig Config
}

A struct which contains the global, local and merged config.

type Coordinate

type Coordinate struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

Coordinate belongs to a Polygon.

type Dropbox

type Dropbox struct {
	AccessToken string `json:"access_token,omitempty" bson:"access_token,omitempty"`
	Directory   string `json:"directory,omitempty" bson:"directory,omitempty"`
}

Dropbox integration

type Encryption

type Encryption struct {
	Enabled      string `json:"enabled" bson:"enabled"`
	Recordings   string `json:"recordings" bson:"recordings"`
	Fingerprint  string `json:"fingerprint" bson:"fingerprint"`
	PrivateKey   string `json:"private_key" bson:"private_key"`
	SymmetricKey string `json:"symmetric_key" bson:"symmetric_key"`
}

Encryption

type EventFilter

type EventFilter struct {
	TimestampOffsetStart int64 `json:"timestamp_offset_start"`
	TimestampOffsetEnd   int64 `json:"timestamp_offset_end"`
	NumberOfElements     int   `json:"number_of_elements"`
}

type IPCamera

type IPCamera struct {
	RTSP          string `json:"rtsp"`
	Width         int    `json:"width"`
	Height        int    `json:"height"`
	FPS           string `json:"fps"`
	SubRTSP       string `json:"sub_rtsp"`
	SubWidth      int    `json:"sub_width"`
	SubHeight     int    `json:"sub_height"`
	SubFPS        string `json:"sub_fps"`
	ONVIF         string `json:"onvif,omitempty" bson:"onvif"`
	ONVIFXAddr    string `json:"onvif_xaddr" bson:"onvif_xaddr"`
	ONVIFUsername string `json:"onvif_username" bson:"onvif_username"`
	ONVIFPassword string `json:"onvif_password" bson:"onvif_password"`
}

IPCamera configuration, such as the RTSP url of the IPCamera and the FPS. Also includes ONVIF integration

type KStorage

type KStorage struct {
	URI             string `json:"uri,omitempty" bson:"uri,omitempty"`
	CloudKey        string `json:"cloud_key,omitempty" bson:"cloud_key,omitempty"` /* old way, remove this */
	AccessKey       string `json:"access_key,omitempty" bson:"access_key,omitempty"`
	SecretAccessKey string `json:"secret_access_key,omitempty" bson:"secret_access_key,omitempty"`
	Provider        string `json:"provider,omitempty" bson:"provider,omitempty"`
	Directory       string `json:"directory,omitempty" bson:"directory,omitempty"`
}

KStorage contains the credentials of the Kerberos Storage/Kerberos Cloud instance. By defining KStorage you can make your recordings available in the cloud, at a centrel place.

type Media

type Media struct {
	Key        string `json:"key"`
	Path       string `json:"path"`
	Day        string `json:"day"`
	ShortDay   string `json:"short_day"`
	Time       string `json:"time"`
	Timestamp  string `json:"timestamp"`
	CameraName string `json:"camera_name"`
	CameraKey  string `json:"camera_key"`
}

type Message

type Message struct {
	Mid         string  `json:"mid"`
	DeviceId    string  `json:"device_id"`
	Timestamp   int64   `json:"timestamp"`
	Encrypted   bool    `json:"encrypted"`
	Hidden      bool    `json:"hidden"`
	PublicKey   string  `json:"public_key"`
	Fingerprint string  `json:"fingerprint"`
	Payload     Payload `json:"payload"`
}

The message structure which is used to send over and receive messages from the MQTT broker

type MotionDataFull

type MotionDataFull struct {
	Timestamp       int64   `json:"timestamp" bson:"timestamp"`
	Size            float64 `json:"size" bson:"size"`
	Microseconds    float64 `json:"microseconds" bson:"microseconds"`
	DeviceName      string  `json:"deviceName" bson:"deviceName"`
	Region          string  `json:"region" bson:"region"`
	NumberOfChanges int     `json:"numberOfChanges" bson:"numberOfChanges"`
	Token           int     `json:"token" bson:"token"`
}

type MotionDataPartial

type MotionDataPartial struct {
	Timestamp       int64 `json:"timestamp" bson:"timestamp"`
	NumberOfChanges int   `json:"numberOfChanges" bson:"numberOfChanges"`
}
type NavigatePTZPayload struct {
	Timestamp int64  `json:"timestamp"` // timestamp
	DeviceId  string `json:"device_id"` // device id
	Action    string `json:"action"`    // action
}

type OnvifAction

type OnvifAction struct {
	Action  string      `json:"action" bson:"action"`
	Payload interface{} `json:"payload" bson:"payload"`
}

type OnvifActionPTZ

type OnvifActionPTZ struct {
	Left   int     `json:"left" bson:"left"`
	Right  int     `json:"right" bson:"right"`
	Up     int     `json:"up" bson:"up"`
	Down   int     `json:"down" bson:"down"`
	Center int     `json:"center" bson:"center"`
	Zoom   float64 `json:"zoom" bson:"zoom"`
	X      float64 `json:"x" bson:"x"`
	Y      float64 `json:"y" bson:"y"`
	Z      float64 `json:"z" bson:"z"`
	Preset string  `json:"preset" bson:"preset"`
}

type OnvifActionPreset

type OnvifActionPreset struct {
	Name  string `json:"name" bson:"name"`
	Token string `json:"token" bson:"token"`
}

type OnvifCredentials

type OnvifCredentials struct {
	ONVIFXAddr    string `json:"onvif_xaddr,omitempty" bson:"onvif_xaddr"`
	ONVIFUsername string `json:"onvif_username,omitempty" bson:"onvif_username"`
	ONVIFPassword string `json:"onvif_password,omitempty" bson:"onvif_password"`
}

type OnvifPanTilt

type OnvifPanTilt struct {
	OnvifCredentials OnvifCredentials `json:"onvif_credentials,omitempty" bson:"onvif_credentials"`
	Pan              float64          `json:"pan,omitempty" bson:"pan"`
	Tilt             float64          `json:"tilt,omitempty" bson:"tilt"`
}

type OnvifPreset

type OnvifPreset struct {
	OnvifCredentials OnvifCredentials `json:"onvif_credentials,omitempty" bson:"onvif_credentials"`
	Preset           string           `json:"preset,omitempty" bson:"preset"`
}

type OnvifZoom

type OnvifZoom struct {
	OnvifCredentials OnvifCredentials `json:"onvif_credentials,omitempty" bson:"onvif_credentials"`
	Zoom             float64          `json:"zoom,omitempty" bson:"zoom"`
}

type OutputMessage

type OutputMessage struct {
	Name      string
	Outputs   []string
	Trigger   string
	Timestamp time.Time
	File      string
	CameraId  string
	SiteId    string
}

The OutputMessage contains the relevant information to specify the type of triggers we want to execute.

type PTZPositionPayload

type PTZPositionPayload struct {
	Timestamp int64 `json:"timestamp"` // timestamp of the preset request.
}

We received a preset position request, we'll request it through onvif and send it back.

type Payload

type Payload struct {
	Action         string                 `json:"action"`
	DeviceId       string                 `json:"device_id"`
	Signature      string                 `json:"signature"`
	EncryptedValue string                 `json:"encrypted_value"`
	HiddenValue    string                 `json:"hidden_value"`
	Value          map[string]interface{} `json:"value"`
}

The payload structure which is used to send over and receive messages from the MQTT broker

type Polygon

type Polygon struct {
	ID          string       `json:"id"`
	Coordinates []Coordinate `json:"coordinates"`
}

Polygon is a sequence of coordinates (x,y). The ID specifies an unique identifier, as multiple polygons can be defined.

type RaspiCamera

type RaspiCamera struct {
	Device string `json:"device"`
}

RaspiCamera configuration, such as the device path (/dev/video*)

type ReceiveHDCandidatesPayload

type ReceiveHDCandidatesPayload struct {
	Timestamp int64  `json:"timestamp"`  // timestamp
	SessionID string `json:"session_id"` // session id
	Candidate string `json:"candidate"`  // candidate
}

We received a receive HD candidates request

type RecordPayload

type RecordPayload struct {
	Timestamp int64 `json:"timestamp"` // timestamp of the recording request.
}

We received a recording request, we'll send it to the motion handler.

type Rectangle

type Rectangle struct {
	X1 int `json:"x1"`
	Y1 int `json:"y1"`
	X2 int `json:"x2"`
	Y2 int `json:"y2"`
}

Rectangle is defined by a starting point, left top (x1,y1) and end point (x2,y2).

type Region

type Region struct {
	Name      string    `json:"name"`
	Rectangle Rectangle `json:"rectangle"`
	Polygon   []Polygon `json:"polygon"`
}

Region specifies the type (Id) of Region Of Interest (ROI), you would like to use.

type RequestConfigPayload

type RequestConfigPayload struct {
	Timestamp int64 `json:"timestamp"` // timestamp of the preset request.
}

We received a request config request, we'll fetch the current config and send it back.

type RequestHDStreamPayload

type RequestHDStreamPayload struct {
	Timestamp          int64  `json:"timestamp"`           // timestamp
	HubKey             string `json:"hub_key"`             // hub key
	SessionID          string `json:"session_id"`          // session id
	SessionDescription string `json:"session_description"` // session description
}

We received a request HD stream request

type RequestSDStreamPayload

type RequestSDStreamPayload struct {
	Timestamp int64 `json:"timestamp"` // timestamp
}

We received a request SD stream request

type S3

type S3 struct {
	Proxy     string `json:"proxy,omitempty" bson:"proxy,omitempty"`
	ProxyURI  string `json:"proxyuri,omitempty" bson:"proxyuri,omitempty"`
	Bucket    string `json:"bucket,omitempty" bson:"bucket,omitempty"`
	Region    string `json:"region,omitempty" bson:"region,omitempty"`
	Username  string `json:"username,omitempty" bson:"username,omitempty"`
	Publickey string `json:"publickey,omitempty" bson:"publickey,omitempty"`
	Secretkey string `json:"secretkey,omitempty" bson:"secretkey,omitempty"`
}

S3 integration

type SDPPayload

type SDPPayload struct {
	Cuuid    string `json:"cuuid"`
	Sdp      string `json:"sdp"`
	CloudKey string `json:"cloud_key"`
}

type System

type System struct {
	CPUId             string   `json:"cpu_idle" bson:"cpu_idle"`
	Hostname          string   `json:"hostname" bson:"hostname"`
	Version           string   `json:"version" bson:"version"`
	Release           string   `json:"release" bson:"release"`
	BootTime          uint64   `json:"boot_time" bson:"boot_time"`
	KernelVersion     string   `json:"kernel_version" bson:"kernel_version"`
	MACs              []string `json:"macs" bson:"macs"`
	IPs               []string `json:"ips" bson:"ips"`
	Architecture      string   `json:"architecture" bson:"architecture"`
	UsedMemory        uint64   `json:"used_memory" bson:"used_memory"`
	TotalMemory       uint64   `json:"total_memory" bson:"total_memory"`
	FreeMemory        uint64   `json:"free_memory" bson:"free_memory"`
	ProcessUsedMemory uint64   `json:"process_used_memory" bson:"process_used_memory"`
}

type Timetable

type Timetable struct {
	Start1 int `json:"start1"`
	End1   int `json:"end1"`
	Start2 int `json:"start2"`
	End2   int `json:"end2"`
}

Timetable allows you to set a Time Of Intterest (TOI), which limits recording or detection to a predefined time interval. Two tracks can be set, which allows you to give some flexibility.

type TriggerRelay

type TriggerRelay struct {
	Timestamp int64  `json:"timestamp"` // timestamp
	DeviceId  string `json:"device_id"` // device id
	Token     string `json:"token"`     // token
}

type USBCamera

type USBCamera struct {
	Device string `json:"device"`
}

USBCamera configuration, such as the device path (/dev/video*)

type UpdateConfigPayload

type UpdateConfigPayload struct {
	Timestamp int64  `json:"timestamp"` // timestamp of the preset request.
	Config    Config `json:"config"`
}

We received a update config request, we'll update the current config and send a confirmation back.

type User

type User struct {
	Installed bool   `json:"installed" bson:"installed"`
	Username  string `json:"username" bson:"username"`
	Password  string `json:"password" bson:"password"`
	Role      string `json:"role" bson:"role"`
	Language  string `json:"language" bson:"language"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL