securityspy: github.com/golift/securityspy Index | Files

package securityspy

import "github.com/golift/securityspy"

Package securityspy is a full featured SDK library for interacting with the SecuritySpy API: https://www.bensoftware.com/securityspy/web-server-spec.html

Index

Package Files

cameras.go cameras_types.go events.go events_types.go fake_api.go files.go files_types.go ptz.go ptz_types.go schedules.go schedules_types.go securityspy.go securityspy_types.go

Variables

var (
    // ErrorUnknownEvent never really returns, but will fire if SecuritySpy
    // adds new events this library doesn't know about.
    ErrorUnknownEvent = errors.New("unknown event")

    // ErrorCAMParseFail will return if the camera number in an event stream does not exist.
    // If you see this, run Refresh() more often, or fix your flaky camera connection.
    ErrorCAMParseFail = errors.New("CAM parse failed")

    // ErrorIDParseFail will return if the camera number provided by the event stream is not a number.
    // This should never happen, but future versions of SecuritySpy could trigger this if formats change.
    ErrorIDParseFail = errors.New("ID parse failed")

    // ErrorCAMMissing like the errors above should never return.
    // This is triggered by a corrupted event format.
    ErrorCAMMissing = errors.New("CAM missing")

    // ErrorDateParseFail will only trigger if the time stamp format for events changes.
    ErrorDateParseFail = errors.New("timestamp parse failed")

    // ErrorDisconnect becomes the msg in a custom event when the SecSpy event stream is disconnected.
    ErrorDisconnect = errors.New("event stream disconnected")
)

This is a list of errors returned by the Events methods.

var (
    // ErrorPathExists returns when a requested write path already exists.
    ErrorPathExists = errors.New("cannot overwrite existing path")

    // ErrorInvalidName returns when requesting a file download and the filename is invalid.
    ErrorInvalidName = errors.New("invalid file name")
)

Errors returned by the Files type methods.

var (
    // ErrorPTZNotOK is returned for any command that has a successful web request,
    // but the reply does not end with the word OK.
    ErrorPTZNotOK = errors.New("PTZ command not OK")

    // ErrorPTZRange returns when a PTZ preset outside of 1-8 is provided.
    ErrorPTZRange = errors.New("PTZ preset out of range 1-8")
)
var DefaultTimeout = 10 * time.Second

DefaultTimeout it used for almost every request to SecuritySpy. Adjust as needed.

var Encoder = "/usr/local/bin/ffmpeg"

Encoder is the path to ffmpeg.

var ErrorCmdNotOK = errors.New("command unsuccessful")

ErrorCmdNotOK is returned for any command that has a successful web request, but the reply does not end with the word OK.

type Camera Uses

