defewayclient

package
v0.0.0-...-a66ba14 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FLVScriptPath      = "cgi-bin/flv.cgi"
	GWScriptPath       = "cgi-bin/gw.cgi"
	SnapshotScriptPath = "cgi-bin/snapshot.cgi"
)

Variables

This section is empty.

Functions

func NewDefewayClient

func NewDefewayClient(config DefewayClientConfig) *client

Types

type DefewayClientConfig

type DefewayClientConfig struct {
	HTTPClientConfig
	Address  string
	Username string
	Password string
}

type DefewayDeviceInfo

type DefewayDeviceInfo struct {
	Name             string `xml:"name,attr"`
	Model            string `xml:"model,attr"`
	SerialNumber     string `xml:"serialnumber,attr"`
	HWVer            string `xml:"hwver,attr"`
	SWVer            string `xml:"swver,attr"`
	RelDateTime      string `xml:"reldatetime,attr"`
	IP               string `xml:"ip,attr"`
	HTTPPort         uint16 `xml:"httpport,attr"`
	ClientPort       uint16 `xml:"clientport,attr"`
	RemoteIP         string `xml:"rip,attr"`
	RemoteHTTPPort   uint16 `xml:"rhttpport,attr"`
	RemoteClientPort uint16 `xml:"rclinetport,attr"`
	CamCount         uint8  `xml:"camcnt,attr"`
}

type DefewayEnvLoad

type DefewayEnvLoad struct {
	Username string          `xml:"usr,attr"`
	Password string          `xml:"pwd,attr"`
	Type     uint8           `xml:"type,attr"`
	ErrorNo  uint8           `xml:"errno,attr"`
	Network  *DefewayNetwork `xml:"network,omitempty"`
}

func (*DefewayEnvLoad) HasError

func (o *DefewayEnvLoad) HasError() (bool, string)

type DefewayHDD

type DefewayHDD struct {
	Username string    `xml:"usr,attr"`
	Password string    `xml:"pwd,attr"`
	Action   uint8     `xml:"action,attr"`
	Disks    []HDDMeta `xml:"d,omitempty"`
}

type DefewayJuan

type DefewayJuan struct {
	XMLName    xml.Name           `xml:"juan"`
	Version    string             `xml:"ver,attr"`
	SQU        string             `xml:"squ,attr"`
	Direction  uint               `xml:"dir,attr"`
	Enc        uint               `xml:"enc,attr"`
	ErrorNo    uint               `xml:"errno,attr"`
	RecSearch  *DefewayRecSearch  `xml:"recsearch,omitempty"`
	DeviceInfo *DefewayDeviceInfo `xml:"devinfo,omitempty"`
	EnvLoad    *DefewayEnvLoad    `xml:"envload,omitempty"`
	HDD        *DefewayHDD        `xml:"hdd,omitempty"`
}

func NewForDeviceInfo

func NewForDeviceInfo(envLoad DefewayEnvLoad, devInfo DefewayDeviceInfo, hdd DefewayHDD) *DefewayJuan

func NewForRecSearch

func NewForRecSearch(recSearch DefewayRecSearch) *DefewayJuan

func UnmarshalJuan

func UnmarshalJuan(data []byte) (*DefewayJuan, error)

func (*DefewayJuan) HasError

func (dj *DefewayJuan) HasError() (bool, string)

func (*DefewayJuan) Marshal

func (dj *DefewayJuan) Marshal() (string, error)

type DefewayNetwork

type DefewayNetwork struct {
	DHCP         uint8  `xml:"dhcp,attr"`
	MAC          string `xml:"mac,attr"`
	IP           string `xml:"ip,attr"`
	Submask      string `xml:"submask,attr"`
	Gateway      string `xml:"gateway,attr"`
	DNS          string `xml:"dns,attr"`
	HTTPPort     uint16 `xml:"httpport,attr"`
	ClientPort   uint16 `xml:"clientport,attr"`
	ENETID       string `xml:"enetid,attr"`
	DDNS         uint8  `xml:"ddns,attr"`
	DDNSProvider uint8  `xml:"ddnsprovide,attr"`
	DDNSURL      string `xml:"ddnsurl,attr"`
	DDNSUser     string `xml:"ddnsusr,attr"`
	DDNSPassword string `xml:"ddnspwd,attr"`
}

type DefewayRecSearch

type DefewayRecSearch struct {
	Username      string          `xml:"usr,attr"`
	Password      string          `xml:"pwd,attr"`
	Channels      uint16          `xml:"channels,attr"`
	Types         uint16          `xml:"types,attr"`
	Date          string          `xml:"date,attr"`
	BeginTime     string          `xml:"begin,attr"`
	EndTime       string          `xml:"end,attr"`
	SessionIdx    uint            `xml:"session_index,attr"`
	SessionCount  uint            `xml:"session_count,attr"`
	SessionTotal  uint            `xml:"session_total,attr"`
	SearchResults []RecordingMeta `xml:"s,omitempty"`
}

type DeviceInfoClient

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

func NewDeviceInfoClient

func NewDeviceInfoClient(config DefewayClientConfig) *DeviceInfoClient

func (*DeviceInfoClient) Fetch

func (sc *DeviceInfoClient) Fetch() (*DefewayJuan, error)

type HDDMeta

type HDDMeta struct {
	Model    string
	Capacity uint64
	Used     uint64
	Status   uint8 // 3 - DB error, 4 - Formatted, 5 - OK, else Unformatted
}

func (*HDDMeta) UnmarshalXML

func (hdd *HDDMeta) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type HTTPClientConfig

type HTTPClientConfig struct {
	Timeout           time.Duration
	DisableKeepAlives bool
	TLSSkipVerify     bool
}

type RecordingMeta

type RecordingMeta struct {
	RecordingID    uint
	ChannelID      uint16
	TypeID         uint16
	StartTimestamp uint64
	EndTimestamp   uint64
}

func (*RecordingMeta) GetFileName

func (s *RecordingMeta) GetFileName() string

func (*RecordingMeta) GetFileShortName

func (s *RecordingMeta) GetFileShortName() string

func (*RecordingMeta) UnmarshalXML

func (s *RecordingMeta) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type RecordingsClient

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

func NewRecordingsClient

func NewRecordingsClient(
	fetchConfig DefewayClientConfig,
	downloadConfig DefewayClientConfig,
) *RecordingsClient

func (*RecordingsClient) Download

func (rm *RecordingsClient) Download(recMeta RecordingMeta, dst io.Writer, isPreview bool) error

func (*RecordingsClient) Fetch

func (rm *RecordingsClient) Fetch(
	fetchParams RecordingsFetchParams,
) ([]RecordingMeta, error)

type RecordingsFetchParams

type RecordingsFetchParams struct {
	Channels       uint16
	Date           time.Time
	EndTime        time.Time
	RecordingTypes uint16
	StartTime      time.Time
}

type SnapshotClient

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

func NewSnapshotClient

func NewSnapshotClient(config DefewayClientConfig) *SnapshotClient

func (*SnapshotClient) Fetch

func (sc *SnapshotClient) Fetch(chn int, dst io.Writer) error

Jump to

Keyboard shortcuts

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