Documentation
¶
Index ¶
Constants ¶
View Source
const ( OZONEACTION_START = 1 OZONEACTION_STOP = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MonitorContext ¶
type MonitorContext struct { sync.Mutex OzoneCh chan OzoneTask // OzoneCh is a channel that receives an OzoneTask to start or stop the ozone generator. OzoneRunning bool NotifyCh chan NotificationTask // Channel to track notification tasks TempMonitorCh chan TemperatureTask // Channel to track temperature monitoring requests TargetTemperature float64 WaterTemperature float64 RoomTemperature float64 // contains filtered or unexported fields }
func InitializeMonitorContext ¶
func InitializeMonitorContext(notifier *notify.Notify, store MonitorStore, sensors sensor.Sensors) *MonitorContext
InitializeMonitorContext will initialize a new MonitorSync struct.
func (*MonitorContext) CancelAndWait ¶
func (ms *MonitorContext) CancelAndWait()
CancelAndWait for the monitor sync routines to exit.
type MonitorStore ¶
type MonitorStore interface { SaveTemperature(ctx context.Context, arg database.SaveTemperatureParams) (database.Temperature, error) GetLatestOzoneEntry(ctx context.Context) (database.Ozone, error) StartOzoneGenerator(ctx context.Context, arg database.StartOzoneGeneratorParams) (database.Ozone, error) StopOzoneGenerator(ctx context.Context, id uuid.UUID) (database.Ozone, error) UpdateOzoneEntryStatus(ctx context.Context, args database.UpdateOzoneEntryStatusParams) (database.Ozone, error) GetLatestLeakDetected(ctx context.Context) (database.Leak, error) CreateLeakDetected(ctx context.Context, detectedAt time.Time) (database.Leak, error) ClearDetectedLeak(ctx context.Context, id uuid.UUID) (database.Leak, error) }
type NotificationTask ¶
type NotificationTask struct { // Message to send to the consumer. Message string }
NotificationTask is a struct used to send messages to a destination.
type OzoneAction ¶
type OzoneAction int
OzoneAction indicates if the ozone generator should start or stop.
Values can be: OZONEACTION_START OZONEACTION_STOP
type OzoneTask ¶
type OzoneTask struct { Action OzoneAction // Duration to run the ozone generator in minutes. Duration int }
OzoneTask is a struct used to contain the information needed to run the ozone generator for a set duration.
type TemperatureTask ¶
type TemperatureTask struct {
TargetTemperature float64
}
TemperatureTask will start monitoring the temperature indicated. If another TemperatureTask is received while already monitoring, it will replace the current monitor. Once the temperature has been reached the user will be notified once.
Click to show internal directories.
Click to hide internal directories.