type Camera struct {
    Number              int            `xml:"number"`               // 0, 1, 2, 3, 4, 5, 6
    Connected           YesNoBool      `xml:"connected"`            // yes, yes, yes, yes, yes, ...
    Width               int            `xml:"width"`                // 2560, 2592, 2592, 3072, 2...
    Height              int            `xml:"height"`               // 1440, 1520, 1520, 2048, 1...
    Mode                YesNoBool      `xml:"mode"`                 // active, active, active, a...
    ModeC               YesNoBool      `xml:"mode-c"`               // armed, armed, armed, arme...
    ModeM               YesNoBool      `xml:"mode-m"`               // armed, armed, armed, arme...
    ModeA               YesNoBool      `xml:"mode-a"`               // armed, armed, armed, arme...
    HasAudio            YesNoBool      `xml:"hasaudio"`             // yes, yes, no, yes, yes, y...
    PTZ                 *PTZ           `xml:"ptzcapabilities"`      // 0, 0, 31, 0, 0, 0, 0
    TimeSinceLastFrame  Duration       `xml:"timesincelastframe"`   // 0, 0, 0, 0, 0, 0, 0
    TimeSinceLastMotion Duration       `xml:"timesincelastmotion"`  // 689, 3796, 201, 12477, 15...
    DeviceName          string         `xml:"devicename"`           // ONVIF, ONVIF, ONVIF, ONVI...
    DeviceType          string         `xml:"devicetype"`           // Network, Network, Network...
    Address             string         `xml:"address"`              // 192.168.69.12, 192.168.69...
    Port                int            `xml:"port"`                 // 80, 80, 80, 0=80
    PortRTSP            int            `xml:"port-rtsp"`            // 554, 0=554
    Request             string         `xml:"request"`              // /some/rtsp/math (manual only)
    Name                string         `xml:"name"`                 // Porch, Door, Road, Garage...
    Overlay             YesNoBool      `xml:"overlay"`              // no, no, no, no, no, no, n...
    OverlayText         string         `xml:"overlaytext"`          // +d, +d, +d, +d, +d, +d, +...
    Transformation      int            `xml:"transformation"`       // 0, 1, 2, 3, 4, 5
    AudioNetwork        YesNoBool      `xml:"audio_network"`        // yes, yes, yes, yes, yes, ...
    AudioDeviceName     string         `xml:"audio_devicename"`     // Another Camera
    MDenabled           YesNoBool      `xml:"md_enabled"`           // yes, yes, yes, yes, yes, ...
    MDsensitivity       int            `xml:"md_sensitivity"`       // 51, 50, 47, 50, 50, 50, 5...
    MDtriggerTimeX2     Duration       `xml:"md_triggertime_x2"`    // 2, 2, 1, 2, 2, 2, 2
    MDcapture           YesNoBool      `xml:"md_capture"`           // yes, yes, yes, yes, yes, ...
    MDcaptureFPS        float64        `xml:"md_capturefps"`        // 20, 20, 20, 20, 20, 20, 2...
    MDpreCapture        Duration       `xml:"md_precapture"`        // 3, 4, 3, 3, 3, 2, 0
    MDpostCapture       Duration       `xml:"md_postcapture"`       // 10, 5, 5, 5, 5, 20, 15
    MDcaptureImages     YesNoBool      `xml:"md_captureimages"`     // no, no, no, no, no, no, n...
    MDuploadImages      YesNoBool      `xml:"md_uploadimages"`      // no, no, no, no, no, no, n...
    MDeecordAudio       YesNoBool      `xml:"md_recordaudio"`       // yes, yes, yes, yes, yes, ...
    MDaudioTrigger      YesNoBool      `xml:"md_audiotrigger"`      // no, no, no, no, no, no, n...
    MDaudioThreshold    int            `xml:"md_audiothreshold"`    // 50, 50, 50, 50, 50, 50, 5...
    ActionScriptName    string         `xml:"action_scriptname"`    // SS_SendiMessages.scpt, SS...
    ActionSoundName     string         `xml:"action_soundname"`     // sound_file_name
    ActionResetTime     Duration       `xml:"action_resettime"`     // 60, 60, 60, 60, 60, 60, 4...
    TLcapture           YesNoBool      `xml:"tl_capture"`           // no, no, no, no, no, no, n...
    TLrecordAudio       YesNoBool      `xml:"tl_recordaudio"`       // yes, yes, yes, yes, yes, ...
    CurrentFPS          float64        `xml:"current-fps"`          // 20.000, 20.000, 20.000, 2...
    ScheduleIDCC        CameraSchedule `xml:"schedule-id-cc"`       // 1, 1, 1, 1, 1, 1, 0
    ScheduleIDMC        CameraSchedule `xml:"schedule-id-mc"`       // 1, 1, 1, 1, 1, 1, 1
    ScheduleIDA         CameraSchedule `xml:"schedule-id-a"`        // 1, 1, 1, 1, 1, 1, 1
    ScheduleOverrideCC  CameraSchedule `xml:"schedule-override-cc"` // 0, 0, 0, 0, 0, 0, 0
    ScheduleOverrideMC  CameraSchedule `xml:"schedule-override-mc"` // 0, 0, 0, 0, 0, 0, 0
    ScheduleOverrideA   CameraSchedule `xml:"schedule-override-a"`  // 0, 0, 0, 0, 0, 0, 0
    PresetName1         string         `xml:"preset-name-1"`
    PresetName2         string         `xml:"preset-name-2"`
    PresetName3         string         `xml:"preset-name-3"`
    PresetName4         string         `xml:"preset-name-4"`
    PresetName5         string         `xml:"preset-name-5"`
    PresetName6         string         `xml:"preset-name-6"`
    PresetName7         string         `xml:"preset-name-7"`
    PresetName8         string         `xml:"preset-name-8"`
    Permissions         int64          `xml:"permissions"` // 63167, 63167, 62975, 6316...
    // contains filtered or unexported fields
}

