forked from einride/can-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.go
37 lines (34 loc) · 926 Bytes
/
message.go
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
26
27
28
29
30
31
32
33
34
35
36
37
package descriptor
import "time"
// Message describes a CAN message.
type Message struct {
// Description of the message.
Name string
// ID of the message.
ID uint32
// IsExtended is true if the message is an extended CAN message.
IsExtended bool
// Length in bytes.
Length uint8
// SendType is the message's send type.
SendType SendType
// Description of the message.
Description string
// Signals in the message payload.
Signals []*Signal
// SenderNode is the name of the node sending the message.
SenderNode string
// CycleTime is the cycle time of a cyclic message.
CycleTime time.Duration
// DelayTime is the allowed delay between cyclic message sends.
DelayTime time.Duration
}
// MultiplexerSignal returns the message's multiplexer signal.
func (m *Message) MultiplexerSignal() (*Signal, bool) {
for _, s := range m.Signals {
if s.IsMultiplexer {
return s, true
}
}
return nil, false
}