telemetryapi

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package telemetryapi provides functionality to interact with the telemetry GraphQL API.

Index

Constants

View Source
const (
	// DefaultTimeout is the default timeout for telemetry queries.
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func GenerateHistoricalQuery

func GenerateHistoricalQuery(signals []string) string

GenerateHistoricalQuery generates a GraphQL query for historical signals based on requested signal names.

func GenerateLatestSignalsQuery

func GenerateLatestSignalsQuery(signals []string) string

GenerateLatestSignalsQuery generates a GraphQL query for latest signals based on requested signal names.

Types

type Service

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

Service interacts with the telemetry GraphQL API.

func NewService

func NewService(apiBaseURL string, certPool *x509.CertPool) (*Service, error)

NewService creates a new instance of Service with optional TLS certificate pool.

func (*Service) GetHistoricalDataWithAuth

func (s *Service) GetHistoricalDataWithAuth(ctx context.Context, options TelemetryHistoricalOptions, jwtToken string) ([]Signal, error)

GetHistoricalDataWithAuth fetches historical telemetry data for a vehicle with JWT authentication.

func (*Service) GetLatestSignalsWithAuth

func (s *Service) GetLatestSignalsWithAuth(ctx context.Context, options TelemetryLatestOptions) ([]Signal, error)

GetLatestSignalsWithAuth fetches the latest telemetry signals for a vehicle with JWT authentication.

type Signal

type Signal struct {
	Name      string    `json:"name"`
	Value     any       `json:"value"`
	Timestamp time.Time `json:"timestamp"`
}

Signal represents a telemetry signal (for backward compatibility).

type SignalAggregations

type SignalAggregations struct {
	Timestamp                               time.Time `json:"timestamp"`
	CurrentLocationLatitude                 *float64  `json:"currentLocationLatitude"`
	CurrentLocationLongitude                *float64  `json:"currentLocationLongitude"`
	CurrentLocationApproximateLatitude      *float64  `json:"currentLocationApproximateLatitude"`
	CurrentLocationApproximateLongitude     *float64  `json:"currentLocationApproximateLongitude"`
	PowertrainTransmissionTravelledDistance *float64  `json:"powertrainTransmissionTravelledDistance"`
	Speed                                   *float64  `json:"speed"`
	ObdDTCList                              *string   `json:"obdDTCList"`
	ObdStatusDTCCount                       *float64  `json:"obdStatusDTCCount"`
	ChassisAxleRow1WheelLeftTirePressure    *float64  `json:"chassisAxleRow1WheelLeftTirePressure"`
	ChassisAxleRow1WheelRightTirePressure   *float64  `json:"chassisAxleRow1WheelRightTirePressure"`
	ChassisAxleRow2WheelLeftTirePressure    *float64  `json:"chassisAxleRow2WheelLeftTirePressure"`
	ChassisAxleRow2WheelRightTirePressure   *float64  `json:"chassisAxleRow2WheelRightTirePressure"`
}

SignalAggregations represents historical signal aggregations.

type SignalCollection

type SignalCollection struct {
	LastSeen                                time.Time     `json:"lastSeen"`
	CurrentLocationLatitude                 *SignalFloat  `json:"currentLocationLatitude"`
	CurrentLocationLongitude                *SignalFloat  `json:"currentLocationLongitude"`
	CurrentLocationApproximateLatitude      *SignalFloat  `json:"currentLocationApproximateLatitude"`
	CurrentLocationApproximateLongitude     *SignalFloat  `json:"currentLocationApproximateLongitude"`
	PowertrainTransmissionTravelledDistance *SignalFloat  `json:"powertrainTransmissionTravelledDistance"`
	Speed                                   *SignalFloat  `json:"speed"`
	ObdDTCList                              *SignalString `json:"obdDTCList"`
	ObdStatusDTCCount                       *SignalFloat  `json:"obdStatusDTCCount"`
	ChassisAxleRow1WheelLeftTirePressure    *SignalFloat  `json:"chassisAxleRow1WheelLeftTirePressure"`
	ChassisAxleRow1WheelRightTirePressure   *SignalFloat  `json:"chassisAxleRow1WheelRightTirePressure"`
	ChassisAxleRow2WheelLeftTirePressure    *SignalFloat  `json:"chassisAxleRow2WheelLeftTirePressure"`
	ChassisAxleRow2WheelRightTirePressure   *SignalFloat  `json:"chassisAxleRow2WheelRightTirePressure"`
}

SignalCollection represents the latest signals collection from telemetry API.

type SignalFloat

type SignalFloat struct {
	Timestamp time.Time `json:"timestamp"`
	Value     float64   `json:"value"`
}

SignalFloat represents a float signal with timestamp.

type SignalString

type SignalString struct {
	Timestamp time.Time `json:"timestamp"`
	Value     string    `json:"value"`
}

SignalString represents a string signal with timestamp.

type TelemetryHistoricalOptions

type TelemetryHistoricalOptions struct {
	TokenID   *big.Int  `json:"tokenId"`
	StartDate time.Time `json:"startDate,omitempty"`
	EndDate   time.Time `json:"endDate,omitempty"`
	Interval  string    `json:"interval,omitempty"`
	Signals   []string  `json:"signals,omitempty"`
}

TelemetryHistoricalOptions represents options for querying telemetry data.

type TelemetryLatestOptions

type TelemetryLatestOptions struct {
	TokenID  *big.Int `json:"tokenId"`
	JWTToken string   `json:"jwtToken"`
	Signals  []string `json:"signals"`
}

Jump to

Keyboard shortcuts

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