figuring a way of having a clean internal interface for the data and other stuff I reckon. I forgot
This commit is contained in:
@@ -94,6 +94,7 @@ const (
|
||||
Gear
|
||||
MaxFields
|
||||
)
|
||||
const FirstField = Speed
|
||||
|
||||
var FieldNames = [MaxFields]string{
|
||||
Speed: "Speed",
|
||||
@@ -109,6 +110,20 @@ func GetFieldName(id FieldID) string {
|
||||
return FieldNames[id]
|
||||
}
|
||||
|
||||
var fieldNameToID map[string]FieldID
|
||||
|
||||
func initFieldNamesMap() {
|
||||
fieldNameToID = make(map[string]FieldID, MaxFields)
|
||||
for id, name := range FieldNames {
|
||||
fieldNameToID[name] = FieldID(id)
|
||||
}
|
||||
}
|
||||
|
||||
func GetFieldID(name string) (FieldID, bool) {
|
||||
id, ok := fieldNameToID[name]
|
||||
return id, ok
|
||||
}
|
||||
|
||||
// NOTE: Replace values with a more appropriate custom field approach where
|
||||
// every custom field only takes as many bytes as required
|
||||
// NOTE: Add the timing fields here to count frames of data gathering and whatnot
|
||||
|
||||
Reference in New Issue
Block a user