Camera defines the data returned from the SecuritySpy API. This data is directly unmarshalled from the XML returned by the ++systemInfo method. Use the attached methods to control a camera in various ways.

func (*Camera) GetJPEG Uses

func (c *Camera) GetJPEG(ops *VidOps) (image.Image, error)

GetJPEG returns an images from a camera. VidOps defines the image size. ops.FPS is ignored.

func (*Camera) PostG711 Uses

func (c *Camera) PostG711(audio io.ReadCloser) error

PostG711 makes a POST request to send audio to a camera with a speaker. Accepts an io.ReadCloser that will be closed. Probably an open file. This is untested. Report your success or failure!

func (*Camera) SaveJPEG Uses

func (c *Camera) SaveJPEG(ops *VidOps, path string) error

SaveJPEG gets a picture from a camera and puts it in a file (path). The file will be overwritten if it exists. VidOps defines the image size. ops.FPS is ignored.

func (*Camera) SaveVideo Uses

func (c *Camera) SaveVideo(ops *VidOps, length time.Duration, maxsize int64, outputFile string) error

SaveVideo saves a segment of video from a camera to a file using FFMPEG.

func (*Camera) SetSchedule Uses

func (c *Camera) SetSchedule(mode CameraMode, scheduleID int) error

SetSchedule configures a camera mode's primary schedule. Get a list of schedules IDs you can use here from server.Info.Schedules. CameraModes are constants with names that start with CameraMode*

func (*Camera) SetScheduleOverride Uses

func (c *Camera) SetScheduleOverride(mode CameraMode, overrideID int) error

SetScheduleOverride temporarily overrides a camera mode's current schedule. Get a list of overrides IDs you can use here from server.Info.ScheduleOverrides. CameraModes are constants with names that start with CameraMode*

func (*Camera) StreamG711 Uses

func (c *Camera) StreamG711() (io.ReadCloser, error)

StreamG711 makes a web request to retreive an G711 audio stream. Returns an io.ReadCloser that will (hopefully) never end.

func (*Camera) StreamH264 Uses

func (c *Camera) StreamH264(ops *VidOps) (io.ReadCloser, error)

StreamH264 makes a web request to retreive an H264 stream. Returns an io.ReadCloser that will (hopefully) never end.

func (*Camera) StreamMJPG Uses

func (c *Camera) StreamMJPG(ops *VidOps) (io.ReadCloser, error)

StreamMJPG makes a web request to retreive a motion JPEG stream. Returns an io.ReadCloser that will (hopefully) never end.

func (*Camera) StreamVideo Uses

func (c *Camera) StreamVideo(ops *VidOps, length time.Duration, maxsize int64) (io.ReadCloser, error)

StreamVideo streams a segment of video from a camera using FFMPEG. VidOps defines the video options for the video stream. Returns an io.ReadCloser with the video stream. Close() it when finished.

func (*Camera) ToggleActions Uses

func (c *Camera) ToggleActions(arm CameraArmMode) error

ToggleActions arms (true) or disarms (false) a camera's actions.

func (*Camera) ToggleContinuous Uses

func (c *Camera) ToggleContinuous(arm CameraArmMode) error

ToggleContinuous arms (true) or disarms (false) a camera's continuous capture mode.

func (*Camera) ToggleMotion Uses

func (c *Camera) ToggleMotion(arm CameraArmMode) error

ToggleMotion arms (true) or disarms (false) a camera's motion capture mode.

func (*Camera) TriggerMotion Uses

