sensorlogic

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandLogin                 = "login"
	CommandLogout                = "logout"
	CommandSleep                 = "sleep"
	CommandAwake                 = "awake"
	CommandChangeSampleFrequency = "changeSampleFrequency"
	CommandDelete                = "delete"
)

Variables

Functions

func HandleLogs

func HandleLogs(dto routing.SensorLog) error

method from sensorstate maybe

func HandleMeasurement

func HandleMeasurement(ctx context.Context, db *storage.DB, dto routing.SensorMeasurement) error

method from sensorstate maybe

Types

type Log

type Log struct {
	Level   string
	Message string
}

type Sensor

type Sensor struct {
	SerialNumber string
}

type SensorState

type SensorState struct {
	Sensor                    Sensor       // 16 bytes (string)
	LogsInfo                  chan string  // 16 bytes
	LogsWarning               chan string  // 16 bytes
	LogsError                 chan string  // 16 bytes
	SampleFrequency           float64      // 8 bytes
	SampleFrequencyChangeChan chan float64 // 8 bytes
	IsSleep                   bool         // 1 byte, at the end to avoid memory layout (7 bytes of padding)
	IsSleepChan               chan bool    // 1 byte, at the end to avoid memory layout (7 bytes of padding)
}

func NewSensorState

func NewSensorState(serialNumber string, SampleFrequency float64) *SensorState

func (*SensorState) HandleAwake

func (sensorState *SensorState) HandleAwake()

func (*SensorState) HandleChangeSampleFrequency

func (sensorState *SensorState) HandleChangeSampleFrequency(params map[string]interface{})

func (*SensorState) HandleSleep

func (sensorState *SensorState) HandleSleep()

type SineWave

type SineWave struct {
	Amplitude float64
	Frequency float64
	Phase     float64
}

func (*SineWave) Generate

func (sw *SineWave) Generate(dt float64) float64

Jump to

Keyboard shortcuts

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