Documentation ¶
Overview ¶
Package ingest helps to send measurement data to edgeimpulse for processing into a model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var IngestionBaseURL = "https://ingestion.edgeimpulse.com"
IngestionBaseURL is the default URL for uploading data.
Functions ¶
This section is empty.
Types ¶
type CollectPayload ¶
type CollectPayload struct { DeviceName string `json:"device_name,omitempty"` // Optional. DeviceType string `json:"device_type"` IntervalMS int64 `json:"interval_ms"` Sensors []Sensor `json:"sensors"` // All sensors in this payload. Values [][]float64 `json:"values"` // Values for each sensor. Each slice in Values must correspond to Sensors. }
CollectPayload is data to upload to EdgeImpulse for processing.
func (*CollectPayload) AddData ¶
func (p *CollectPayload) AddData(data []float64) error
AddData adds one set of measurements. One value for each sensor.
type Collector ¶
type Collector struct { HTTPClient *http.Client IngestionBaseURL string // contains filtered or unexported fields }
Collector holds account details like keys, and allows uploading payloads.
func NewCollector ¶
NewCollector makes a new Collector. The collectors baseURL is set based on environment variable EI_HOST if set (by prepending "https://ingestion."), otherwise defaulting to IngestionBaseURL. If you need custom HTTP handling, e.g. for proxy settings, you can override the default HTTPClient.
func (*Collector) Upload ¶
func (c *Collector) Upload(ctx context.Context, filename string, category string, payload CollectPayload, opts *UploadOpts) (string, error)
Upload sends the payload data to EdgeImpulse for ingestion. Upload returns the name of the sample as stored in EdgeImpulse Studio. For HTTP-related errors, the (wrapped) underlying errors from net/http or an HTTPError can be returned.
type HTTPError ¶
type HTTPError struct { Code int // HTTP status code, eg 401 or 500. Status string // Status message, either from body or the HTTP response status line. }
HTTPError represents an HTTP error code and message.
type UploadOpts ¶
UploadOpts holds payload upload options.