models

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: May 9, 2018 License: GPL-3.0 Imports: 14 Imported by: 2 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteScoutHealths

func DeleteScoutHealths(db *sql.DB, scoutUUID string) error

func DeleteScoutInteractions

func DeleteScoutInteractions(db *sql.DB, scoutUUID string) error

func DeleteScoutLogs

func DeleteScoutLogs(db *sql.DB, scoutUUID string) error

func GetScoutUUID

func GetScoutUUID(db *sql.DB) string

func NumScoutHealths

func NumScoutHealths(db *sql.DB) (int64, error)

func NumScoutInteractions

func NumScoutInteractions(db *sql.DB) (int64, error)

func NumScoutLogs

func NumScoutLogs(db *sql.DB) (int64, error)

func NumScouts

func NumScouts(db *sql.DB) (int64, error)

func ScoutHealthsAsJSON

func ScoutHealthsAsJSON(db *sql.DB) (string, error)

func ScoutInteractionsAsJSON

func ScoutInteractionsAsJSON(db *sql.DB) (string, error)

func ScoutSummariesAsJSON

func ScoutSummariesAsJSON(db *sql.DB) (string, error)

func ScoutsAsJSON

func ScoutsAsJSON(db *sql.DB) ([]string, error)

Types

type Buckets

func (*Buckets) Scan

func (b *Buckets) Scan(value interface{}) error

func (Buckets) Value

func (b Buckets) Value() (driver.Value, error)

type Command

type Command int
const (
	CALIBRATE Command = iota
	START_MEASURE
	STOP_MEASURE
)

type IntBuckets

func (*IntBuckets) Scan

func (b *IntBuckets) Scan(value interface{}) error

func (IntBuckets) Value

func (b IntBuckets) Value() (driver.Value, error)

type Interaction

type Interaction struct {
	UUID    string    // The UUID for the scout that detected the interaction.
	Version string    // The Version of the protocol used for transmitting data to the mothership
	Entered time.Time // The time the interaction started (rounded to nearest half hour)

	Duration float32    // The total duration of the interaction.
	Path     []Waypoint // The pathway of the interaction through the scene.
	SceneID  int
	// contains filtered or unexported fields
}

func NewInteraction

func NewInteraction(w Waypoint, sId int, s *Scout) Interaction

func (Interaction) Equal

func (i Interaction) Equal(wp []Waypoint) bool

func (*Interaction) LastWaypoint

func (i *Interaction) LastWaypoint() Waypoint

lastWaypoint returns the last waypoint within the interaction.

type Path

type Path [][2]int

func (*Path) Scan

func (p *Path) Scan(value interface{}) error

func (Path) Value

func (p Path) Value() (driver.Value, error)

type RealArray

type RealArray []float32

func (*RealArray) Scan

func (a *RealArray) Scan(value interface{}) error

func (RealArray) Value

func (a RealArray) Value() (driver.Value, error)

type Scene

type Scene struct {
	Interactions     []Interaction // The current interactions occuring within the scene.
	IdleInteractions []Interaction // The current interactions that are idle (resumable).
	// contains filtered or unexported fields
}

func InitScene

func InitScene(scout *Scout) *Scene

initScene creates an empty scene that can be used for monitoring interactions.

func (*Scene) Close

func (s *Scene) Close(db *sql.DB)

func (*Scene) Update

func (s *Scene) Update(db *sql.DB, detected []Waypoint)

type Scout

type Scout struct {
	UUID       string        `json:"uuid"`
	IpAddress  string        `json:"ip_address"`
	Port       int64         `json:"port"`
	Authorised bool          `json:"authorised"`
	Name       string        `json:"name"`
	State      ScoutState    `json:"state"`
	Summary    *ScoutSummary `json:"summary"`

	MinArea            float64
	DilationIterations int64
	ForegroundThresh   int64
	GaussianSmooth     int64
	MogHistoryLength   int64
	MogThreshold       float64
	MogDetectShadows   int64
	SimplifyEpsilon    float64
	MinDuration        float32
	IdleDuration       float32
	ResumeSqDistance   int64
	MaxArea            float64
}

func GetAllScouts

func GetAllScouts(db *sql.DB) ([]*Scout, error)

func GetScout

func GetScout(db *sql.DB) *Scout

func GetScoutByUUID

func GetScoutByUUID(db *sql.DB, uuid string) (*Scout, error)

