controllers

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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,
	deviceDefSvc services.DeviceDefinitionsService, deviceTemplateService services.DeviceTemplateService, identityAPI gateways.IdentityAPI) DeviceConfigController

NewDeviceConfigController constructor

func (*DeviceConfigController) GetConfigStatusByEthAddr added in v0.7.1

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

GetConfigStatusByEthAddr godoc @Description Helps client determine if template (pids, dbc, settings) are up to date or not for the device with the given eth addr. @Tags device-config @Produce json @Success 200 {object} DeviceTemplateStatusResponse "Successfully retrieved configuration URLs" @Failure 404 "Not Found - we haven't seen this device yet, assume template not up to date" @Failure 400 "incorrect eth addr format" @Param ethAddr path string true "Ethereum Address" @Router /device-config/eth-addr/{ethAddr}/status [get]

func (*DeviceConfigController) GetConfigURLsFromEthAddr added in v0.3.2

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

GetConfigURLsFromEthAddr godoc @Description Retrieve the URLs for PID, DeviceSettings, and DBC configuration based on device's Ethereum Address. These could be empty if not configs available @Tags device-config @Produce json @Success 200 {object} appmodels.DeviceConfigResponse "Successfully retrieved configuration URLs" @Failure 404 "Not Found - No templates available for the given parameters" @Failure 400 "incorrect eth addr format" @Param ethAddr path string true "Ethereum Address" @Param protocol query string false "CAN Protocol, '6' or '7'" @Router /device-config/eth-addr/{ethAddr}/urls [get]

func (*DeviceConfigController) GetConfigURLsFromVIN added in v0.3.2

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

GetConfigURLsFromVIN godoc @Description Retrieve the URLs for PID, DeviceSettings, and DBC configuration based on a given VIN. These could be empty if not configs available @Tags device-config @Produce json @Success 200 {object} appmodels.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)" @Param protocol query string false "CAN Protocol, '6' or '7', 8,9,66,77,88,99" @Router /device-config/vin/{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 device-config @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/dbc/{templateName} [get]

func (*DeviceConfigController) GetDeviceSettingsByName added in v0.6.4

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

GetDeviceSettingsByName godoc @Description Fetches the device settings configurations from device_settings table given a name. Note that device settings mostly only vary by powertrain and @Description may or may not be attached to a specific template. To return protobuf: "application/x-protobuf" @Description Note that the templateName returned here is actually the device setting name @Tags device-config @Produce json @Produce application/x-protobuf @Success 200 {object} grpc.DeviceSetting "Successfully retrieved Device Settings" @Failure 404 "No Device Settings data found for the given name." @Param name path string true "name" @Router /device-config/settings/{name} [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 device-config @Produce json @Produce application/x-protobuf @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/pids/{templateName} [get]

func (*DeviceConfigController) PatchConfigStatusByEthAddr added in v0.7.1

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

PatchConfigStatusByEthAddr godoc @Description Set what template and/or firmware was applied. None of the properties are required. Will not be set if not passed in. @Tags device-config @Produce json @Success 200 "Successfully updated" @Failure 500 "unable to parse request or storage failure" @Param ethAddr path string true "Ethereum Address" @Param config body DeviceTemplateStatusPatch true "set any properties that were updated on the device" @Security BearerAuth @Router /device-config/eth-addr/{ethAddr}/status [patch]

func (*DeviceConfigController) PatchHwConfigStatusByEthAddr added in v0.10.0

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

PatchHwConfigStatusByEthAddr godoc @Description Set what template and/or firmware was applied. None of the properties are required. Will not be set if not passed in. Endpoint is meant only for hardware devices self-reporting their template update. @Tags device-config @Produce json @Success 200 "Successfully updated" @Failure 500 "unable to parse request or storage failure" @Param ethAddr path string true "Ethereum Address" @Param config body DeviceTemplateStatusPatch true "set any properties that were updated on the device" @Security SignatureAuth @Router /device-config/eth-addr/{ethAddr}/hw/status [patch]

type DeviceTemplateStatusPatch added in v0.7.1

type DeviceTemplateStatusPatch struct {
	// SettingsURL template settings url with version as returned from api
	SettingsURL *string `json:"settingsUrl"`
	// PidsURL template pids url with version as returned from api
	PidsURL *string `json:"pidsUrl"`
	// DBCFileURL template dbc file url with version as returned from api
	DbcURL *string `json:"dbcUrl"`
	// FirmwareVersionApplied version of firmware that was confirmed installed on device
	FirmwareVersionApplied *string `json:"firmwareVersionApplied"`
}

type DeviceTemplateStatusResponse added in v0.7.1

type DeviceTemplateStatusResponse struct {
	// IsTemplateUpToDate based on information we have, based on what was set last by mobile app
	IsTemplateUpToDate bool   `json:"isTemplateUpToDate"`
	FirmwareVersion    string `json:"firmwareVersion,omitempty"`
	IsFirmwareUpToDate bool   `json:"isFirmwareUpToDate"`
}

DeviceTemplateStatusResponse status on template and firmware versions

type JobResponse added in v0.6.2

type JobResponse struct {
	ID      string `json:"id"`
	Command string `json:"command"`
	Status  string `json:"status"`
}

type JobsController added in v0.6.2

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

func NewJobsController added in v0.6.2

func NewJobsController(settings *config.Settings, logger *zerolog.Logger, database *sql.DB, userDeviceSvc services.UserDeviceService, deviceDefSvc services.DeviceDefinitionsService) JobsController

NewJobsController constructor

func (*JobsController) GetJobsFromEthAddr added in v0.6.2

func (d *JobsController) GetJobsFromEthAddr(c *fiber.Ctx) error

GetJobsFromEthAddr godoc @Description Retrieve the jobs based on device's Ethereum Address. @Tags vehicle-signal-decoding @Produce json @Success 200 {object} JobResponse "Successfully retrieved jobs" @Failure 400 "incorrect eth addr format" @Param ethAddr path string false "Ethereum Address" @Router /device-config/eth-addr/{ethAddr}/jobs [get]

func (*JobsController) GetJobsPendingFromEthAddr added in v0.6.2

func (d *JobsController) GetJobsPendingFromEthAddr(c *fiber.Ctx) error

GetJobsPendingFromEthAddr godoc @Description Retrieve the jobs based on device's Ethereum Address. @Tags vehicle-signal-decoding @Produce json @Success 200 {object} JobResponse "Successfully retrieved jobs" @Failure 400 "incorrect eth addr format" @Param ethAddr path string false "Ethereum Address" @Router /device-config/eth-addr/{ethAddr}/jobs/pending [get]

func (*JobsController) PatchJobsFromEthAddr added in v0.6.2

func (d *JobsController) PatchJobsFromEthAddr(c *fiber.Ctx) error

PatchJobsFromEthAddr godoc @Description Path job status based on device's Ethereum Address. @Tags vehicle-signal-decoding @Produce json @Success 200 @Failure 404 "Not Found - No job found with id" @Failure 400 "incorrect eth addr format" @Param ethAddr path string false "Ethereum Address" @Param jobId path string false "Job ID" @Param status path string false "Status to set" @Router /device-config/eth-addr/{ethAddr}/jobs/{jobId}/{status} [patch]

Jump to

Keyboard shortcuts

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