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 (
	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 // 热成像
)

func (Address) Validate

func (a Address) Validate() error

type AutoHoming

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

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
)

func (BaudRate) Validate

func (b BaudRate) Validate() error

type CommAttribute

type CommAttribute struct {
	BaudRate BaudRate  `json:"BodeRate"` // 波特率(1200,2400, 4800,9600,19200,38400,57600,115200)
	DataBits DataBit   `json:"DataBits"` // 数据位数(5,6,7,8)
	Parity   ParityBit `json:"Parity"`   // 奇偶校验选项(0:无,1:奇校验,2:偶校验,3:标志校验,4:空校验)
	StopBits StopBit   `json:"StopBits"` // 停止位(0:停止位1;1:停止位1.5;2:停止位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 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 CruiseName

type CruiseName string

func (CruiseName) Validate

func (n CruiseName) Validate() error

type DataBit

type DataBit int

DataBit 数据位

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

func (DataBit) Validate

func (d DataBit) Validate() error

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:"required,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:"TourID" 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"`
	Runing          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

type Limit

type Limit struct {
	LevelEnable   bool    `json:"LevelEnable" validate:"boolean"`        // 水平限位使能
	CheckLeft     int     `json:"CheckLeft" validate:"gte=0,lte=1"`      // 水平左校验位 点左限位为check=1
	CheckRight    int     `json:"CheckRight" validate:"gte=0,lte=1"`     // 水平右校验位 点右限位为check=1
	LeftBoundary  float64 `json:"LeftBoundary" validate:"gte=0,lt=360"`  // 左边界位置
	RightBoundary float64 `json:"RightBoundary" validate:"gte=0,lt=360"` // 右边界位置

	VerticalEnable bool    `json:"VerticalEnable" validate:"boolean"`    // 垂直限位使能
	CheckUp        int     `json:"CheckUp" validate:"gte=0,lte=1"`       // 水平上校验位 点左限位为check=1
	CheckDown      int     `json:"CheckDown" validate:"gte=0,lte=1"`     // 水平下校验位 点右限位为check=1
	DownBoundary   float64 `json:"DownBoundary" validate:"gte=0,lte=90"` // 下边界位置
	UpBoundary     float64 `json:"UpBoundary" validate:"gte=0,lte=90"`   // 上边界位置
}

func NewLimit

func NewLimit() *Limit

func (*Limit) ConfigKey

func (l *Limit) ConfigKey() string

type LineScan

type LineScan struct {
	Enable             bool       `json:"Enable" validate:"boolean"`                           // 使能
	ID                 LineScanID `json:"ID" validate:"required,gte=1,lte=5"`                  // 线性扫描id
	LeftMargin         float64    `json:"LeftMargin" validate:"gte=-1,lte=360"`                // 设置左边界,-1 清除边界
	ResidenceTimeLeft  int        `json:"ResidenceTimeLeft" validate:"required,gte=1,lte=60"`  // 停留时间(左)秒
	RightMargin        float64    `json:"RightMargin" validate:"gte=-1,lte=360"`               // 设置右边界,-1 清除边界
	ResidenceTimeRight int        `json:"ResidenceTimeRight" validate:"required,gte=1,lte=60"` // 停留时间(右)秒
	Runing             bool       `json:"Runing" validate:"boolean"`                           // 运行状态
	Speed              int        `json:"Speed" validate:"required,gte=1,lte=8"`               // 线扫速度 1-8 1:最慢 8:最快
}

func NewLineScan

func NewLineScan(id LineScanID) (LineScan, error)

func (*LineScan) ConfigKey

func (l *LineScan) ConfigKey() string

func (*LineScan) Default

func (l *LineScan) Default() []LineScan

func (*LineScan) Validate

func (l *LineScan) Validate() error

type LineScanID

type LineScanID int

func (LineScanID) Validate

func (i LineScanID) Validate() error

type PTZ

type PTZ struct {
	Enable    bool           `json:"Enable"`    // 使能
	Protocol  Protocol       `json:"Protocol"`  // 协议类型: 0 PELCOD, 1 PELCOP
	Address   Address        `json:"Address"`   // PELCO协议: 485地址,0-255
	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                  // 空校验
)

func (ParityBit) Validate

func (p ParityBit) Validate() error

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坐标结束位置
	Runing        bool      `json:"Runing"`                             // 运行状态
}

type Position

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

Position 云台坐标与放大倍数

func NewPosition

func NewPosition() *Position

type PowerUps

type PowerUps struct {
	Enable       bool `json:"Enable" validate:"boolean"`
	Function     int  `json:"Function" validate:"required,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

type PresetID

type PresetID int

func (PresetID) Validate

func (i PresetID) Validate() error

type PresetName

type PresetName string

func (PresetName) Validate

func (n PresetName) Validate() error

type PresetPoint

type PresetPoint struct {
	Enable   bool       `json:"Enable" validate:"boolean"`             // 使能
	ID       PresetID   `json:"ID" validate:"required,gte=1,lte=255"`  // 预置点id
	Name     PresetName `json:"Name" validate:"required,min=1,max=64"` // 预置点名称
	Position *Position  `json:"Position"`                              // 预置点的坐标和放大倍数
}

func NewPreset

func NewPreset(id PresetID, name PresetName) (PresetPoint, error)

func (*PresetPoint) ConfigKey

func (p *PresetPoint) ConfigKey() string

func (*PresetPoint) Default

func (p *PresetPoint) Default() []PresetPoint

type Protocol

type Protocol int

Protocol 协议

const (
	PELCOD Protocol = iota
	PELCOP
)

func (Protocol) Validate

func (p Protocol) Validate() error

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:"required,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:"required,gte=0,lte=5"`
	Schedule        types.WeekSchedule `json:"Schedule" validate:"required"`
}

func NewPtzAutoMovement

func NewPtzAutoMovement(id CronID) (*PtzAutoMovement, error)

func (*PtzAutoMovement) ConfigKey

func (m *PtzAutoMovement) ConfigKey() string

func (*PtzAutoMovement) DefaultSlice

func (m *PtzAutoMovement) DefaultSlice() []PtzAutoMovement

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"`
}

type StopBit

type StopBit int

StopBit 停止位

const (
	OneStopBit StopBit = iota
	OnePointFiveStopBits
	TwoStopBits
)

func (StopBit) Validate

func (s StopBit) Validate() error

type TourPreset

type TourPreset struct {
	Enable  bool              `json:"Enable" validate:"boolean"`             // 使能
	ID      CruiseID          `json:"ID" validate:"required,gte=1,lte=8"`    // ID
	Name    CruiseName        `json:"Name" validate:"required,min=1,max=64"` // 名字
	Preset  []TourPresetPoint `json:"Preset" validate:"required"`            // 关联预置点
	Running bool              `json:"Runing" validate:"boolean"`             // 运行状态
}

func NewCruise

func NewCruise(id CruiseID, name CruiseName) (TourPreset, error)

func (*TourPreset) ConfigKey

func (p *TourPreset) ConfigKey() string

func (*TourPreset) Default

func (p *TourPreset) Default() []TourPreset

type TourPresetPoint

type TourPresetPoint struct {
	ID            PresetID   `json:"ID" validate:"required,gte=1,lte=255"`            // 预设点id
	Name          PresetName `json:"Name" validate:"required,min=1,max=64"`           // 预设点名称
	ResidenceTime int        `json:"ResidenceTime" validate:"required,gte=0,lte=255"` // 停留时间(s)
}

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