github.com/jshiv/can-go@v0.2.1-0.20210224011015-069e90e90bdf/pkg/descriptor/message.go (about)

     1  package descriptor
     2  
     3  import "time"
     4  
     5  // Message describes a CAN message.
     6  type Message struct {
     7  	// Description of the message.
     8  	Name string
     9  	// ID of the message.
    10  	ID uint32
    11  	// IsExtended is true if the message is an extended CAN message.
    12  	IsExtended bool
    13  	// Length in bytes.
    14  	Length uint8
    15  	// SendType is the message's send type.
    16  	SendType SendType
    17  	// Description of the message.
    18  	Description string
    19  	// Signals in the message payload.
    20  	Signals []*Signal
    21  	// SenderNode is the name of the node sending the message.
    22  	SenderNode string
    23  	// CycleTime is the cycle time of a cyclic message.
    24  	CycleTime time.Duration
    25  	// DelayTime is the allowed delay between cyclic message sends.
    26  	DelayTime time.Duration
    27  }
    28  
    29  // MultiplexerSignal returns the message's multiplexer signal.
    30  func (m *Message) MultiplexerSignal() (*Signal, bool) {
    31  	for _, s := range m.Signals {
    32  		if s.IsMultiplexer {
    33  			return s, true
    34  		}
    35  	}
    36  	return nil, false
    37  }