func (c *Camera) TriggerMotion() error

TriggerMotion sets a camera as currently seeing motion. Other actions likely occur because of this!

type CameraArmMode Uses

type CameraArmMode rune

CameraArmMode locks arming to an integer of 0 or 1.

const (
    CameraDisarm CameraArmMode = iota
    CameraArm
)

Arming is either 0 or 1. Use these constants as inputs to a camera's schedule methods.

type CameraMode Uses

type CameraMode rune

CameraMode is a set of constants to deal with three specific camera modes.

const (
    CameraModeAll        CameraMode = 'X'
    CameraModeMotion     CameraMode = 'M'
    CameraModeActions    CameraMode = 'A'
    CameraModeContinuous CameraMode = 'C'
)

CameraMode* are used by the Camera scheduling methods. Use these constants as inputs to a Camera's schedule methods.

type CameraSchedule Uses

type CameraSchedule struct {
    Name string
    ID   int
}

CameraSchedule contains schedule info for a camera's properties. This is assigned to Motion Capture, Continuous Capture and Actions.

func (*CameraSchedule) UnmarshalXML Uses

func (bit *CameraSchedule) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML stores a schedule ID into a CameraSchedule type. This isn't a method you should ever call directly; it is only used during data initialization.

type Cameras Uses

type Cameras struct {
    Names   []string
    Numbers []int
    // contains filtered or unexported fields
}

Cameras is an interface into the Camera system. Use the methods bound here to retreive camera interfaces.

func (*Cameras) All Uses

func (c *Cameras) All() (cams []*Camera)

All returns interfaces for every camera.

func (*Cameras) ByName Uses

func (c *Cameras) ByName(name string) *Camera

ByName returns an interface for a single camera, using the name.

func (*Cameras) ByNum Uses

func (c *Cameras) ByNum(number int) *Camera

ByNum returns an interface for a single camera.

type Duration Uses

type Duration struct {
    time.Duration
    Val string
}

Duration is used to convert the "Seconds" given to us by the SecuritySpy API into a go time.Duration.

func (*Duration) UnmarshalXML Uses

func (bit *Duration) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML method converts seconds from a string to time.Duration. This isn't a method you should ever call directly; it is only used during data initialization.

type Event Uses

type Event struct {
    Time   time.Time // Local time event was recorded.
    When   time.Time // Event time according to server.
    ID     int       // Negative numbers are custom events.
    Camera *Camera   // Each event gets a camera interface.
    Type   EventType // Event identifier
    Msg    string    // Event Text
    Errors []error   // Errors populated by parse errors.
}

Event represents a SecuritySpy event from the Stream Reply. This is the INPUT data for an event that is sent to a bound callback method or channel.

func (*Event) String Uses

func (e *Event) String() string

String provides a description of an event.

type EventType Uses

type EventType string

EventType is a set of constant strings validated by the Event() method.

const (
    EventArmContinuous    EventType = "ARM_C"
    EventDisarmContinuous EventType = "DISARM_C"
    EventArmMotion        EventType = "ARM_M"
    EventDisarmMotion     EventType = "DISARM_M"
    EventDisarmActions    EventType = "DISARM_A"
    EventArmActions       EventType = "ARM_A"
    EventSecSpyError      EventType = "ERROR"
    EventConfigChange     EventType = "CONFIGCHANGE"
    EventMotionDetected   EventType = "MOTION"
    EventOnline           EventType = "ONLINE"
    EventOffline          EventType = "OFFLINE"
    // The following belong to the library, not securityspy.
    EventStreamDisconnect   EventType = "DISCONNECTED"
    EventStreamConnect      EventType = "CONNECTED"
    EventUnknownEvent       EventType = "UNKNOWN"
    EventAllEvents          EventType = "ALL"
    EventWatcherRefreshed   EventType = "REFRESH"
    EventWatcherRefreshFail EventType = "REFRESHFAIL"
    EventStreamCustom       EventType = "CUSTOM"
)

