dsd

package
v0.0.0-...-50a2d83 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MarginNoLimit float64 = -1
View Source
const (
	MaxCronNum = 4
)
View Source
const (
	MaxCruiseNum = 8
)
View Source
const (
	MaxLineScanNum = 5
)
View Source
const (
	MaxPresetNum = 255
)
View Source
const (
	MaxTraceNum = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address int

Address 地址

const (
	Visible Address = 1 // 可见光
	Thermal Address = 2 // 热成像
)

type AutoHoming

type AutoHoming struct {
	Enable bool `json:"Enable" validate:"boolean"`
	Time   int  `json:"Time" validate:"required,gte=3"`
}

type AutoMovementSlice

type AutoMovementSlice []PtzAutoMovement

func NewAutoMovementSlice

func NewAutoMovementSlice() AutoMovementSlice

func (*AutoMovementSlice) ConfigKey

func (s *AutoMovementSlice) ConfigKey() string

type BaudRate

type BaudRate int

BaudRate 串口波特率

const (
	BaudRate1200   BaudRate = 1200
	BaudRate2400   BaudRate = 2400
	BaudRate4800   BaudRate = 4800
	BaudRate9600   BaudRate = 9600
	BaudRate19200  BaudRate = 19200
	BaudRate38400  BaudRate = 38400
	BaudRate57600  BaudRate = 57600
	BaudRate115200 BaudRate = 115200
)

type CommAttribute

type CommAttribute struct {
	BaudRate BaudRate  `json:"BodeRate" validate:"oneof=1200 2400 4800 9600 19200 38400 57600 115200"`
	DataBits DataBit   `json:"DataBits" validate:"oneof=5 6 7 8"`
	Parity   ParityBit `json:"Parity" validate:"oneof=0 1 2 3 4"`
	StopBits StopBit   `json:"StopBits" validate:"oneof=0 1 2"`
}

CommAttribute 串口属性

func NewCommAttribute

func NewCommAttribute() *CommAttribute

func (*CommAttribute) Validate

func (c *CommAttribute) Validate() error

type CommInfo

type CommInfo struct {
	CommType int      `json:"CommType"`
	Data     []string `json:"Data"`
}

type Command

type Command struct {
	CommInfo  *CommInfo `json:"CommInfo"`
	StartTime int       `json:"StartTime"` // 执行时间戳:单位毫秒
}

type CronFunction

type CronFunction int

CronFunction 定时功能

const (
	None   CronFunction = iota // None
	Preset                     // 预置点
	Cruise                     // 巡航
	Trace                      // 巡迹
	Line                       // 线性扫描
	Region                     // 区域扫描
)

func (CronFunction) Validate

func (f CronFunction) Validate() error

type CronID

type CronID int

func (CronID) Validate

func (i CronID) Validate() error

type CruiseID

type CruiseID int

func (CruiseID) Validate

func (i CruiseID) Validate() error

type CruiseSlice

type CruiseSlice []TourPreset

func NewCruiseSlice

func NewCruiseSlice() CruiseSlice

func (*CruiseSlice) ConfigKey

func (s *CruiseSlice) ConfigKey() string

type DataBit

type DataBit int

DataBit 数据位

const (
	FiveDataBit  DataBit = 5
	SixDataBit   DataBit = 6
	SevenDataBit DataBit = 7
	EightDataBit DataBit = 8
)

type IdleMotion

type IdleMotion struct {
	Enable          bool `json:"Enable" validate:"boolean"`
	Second          int  `json:"Second" validate:"required,gte=5,lte=720"`
	Function        int  `json:"Function" validate:"gte=0,lte=5"`
	PresetID        int  `json:"PresetID" validate:"required,gte=1,lte=255"`
	TourID          int  `json:"TourID" validate:"required,gte=1,lte=8"`
	PatternID       int  `json:"PatternID" validate:"required,gte=1,lte=5"`
	LinearScanID    int  `json:"LinearScanID" validate:"required,gte=1,lte=5"`
	RegionScanID    int  `json:"RegionScanID" validate:"required,gte=1,lte=5"`
	Running         bool `json:"Runing" validate:"boolean"`
	RunningFunction int  `json:"RunningFunction" validate:"required,gte=0,lte=5"`
}

func NewIdleMotion

func NewIdleMotion() *IdleMotion

func (*IdleMotion) ConfigKey

func (m *IdleMotion) ConfigKey() string

func (*IdleMotion) Validate

func (m *IdleMotion) Validate() error

type LineMarginOp

type LineMarginOp int
const (
	SetLeftMargin LineMarginOp = iota
	SetRightMargin
	ClearLeftMargin
	ClearRightMargin
)

type LineScan

type LineScan struct {
	Enable             bool       `json:"Enable" validate:"boolean"`
	ID                 LineScanID `json:"ID" validate:"required,gte=1,lte=5"`
	LeftMargin         float64    `json:"LeftMargin" validate:"gte=-1,lt=360"`
	ResidenceTimeLeft  int        `json:"ResidenceTimeLeft" validate:"required,gte=1,lte=60"`
	RightMargin        float64    `json:"RightMargin" validate:"gte=-1,lt=360"`
	ResidenceTimeRight int        `json:"ResidenceTimeRight" validate:"required,gte=1,lte=60"`
	Running            bool       `json:"Runing" validate:"boolean"`
	Speed              int        `json:"Speed" validate:"required,gte=1,lte=8"`
}

func NewLine

func NewLine(id LineScanID) LineScan

func (*LineScan) Validate

func (l *LineScan) Validate() error

type LineScanID

type LineScanID int

func (LineScanID) Validate

func (i LineScanID) Validate() error

type LineSlice

type LineSlice []LineScan

func NewLineSlice

func NewLineSlice() LineSlice

func (*LineSlice) ConfigKey

func (l *LineSlice) ConfigKey() string

type PTZ

type PTZ struct {
	Enable    bool           `json:"Enable"`
	Protocol  Protocol       `json:"Protocol" validate:"oneof=0 1"`
	Address   Address        `json:"Address" validate:"oneof=1 2"`
	Attribute *CommAttribute `json:"Attribute"` // 串口属性
}

PTZ 串口配置

func NewPTZ

func NewPTZ() *PTZ

func (*PTZ) ConfigKey

func (p *PTZ) ConfigKey() string

ConfigKey 返回用于读取配置文件的 Key

func (*PTZ) ConvertAddress

func (s *PTZ) ConvertAddress() byte

func (*PTZ) Validate

func (p *PTZ) Validate() error

type ParityBit

type ParityBit int

ParityBit 校验位

const (
	NoParity    ParityBit = iota // 无
	OddParity                    // 奇校验
	EvenParity                   // 偶校验
	MarkParity                   // 标志校验
	SpaceParity                  // 空校验
)

type Pattern

type Pattern struct {
	ID            int       `json:"ID" validate:"required,gte=1,lte=5"` // ID
	Enable        bool      `json:"Enable" validate:"boolean"`          // 使能
	Check         int       `json:"Check"`                              // 校验 点击开始记录和停止记录都加2,结果为4才能开始
	Commands      []Command `json:"Commands"`                           // 用户操作记录
	StartPosition Position  `json:"StartPosition"`                      // 巡迹PTZ坐标起始位置
	EndPosition   Position  `json:"EndPosition"`                        // 巡迹PTZ坐标结束位置
	Running       bool      `json:"Runing"`                             // 运行状态
}

type Position

type Position struct {
	Pan  float64 `json:"Pan" validate:"gte=0,lt=360"`  // 水平坐标
	Tilt float64 `json:"Tilt" validate:"gte=0,lte=90"` // 垂直坐标
	Zoom float64 `json:"Zoom" validate:"gte=1,lte=20"` // 变倍
}

Position 云台坐标与放大倍数

func NewPosition

func NewPosition() Position

func (*Position) Validate

func (p *Position) Validate() error

type PowerUps

type PowerUps struct {
	Enable       bool `json:"Enable" validate:"boolean"`
	Function     int  `json:"Function" validate:"gte=0,lte=5"`
	PresetID     int  `json:"PresetID" validate:"required,gte=1,lte=255"`
	TourID       int  `json:"TourID" validate:"required,gte=1,lte=8"`
	PatternID    int  `json:"PatternID" validate:"required,gte=1,lte=5"`
	LinearScanID int  `json:"LinearScanID" validate:"required,gte=1,lte=5"`
	RegionScanID int  `json:"RegionScanID" validate:"required,gte=1,lte=5"`
}

func NewPowerUps

func NewPowerUps() *PowerUps

func (*PowerUps) ConfigKey

func (u *PowerUps) ConfigKey() string

func (*PowerUps) Validate

func (u *PowerUps) Validate() error

type PresetID

type PresetID int

func (PresetID) Validate

func (i PresetID) Validate() error

type PresetPoint

type PresetPoint struct {
	Enable   bool     `json:"Enable" validate:"boolean"`
	ID       PresetID `json:"ID" validate:"required,gte=1,lte=255"`
	Name     string   `json:"Name" validate:"required,min=1,max=64"`
	Position Position `json:"Position"`
}

func NewPreset

func NewPreset(id PresetID, name string) PresetPoint

func (*PresetPoint) Validate

func (p *PresetPoint) Validate() error

type PresetSlice

type PresetSlice []PresetPoint

func NewPresetSlice

func NewPresetSlice() PresetSlice

func (*PresetSlice) ConfigKey

func (p *PresetSlice) ConfigKey() string

type Protocol

type Protocol int

Protocol 云台协议类型

const (
	PELCOD Protocol = iota
	PELCOP
)

type PtzAutoMovement

type PtzAutoMovement struct {
	ID              CronID             `json:"ID" validate:"required,gte=1,lte=4"`
	Enable          bool               `json:"Enable" validate:"boolean"`
	Function        int                `json:"Function" validate:"gte=0,lte=5"`
	PresetID        int                `json:"PresetID" validate:"required,gte=1,lte=255"`
	TourID          int                `json:"TourID" validate:"required,gte=1,lte=8"`
	PatternID       int                `json:"PatternID" validate:"required,gte=1,lte=5"`
	LinearScanID    int                `json:"LinearScanID" validate:"required,gte=1,lte=5"`
	RegionScanID    int                `json:"RegionScanID" validate:"required,gte=1,lte=5"`
	AutoHoming      AutoHoming         `json:"AutoHoming" validate:"required"`
	RunningFunction int                `json:"RunningFunction" validate:"gte=0,lte=5"`
	Schedule        types.WeekSchedule `json:"Schedule" validate:"required"`
}

func NewAutoMovement

func NewAutoMovement(id CronID) PtzAutoMovement

func (*PtzAutoMovement) GetFuncID

func (a *PtzAutoMovement) GetFuncID() (int, error)

func (*PtzAutoMovement) Validate

func (a *PtzAutoMovement) Validate() error

type Record

type Record struct {
	ID            TraceID
	Enable        bool
	Valid         bool
	Schedules     []Schedule
	StartPosition Position
}

type RecordSlice

type RecordSlice []Record

func NewRecordSlice

func NewRecordSlice() RecordSlice

func (*RecordSlice) ConfigKey

func (s *RecordSlice) ConfigKey() string

type Schedule

type Schedule struct {
	FuncID    int
	Speed     int
	StartTime time.Time
	StopTime  time.Time
}

type Status

type Status struct {
	Moving       bool  `json:"Moving" validate:"boolean"`
	Trigger      int   `json:"Trigger" validate:"required,gte=0,lte=4"`
	Function     int   `json:"Function" validate:"required,gte=0,lte=5"`
	FunctionID   int   `json:"FunctionID" validate:"required"`
	TimingTaskID int   `json:"TimingTaskID" validate:"required,gte=1,lte=4"`
	StartTime    int64 `json:"StartTime" validate:"required"`
}

func NewStatus

func NewStatus() Status

type StopBit

type StopBit int

StopBit 停止位

const (
	OneStopBit StopBit = iota
	OnePointFiveStopBits
	TwoStopBits
)

type TourPreset

type TourPreset struct {
	Enable  bool              `json:"Enable" validate:"boolean"`
	ID      CruiseID          `json:"ID" validate:"required,gte=1,lte=8"`
	Name    string            `json:"Name" validate:"required,min=1,max=64"`
	Preset  []TourPresetPoint `json:"Preset" `
	Running bool              `json:"Runing" validate:"boolean"`
}

func NewCruise

func NewCruise(id CruiseID, name string) TourPreset

func (*TourPreset) Validate

func (p *TourPreset) Validate() error

type TourPresetPoint

type TourPresetPoint struct {
	ID            PresetID `json:"ID" validate:"required,gte=1,lte=255"`
	Name          string   `json:"Name" validate:"required,min=1,max=64"`
	ResidenceTime int      `json:"ResidenceTime" validate:"gte=0,lte=255"`
}

func NewTourPresetPoint

func NewTourPresetPoint(id PresetID, name string, time int) TourPresetPoint

func (*TourPresetPoint) Validate

func (p *TourPresetPoint) Validate() error

type TraceID

type TraceID int

func (TraceID) Validate

func (i TraceID) Validate() error

Jump to

Keyboard shortcuts

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