-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathidentification.go
More file actions
25 lines (22 loc) · 828 Bytes
/
identification.go
File metadata and controls
25 lines (22 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package calibrationReader
import (
"errors"
"github.com/asap2Go/calibrationReader/a2l"
"github.com/rs/zerolog/log"
)
// getDistOpX retrieves the identifier in the deposit structure according to its layout
// specified within the record layout and their values as calibrated in the hex file
func (cd *CalibrationData) getIdentification(rl *a2l.RecordLayout, curPos *uint32) (interface{}, error) {
if !rl.Identification.DatatypeSet {
err := errors.New("identification datatype not set")
log.Err(err).Msg("could not retrieve identification value")
return nil, err
}
val, err := cd.getValue(curPos, rl.Identification.Datatype, rl)
if err != nil {
log.Err(err).Msg("could not retrieve identification value")
return nil, err
}
*curPos += uint32(rl.Identification.Datatype.GetDatatypeLength())
return val, err
}