Events that can be returned by the event stream. These events can have channels or callback functions bound to them. The DISCONNECTED event fires when the event stream is disconnected, so watch that event with a binding to detect stream interruptions.

type Events Uses

type Events struct {
    Running bool
    // contains filtered or unexported fields
}

Events is the main Events interface. Use the methods bound here to bind your own functions, methods and channels to SecuritySpy events. Call Watch() to connect to the event stream. The Running bool is true when the event stream watcher routine is active.

func (*Events) BindChan Uses

func (e *Events) BindChan(event EventType, channel chan Event)

BindChan binds a receiving channel to an Event in SecuritySpy. Use this to receive incoming events over a channel. Avoid using unbuffered channels as they may block further event processing.

func (*Events) BindFunc Uses

func (e *Events) BindFunc(event EventType, callBack func(Event))

BindFunc binds a call-back function to an Event in SecuritySpy. Use this to receive incoming events via a callback method in a go routine.

func (*Events) Custom Uses

func (e *Events) Custom(cameraNum int, msg string)

Custom fires an event into the running event Watcher. Any functions or channels bound to the CUSTOM Event type will also be called.

func (*Events) Stop Uses

func (e *Events) Stop()

Stop stops Watch() loops and disconnects from the event stream. No further callback messages will fire after this is called.

func (*Events) UnbindAll Uses

func (e *Events) UnbindAll()

UnbindAll removes all event bindings and channels.

func (*Events) UnbindChan Uses

func (e *Events) UnbindChan(event EventType)

UnbindChan removes all bound channels for a particular event.

func (*Events) UnbindFunc Uses

func (e *Events) UnbindFunc(event EventType)

UnbindFunc removes all bound callbacks for a particular event. EventType is a set of constants that begin with Event*

func (*Events) Watch Uses

func (e *Events) Watch(retryInterval time.Duration, refreshOnConfigChange bool)

Watch kicks off the routines to watch the eventStream and fire callback bindings. If your application relies on event stream messages, call this at least once to connect the stream. If you have no call back functions or channels then do not call this.

type File Uses

type File struct {
    Title string `xml:"title"` // 01-12-2019 M Gate.m4v, 01...
    Link  struct {
        Rel    string `xml:"rel,attr"`    // alternate, alternate, alternate
        Type   string `xml:"type,attr"`   // video/quicktime, video/quicktime
        Length int64  `xml:"length,attr"` // 358472320, 483306152, 900789978,
        HREF   string `xml:"href,attr"`   // ++getfile/4/2018-10-17/10-17-2018+M+Gate.m4v
    }   `xml:"link"`
    Updated   time.Time     `xml:"updated"`   // 2019-01-12T08:57:58Z, 201...
    CameraNum int           `xml:"cameraNum"` // 0, 1, 2, 4, 5, 7, 9, 10, 11, 12, 13
    GmtOffset time.Duration // the rest are copied in per-file from fileFeed.
    Camera    *Camera
    // contains filtered or unexported fields
}

File represents a saved media file. This is all the data retreived from the ++download method for a particular file. Contains a camera interface for the camera that created the file. All of the Files type methods return this type.

func (*File) Get Uses

func (f *File) Get(highBandwidth bool) (io.ReadCloser, error)

Get opens a file from a SecuritySpy download href and returns the http.Body io.ReadCloser. Close() the Closer when finished. Pass true (for highBandwidth) will download the full size file. Passing false will download a smaller transcoded file.

func (*File) Save Uses

func (f *File) Save(path string) (int64, error)

Save downloads a saved media File from SecuritySpy and saves it to a local file. Returns an error if path exists.

type Files Uses

type Files struct {
    // contains filtered or unexported fields
}

Files powers the Files interface. Use the bound methods to list and download saved media files.

func (*Files) GetAll Uses

func (f *Files) GetAll(cameraNums []int, from, to time.Time) ([]*File, error)

GetAll returns a list of File interfaces to all captured videos and images. Takes in a list of Camera Numbers, as well as a start and stop time to filter results.

func (*Files) GetCCVideos Uses

func (f *Files) GetCCVideos(cameraNums []int, from, to time.Time) ([]*File, error)

