unifi

package
v0.0.0-...-60cc1b5 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PacketTypeActionFrame HeaderPacketType = 1
	PacketTypeDataFrame   HeaderPacketType = 2

	FormatJSONObject HeaderPayloadFormat = 1
	FormatUTF8String HeaderPayloadFormat = 2
	FormatNodeBuffer HeaderPayloadFormat = 3

	Uncompressed HeaderCompression = 0
	Compressed   HeaderCompression = 1
)

Variables

This section is empty.

Functions

func Login

func Login(cfg Config, username, password string) (tokenCookie *http.Cookie, _ error)

Types

type ActionFrame

type ActionFrame struct {
	Action      ActionKind   `json:"action"`
	ModelKey    ModelKeyKind `json:"modelKey"`
	NewUpdateID string       `json:"newUpdateId"`
	Score       int          `json:"score"`
	Camera      string       `json:"camera"`
	ID          string       `json:"id"`
}

type ActionKind

type ActionKind string
const (
	ActionKindAdd    ActionKind = "add"
	ActionKindUpdate ActionKind = "update"
)

type Config

type Config struct {
	Endpoint *url.URL
}

type EventDataFrame

type EventDataFrame struct {
	Type     string `json:"type"`
	Start    int    `json:"start"`
	Score    int    `json:"score"`
	Camera   string `json:"camera"`
	ID       string `json:"id"`
	ModelKey string `json:"modelKey"`
}

type HeaderCompression

type HeaderCompression byte

type HeaderPacketType

type HeaderPacketType byte

type HeaderPayloadFormat

type HeaderPayloadFormat byte

type LoginRequest

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

type ModelKeyKind

type ModelKeyKind string
const (
	ModelKeyEvent  ModelKeyKind = "event"
	ModelKeyNVR    ModelKeyKind = "nvr"
	ModelKeyCamera ModelKeyKind = "camera"
	ModelKeyUser   ModelKeyKind = "user"
)

type PacketHeader

type PacketHeader struct {
	Type        HeaderPacketType
	Format      HeaderPayloadFormat
	Compression HeaderCompression
	Reserved    byte
	PayloadSize uint32
}

type UpdateListener

type UpdateListener struct {
	C chan UpdatePayload
	// contains filtered or unexported fields
}

func NewUpdateListener

func NewUpdateListener(ctx context.Context, cfg Config, tokenCookie *http.Cookie) (*UpdateListener, error)

type UpdatePayload

type UpdatePayload struct {
	Header          PacketHeader
	ActionFrame     ActionFrame
	SecondaryHeader PacketHeader
	DataFrame       []byte
}

Jump to

Keyboard shortcuts

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