recorder

package module
v0.0.0-...-9991f3a Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RecordTypes = struct {
	Battery,
	Temperature,
	Humidity,
	PowerOn,
	Load RecordType
}{
	Battery:     "Battery",
	Temperature: "Temperature",
	Humidity:    "Humidity",
	PowerOn:     "PowerOn",
	Load:        "Load",
}

Functions

func HandleFunc

func HandleFunc(w http.ResponseWriter, r *http.Request)

Types

type AdStructure

type AdStructure struct {
	Time          time.Time
	DeviceAddress string
	AdType        int
	Data          string
}

type BigQueryRecorder

type BigQueryRecorder struct {
	// contains filtered or unexported fields
}

func NewBigQueryRecorder

func NewBigQueryRecorder(ctx context.Context, projectID string) (*BigQueryRecorder, error)

func (*BigQueryRecorder) Close

func (r *BigQueryRecorder) Close()

func (*BigQueryRecorder) Record

func (r *BigQueryRecorder) Record(ctx context.Context, records []Record) error

type DevicesSchema

type DevicesSchema struct {
	StatusCode int `json:"statusCode"`
	Body       struct {
		DeviceList []struct {
			DeviceId           string `json:"deviceId"`
			DeviceName         string `json:"deviceName"`
			DeviceType         string `json:"deviceType"`
			EnableCloudService bool   `json:"enableCloudService"`
			HubDeviceId        string `json:"hubDeviceId"`
		} `json:"deviceList"`
		InfraredRemoteList []struct {
			DeviceId    string `json:"deviceId"`
			DeviceName  string `json:"deviceName"`
			RemoteType  string `json:"remoteType"`
			HubDeviceId string `json:"hubDeviceId"`
		} `json:"infraredRemoteList"`
	} `json:"body"`
	Message string `json:"message"`
}

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser() *Parser

func (*Parser) ParseMessage

func (p *Parser) ParseMessage(msg string) ([]Record, error)

type Record

type Record struct {
	Time     time.Time
	DeviceId string
	Type     RecordType
	Value    float32
}

type RecordType

type RecordType string

type Recorder

type Recorder interface {
	Record(ctx context.Context, r []Record) error
	Close()
}

type StdoutRecorder

type StdoutRecorder struct{}

func NewStdoutRecorder

func NewStdoutRecorder() *StdoutRecorder

func (*StdoutRecorder) Close

func (r *StdoutRecorder) Close()

func (*StdoutRecorder) Record

func (r *StdoutRecorder) Record(ctx context.Context, records []Record) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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