GetCCVideos returns a list of File interfaces to continuous-captured videos. Takes in a list of Camera Numbers, as well as a start and stop time to filter results.

func (*Files) GetFile Uses

func (f *Files) GetFile(name string) (*File, error)

GetFile returns a file based on the name. It makes a lot of assumptions about file paths. Not all methods work with this. Avoid it if possible. This allows Get() and Save() to work for an arbitrary file name.

func (*Files) GetImages Uses

func (f *Files) GetImages(cameraNums []int, from, to time.Time) ([]*File, error)

GetImages returns a list of File interfaces to captured images. Takes in a list of Camera Numbers, as well as a start and stop time to filter results.

func (*Files) GetMCVideos Uses

func (f *Files) GetMCVideos(cameraNums []int, from, to time.Time) ([]*File, error)

GetMCVideos returns a list of File interfaces to motion-captured videos. Takes in a list of Camera Numbers, as well as a start and stop time to filter results.

type PTZ Uses

type PTZ struct {
    HasPanTilt bool // true if a camera can pan and tilt using PTZ controls.
    HasHome    bool // true if the camera supports the home position PTZ command.
    HasZoom    bool // true if the camera supports zooming in and out.
    HasPresets bool // true when the camera allows user-defined preset positions.
    Continuous bool // true if the camera supports continuous movement.
    // contains filtered or unexported fields
}

PTZ are what "things" a camera can do. Use the bound methods to interact with a camera's PTZ controls.

func (*PTZ) Down Uses

func (z *PTZ) Down() error

Down makes a camera look down one click.

func (*PTZ) DownLeft Uses

func (z *PTZ) DownLeft() error

DownLeft sends a camera down and to the left a click.

func (*PTZ) DownRight Uses

func (z *PTZ) DownRight() error

DownRight is sorta like making the camera do a dab.

func (*PTZ) Home Uses

func (z *PTZ) Home() error

Home sends a camera to the home position.

func (*PTZ) Left Uses

func (z *PTZ) Left() error

Left sends a camera to the left one click.

func (*PTZ) Preset Uses

func (z *PTZ) Preset(preset PTZpreset) error

Preset instructs a a camera to move a preset position.

func (*PTZ) PresetSave Uses

func (z *PTZ) PresetSave(preset PTZpreset) error

PresetSave instructs a preset to be permanently saved. good luck!

func (*PTZ) Right Uses

func (z *PTZ) Right() error

Right sends a camera to the right one click.

func (*PTZ) Stop Uses

func (z *PTZ) Stop() error

Stop instructs a camera to stop moving, assuming it supports continuous movement.

func (*PTZ) UnmarshalXML Uses

func (z *PTZ) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML method converts ptzCapbilities bitmask from an XML payload into true/false abilities. This isn't a method you should ever call directly; it is only used during data initialization.

func (*PTZ) Up Uses

func (z *PTZ) Up() error

Up sends a camera to the sky one click.

func (*PTZ) UpLeft Uses

func (z *PTZ) UpLeft() error

UpLeft will send a camera up and to the left a click.

func (*PTZ) UpRight Uses

func (z *PTZ) UpRight() error

UpRight sends a camera up and to the right.

func (*PTZ) Zoom Uses

func (z *PTZ) Zoom(in bool) error

Zoom makes a camera zoom in (true) or out (false).

type PTZpreset Uses

type PTZpreset rune

PTZpreset locks our presets to a max of 8

const (
    PTZpreset1 PTZpreset
    PTZpreset2
    PTZpreset3
    PTZpreset4
    PTZpreset5
    PTZpreset6
    PTZpreset7
    PTZpreset8
)

Presets are 1 through 8. Use these constants as inputs to the PTZ methods.

type Server Uses

type Server struct {
    Files   *Files      // Files interface.
    Events  *Events     // Events interface.
    Cameras *Cameras    // Cameras & PTZ interfaces.
    Info    *ServerInfo // ServerInfo struct (no methods).
    // contains filtered or unexported fields
}

