Skip to content

Commit

Permalink
update signal id to timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
BK1031 committed Feb 13, 2025
1 parent 6ca0a17 commit 3c0a7cf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion message.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (f Field) ExportSignals() []Signal {

// DefaultSignalExportFunc is the default export function for a field. It exports the field as a single signal with no scaling.
func DefaultSignalExportFunc(f Field) []Signal {
return []Signal{Signal{
return []Signal{{
Name: f.Name,
Value: float64(f.Value),
RawValue: f.Value,
Expand Down
7 changes: 4 additions & 3 deletions signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ const (

// Signal is a type to represent an individual signal coming from the vehicle.
// This can be something like a sensor reading, a boolean flag, or a status code.
// Timestamp, VehicleID, and Name are together used to uniquely identify a signal row entry.
type Signal struct {
// ID is a unique identifier for the signal.
ID string `json:"id" gorm:"primaryKey"`
// Timestamp is the Unix microseconds of the signal.
Timestamp int `json:"timestamp"`
// VehicleID is the unique identifier for the vehicle that the signal is associated with.
VehicleID string `json:"vehicle_id"`
// Name represents the type of signal.
// Name represents the name of the signal.
Name string `json:"name"`
// Value is the value of the signal post-scaling.
Value float64 `json:"value"`
Expand Down

0 comments on commit 3c0a7cf

Please sign in to comment.