Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoStartOfImage = fmt.Errorf("image/jpeg start mark not detected") ErrNoEndOfImage = fmt.Errorf("image/jpeg end mark not detected") )
Functions ¶
func ResetConnectivity ¶
Types ¶
type Camera ¶
type Camera struct { ID int `db:"id" json:"id"` SensorID int `db:"sensor_id" json:"sensor_id"` Title string `db:"title" json:"title"` Description string `db:"description" json:"description"` DescriptionLong string `db:"description_long" json:"description_long"` Hostname string `db:"hostname" json:"hostname"` ProjectName string `db:"project_name" json:"project_name"` StorageLocation string `db:"storage_location" json:"storage_location"` Interval int `db:"interval" json:"interval"` NextCapTureTime pgtype.Timestamp `db:"next_capture_time" json:"next_capture_time"` Status string `db:"status" json:"status"` Alert bool `db:"alert" json:"alert"` Active bool `db:"active" json:"active"` CreatedAt string `db:"created_at" json:"created_at"` UpdatedAt helper.NullString `db:"updated_at" json:"updated_at"` DB *sqlx.DB `json:"-"` // contains filtered or unexported fields }
func NewCameraWithDB ¶
NewCamera instantiates a new camera struct with db connection.
func (*Camera) CaptureTimelapseImage ¶
func (c *Camera) CaptureTimelapseImage(timelapse StreamTimelapse)
func (*Camera) DeleteCamera ¶
func (*Camera) InsertNewCamera ¶
func (*Camera) Online ¶
Online checks if the camera is online and returning true by checking if status code is 200.
func (*Camera) SetNextCaptureTime ¶
SetNextCaptureTime sets the next capture time for a given camera based on interval, and replaces the value in the struct. Interval is in seconds.
func (*Camera) UpdateCamera ¶
type StreamTimelapse ¶
type StreamTimelapse struct { StorageDir string Hostname string ProjectPath string ProjectName string JsonConfig string // contains filtered or unexported fields }
StreamTimelapse is a struct that holds the configuration for a timelapse project.
func NewTimelase ¶
func NewTimelase(storageDir string, hostname string, projectName string) (StreamTimelapse, error)
NewTimelapse either opens or creates a new timelapse project.
func (*StreamTimelapse) CaptureTimelapseImage ¶
func (s *StreamTimelapse) CaptureTimelapseImage() error
CaptureTimelapseImage captures a single image from stream and saves it to the project folder. The image is saved as a jpeg file with the name: <unix-timestamp>-image.jpg to prevent overwriting.
Click to show internal directories.
Click to hide internal directories.