func (*Scout) ClearCalibrationFrame

func (s *Scout) ClearCalibrationFrame(db *sql.DB) error

func (*Scout) GetCalibrationFrame

func (s *Scout) GetCalibrationFrame(db *sql.DB) ([]byte, error)

func (*Scout) Insert

func (s *Scout) Insert(db *sql.DB) error

func (*Scout) Update

func (s *Scout) Update(db *sql.DB) error

func (*Scout) UpdateCalibrationFrame

func (s *Scout) UpdateCalibrationFrame(db *sql.DB, frame []byte) error

type ScoutHealth

type ScoutHealth struct {
	ScoutUUID   string
	CPU         float32
	Memory      float32
	TotalMemory float32
	Storage     float32
	CreatedAt   time.Time
}

func GetLastScoutHealth

func GetLastScoutHealth(db *sql.DB, scoutUUID string) (*ScoutHealth, error)

func GetScoutHealthByUUID

func GetScoutHealthByUUID(db *sql.DB, scoutUUID string, time time.Time) (*ScoutHealth, error)

func (*ScoutHealth) Insert

func (s *ScoutHealth) Insert(db *sql.DB) error

type ScoutInteraction

type ScoutInteraction struct {
	Id             int64
	ScoutUUID      string
	Duration       float32
	Waypoints      Path
	WaypointWidths Path
	WaypointTimes  RealArray
	Processed      bool
	EnteredAt      time.Time
}

func CreateScoutInteraction

func CreateScoutInteraction(i *Interaction) ScoutInteraction

func GetLastScoutInteraction

func GetLastScoutInteraction(db *sql.DB, scoutUUID string) (*ScoutInteraction, error)

func GetScoutInteractionById

func GetScoutInteractionById(db *sql.DB, id int64) (*ScoutInteraction, error)

func GetUnprocessed

func GetUnprocessed(db *sql.DB) ([]*ScoutInteraction, error)

func (*ScoutInteraction) Insert

func (si *ScoutInteraction) Insert(db *sql.DB) error

func (*ScoutInteraction) MarkProcessed

func (si *ScoutInteraction) MarkProcessed(db *sql.DB) error

type ScoutLog

type ScoutLog struct {
	ScoutUUID string
	Log       []byte
	CreatedAt time.Time
}

func GetLastScoutLog

func GetLastScoutLog(db *sql.DB, scoutUUID string) (*ScoutLog, error)

func GetScoutLogByUUID

func GetScoutLogByUUID(db *sql.DB, scoutUUID string, time time.Time) (*ScoutLog, error)

func (*ScoutLog) Insert

func (s *ScoutLog) Insert(db *sql.DB) error

type ScoutState

type ScoutState string
const (
	IDLE        ScoutState = "idle"
	CALIBRATING ScoutState = "calibrating"
	CALIBRATED  ScoutState = "calibrated"
	MEASURING   ScoutState = "measuring"
)

func (*ScoutState) Scan

func (s *ScoutState) Scan(value interface{}) error

func (ScoutState) Value

func (s ScoutState) Value() (driver.Value, error)

type ScoutSummary

type ScoutSummary struct {
	ScoutUUID        string
	VisitorCount     int64
	VisitTimeBuckets Buckets
	VisitorBuckets   IntBuckets
}

func GetScoutSummaryByUUID

func GetScoutSummaryByUUID(db *sql.DB, scoutUUID string) (*ScoutSummary, error)

func (*ScoutSummary) Clear

func (si *ScoutSummary) Clear(db *sql.DB) error

func (*ScoutSummary) Insert

func (si *ScoutSummary) Insert(db *sql.DB) error

func (*ScoutSummary) Update

func (si *ScoutSummary) Update(db *sql.DB) error

type Waypoint

type Waypoint struct {
	XPixels          int     // x-coordinate of waypoint centroid in pixels
	YPixels          int     // y-coordinate of waypoint centroid in pixels
	HalfWidthPixels  int     // Half the width of the waypoint in pixels
	HalfHeightPixels int     // Half the height of the waypoint in pixels
	T                float32 // The number of seconds elapsed since the beginning of the interaction
}

func (Waypoint) Equal

func (a Waypoint) Equal(b Waypoint) bool

compare returns true if two waypoints are the same, false otherwise.

Jump to

Keyboard shortcuts

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