Server is the main interface for this library. Contains sub-interfaces for cameras, ptz, files & events This is provided in exchange for a url, username and password.

func GetServer Uses

func GetServer(user, pass, url string, verifySSL bool) (*Server, error)

GetServer returns an iterface to interact with SecuritySpy. This is the only exportred function in the library. All of the other interfaces are accessed through this interface.

func (*Server) GetScripts Uses

func (s *Server) GetScripts() ([]string, error)

GetScripts fetches and returns the list of script files. You can't do much with these.

func (*Server) GetSounds Uses

func (s *Server) GetSounds() ([]string, error)

GetSounds fetches and returns the list of sound files. You can't do much with these.

func (*Server) Refresh Uses

func (s *Server) Refresh() error

Refresh gets fresh camera and serverInfo data from SecuritySpy, run this after every action to keep the data pool up to date.

func (*Server) SetSchedulePreset Uses

func (s *Server) SetSchedulePreset(presetID int) error

SetSchedulePreset invokes a schedule preset. This [may/will] affect all camera arm modes. Find preset IDs you can pass into this method at server.Info.SchedulePresets

type ServerInfo Uses

type ServerInfo struct {
    Name             string    `xml:"name"`               // SecuritySpy
    Version          string    `xml:"version"`            // 4.2.10
    UUID             string    `xml:"uuid"`               // C03L1333F8J3AkXIZS1O
    EventStreamCount int64     `xml:"eventstreamcount"`   // 99270
    DDNSName         string    `xml:"ddns-name"`          // domain.name.dyn
    WanAddress       string    `xml:"wan-address"`        // domain.name
    ServerName       string    `xml:"server-name"`        // <usually empty>
    BonjourName      string    `xml:"bonjour-name"`       // <usually empty>
    IP1              string    `xml:"ip1"`                // 192.168.3.1
    IP2              string    `xml:"ip2"`                // 192.168.69.3
    HTTPEnabled      YesNoBool `xml:"http-enabled"`       // yes
    HTTPPort         int       `xml:"http-port"`          // 8000
    HTTPPortWan      int       `xml:"http-port-wan"`      // 8000
    HTTPSEnabled     YesNoBool `xml:"https-enabled"`      // no
    HTTPSPort        int       `xml:"https-port"`         // 8001
    HTTPSPortWan     int       `xml:"https-port-wan"`     // 8001
    CurrentTime      time.Time `xml:"current-local-time"` // 2019-02-10T03:08:12-08:00
    GmtOffset        Duration  `xml:"seconds-from-gmt"`   // -28800
    DateFormat       string    `xml:"date-format"`        // MM/DD/YYYY
    TimeFormat       string    `xml:"time-format"`        // 12, 24
    // These are all copied in/created by Refresh()
    Refreshed         time.Time
    ServerSchedules   map[int]string
    SchedulePresets   map[int]string
    ScheduleOverrides map[int]string
    // If there is a chance of calling Refresh() while reading these maps, lock them.
    sync.RWMutex
}

ServerInfo represents all the SecuritySpy server's information. This becomes available as server.Info.

type VidOps Uses

type VidOps struct {
    Width   int
    Height  int
    FPS     int
    Quality int
}

VidOps are the frame options for a video that can be requested from SecuritySpy. This same data struct is used for capturing JPEG files, in that case FPS is discarded. Use this data type in the Camera methods that retreive live videos/images.

type YesNoBool Uses

type YesNoBool struct {
    Val bool
    Txt string
}

YesNoBool is used to capture strings into boolean format. If the string has a Val of: 1, true, yes, armed, active, or enabled then the boolean is true. Any other string Val and the boolean is false.

func (*YesNoBool) UnmarshalXML Uses

func (bit *YesNoBool) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML method converts armed/disarmed, yes/no, active/inactive or 0/1 to true/false. Really it converts armed, yes, active, enabled, 1, true to true. Anything else is false. This isn't a method you should ever call directly; it is only used during data initialization.

Package securityspy imports 19 packages (graph). Updated 2019-02-11. Refresh now. Tools for package owners.