controllers

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProtobufToJSON

func ProtobufToJSON(message proto.Message) (string, error)

ProtobufToJSON converts a Protobuf message to its JSON representation.

Types

type DeviceConfigController

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

func NewDeviceConfigController

func NewDeviceConfigController(settings *config.Settings, logger *zerolog.Logger, database *sql.DB, userDeviceSvc services.UserDeviceService) DeviceConfigController

NewDeviceConfigController constructor

func (*DeviceConfigController) GetConfigURLs

func (d *DeviceConfigController) GetConfigURLs(c *fiber.Ctx) error

GetConfigURLs godoc @Description Retrieve the URLs for PID, DeviceSettings, and DBC configuration based on a given VIN @Tags vehicle-signal-decoding @Produce json @Success 200 {object} DeviceConfigResponse "Successfully retrieved configuration URLs" @Failure 404 "Not Found - No templates available for the given parameters" @Param vin path string true "vehicle identification number (VIN)" @Router /device-config/{vin}/urls [get]

func (*DeviceConfigController) GetDBCFileByTemplateName

func (d *DeviceConfigController) GetDBCFileByTemplateName(c *fiber.Ctx) error

GetDBCFileByTemplateName godoc @Description Fetches the DBC file from the dbc_files table given a template name @Tags vehicle-signal-decoding @Produce plain @Success 200 {string} string "Successfully retrieved DBC file" @Failure 404 "No DBC file found for the given template name." @Param templateName path string true "template name" @Router /device-config/{templateName}/dbc [get]

func (*DeviceConfigController) GetDeviceSettingsByTemplate

func (d *DeviceConfigController) GetDeviceSettingsByTemplate(c *fiber.Ctx) error

GetDeviceSettingsByTemplate godoc @Description Fetches the device settings configurations from device_settings table given a template name @Tags vehicle-signal-decoding @Produce json @Success 200 {object} DeviceSetting "Successfully retrieved Device Settings" @Failure 404 "No Device Settings data found for the given template name." @Param templateName path string true "template name" @Router /device-config/{templateName}/deviceSettings [get]

func (*DeviceConfigController) GetPIDsByTemplate

func (d *DeviceConfigController) GetPIDsByTemplate(c *fiber.Ctx) error

GetPIDsByTemplate godoc @Description Retrieves a list of PID configurations from the database given a template name @Tags vehicle-signal-decoding @Produce json @Success 200 {object} grpc.PIDRequests "Successfully retrieved PID Configurations" @Failure 404 "No PID Config data found for the given template name." @Param templateName path string true "template name" @Router /device-config/{templateName}/pids [get]

type DeviceConfigResponse added in v0.2.8

type DeviceConfigResponse struct {
	PidURL           string `json:"pidUrl"`
	DeviceSettingURL string `json:"deviceSettingUrl"`
	DbcURL           string `json:"dbcURL"`
	Version          string `json:"version"`
}

type DeviceSetting

type DeviceSetting struct {
	ID                                     int64     `json:"id"`
	TemplateName                           string    `json:"template_name"`
	BatteryCriticalLevelVoltage            string    `json:"battery_critical_level_voltage"`
	SafetyCutOutVoltage                    string    `json:"safety_cut_out_voltage"`
	SleepTimerEventDrivenInterval          string    `json:"sleep_timer_event_driven_interval"`
	SleepTimerEventDrivenPeriod            string    `json:"sleep_timer_event_driven_period"`
	SleepTimerInactivityAfterSleepInterval string    `json:"sleep_timer_inactivity_after_sleep_interval"`
	SleepTimerInactivityFallbackInterval   string    `json:"sleep_timer_inactivity_fallback_interval"`
	WakeTriggerVoltageLevel                string    `json:"wake_trigger_voltage_level"`
	CreatedAt                              time.Time `json:"created_at"`
	UpdatedAt                              time.Time `json:"updated_at"`
}

type PIDConfig

type PIDConfig struct {
	ID              int64  `json:"id"`
	TemplateName    string `json:"template_name,omitempty"`
	Header          []byte `json:"header"`
	Mode            []byte `json:"mode"`
	Pid             []byte `json:"pid"`
	Formula         string `json:"formula"`
	IntervalSeconds int    `json:"interval_seconds"`
	Protocol        string `json:"protocol,omitempty"`
}

Jump to

Keyboard shortcuts

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