canopen

package module
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 16 Imported by: 0

README

go-canopen

GitHub Releasemain CI

Implement canopen protocol with https://github.com/angelodlfrtr/go-can

Port of https://github.com/christiansandberg/canopen written in Python

Installation

go get github.com/jaster-prj/go-canopen

Basic usage

package main

import (
  "github.com/angelodlfrtr/go-can"
  "github.com/angelodlfrtr/go-can/transports"
  "github.com/jaster-prj/go-canopen"
  "log"
)

func main() {
}

Documentation

Index

Constants

View Source
const (
	DicVar byte = 0x07
	DicArr byte = 0x08
	DicRec byte = 0x09
)
View Source
const (
	Boolean    byte = 0x1
	Integer8   byte = 0x2
	Integer16  byte = 0x3
	Integer32  byte = 0x4
	Integer64  byte = 0x15
	Unsigned8  byte = 0x5
	Unsigned16 byte = 0x6
	Unsigned32 byte = 0x7
	Unsigned64 byte = 0x1b

	Real32 byte = 0x8
	Real64 byte = 0x11

	VisibleString byte = 0x9
	OctetString   byte = 0xa
	UnicodeString byte = 0xb
	Domain        byte = 0xf
)
View Source
const (
	MapPDONotValid   int64 = 1 << 31
	MapRTRNotAllowed int   = 1 << 30
)
View Source
const (
	SDORequestUpload    uint8 = 2 << 5
	SDOResponseUpload   uint8 = 2 << 5
	SDORequestDownload  uint8 = 1 << 5
	SDOResponseDownload uint8 = 3 << 5

	SDORequestSegmentUpload    uint8 = 3 << 5
	SDOResponseSegmentUpload   uint8 = 0 << 5
	SDORequestSegmentDownload  uint8 = 0 << 5
	SDOResponseSegmentDownload uint8 = 1 << 5

	SDOExpedited     uint8 = 0x2
	SDOSizeSpecified uint8 = 0x1
	SDOToggleBit     uint8 = 0x10
	SDONoMoreData    uint8 = 0x1
)

Variables

View Source
var NMTCommandToState = map[int]int{
	1:   5,
	2:   4,
	80:  80,
	96:  96,
	128: 127,
	129: 0,
	130: 0,
}
View Source
var NMTCommands = map[string]int{
	"OPERATIONAL":         1,
	"STOPPED":             2,
	"SLEEP":               80,
	"STANDBY":             96,
	"PRE-OPERATIONAL":     128,
	"INITIALISING":        129,
	"RESET":               129,
	"RESET COMMUNICATION": 130,
}
View Source
var NMTStates = map[int]string{
	0:   "INITIALISING",
	4:   "STOPPED",
	5:   "OPERATIONAL",
	80:  "SLEEP",
	96:  "STANDBY",
	127: "PRE-OPERATIONAL",
}

Functions

func IsDataType

func IsDataType(t byte) bool

func IsFloatType

func IsFloatType(t byte) bool

func IsIntegerType

func IsIntegerType(t byte) bool

func IsNumberType

func IsNumberType(t byte) bool

func IsSignedType

func IsSignedType(t byte) bool

func IsStringType

func IsStringType(t byte) bool

func IsUnsignedType

func IsUnsignedType(t byte) bool

Types

type DicArray

type DicArray struct {
	Description string
	Index       uint16
	Name        string

	SDOClient *SDOClient

	SubIndexes map[uint8]DicObject
	SubNames   map[string]uint8
}

func (*DicArray) AddMember

func (array *DicArray) AddMember(object DicObject)

AddMember to SubIndexes

func (*DicArray) FindIndex

func (array *DicArray) FindIndex(index uint16) DicObject

func (*DicArray) FindName

func (array *DicArray) FindName(name string) DicObject

func (*DicArray) GetBoolVal

func (array *DicArray) GetBoolVal() *bool

func (*DicArray) GetByteVal

func (array *DicArray) GetByteVal() *byte

func (*DicArray) GetData

func (array *DicArray) GetData() []byte

func (*DicArray) GetDataLen

func (array *DicArray) GetDataLen() int

func (*DicArray) GetDataType

func (array *DicArray) GetDataType() byte

func (*DicArray) GetFloatVal

func (array *DicArray) GetFloatVal() *float64

func (*DicArray) GetIndex

func (array *DicArray) GetIndex() uint16

func (*DicArray) GetIntVal

func (array *DicArray) GetIntVal() *int64

func (*DicArray) GetName

func (array *DicArray) GetName() string

func (*DicArray) GetOffset

func (array *DicArray) GetOffset() int

func (*DicArray) GetStringVal

func (array *DicArray) GetStringVal() *string

func (*DicArray) GetSubIndex

func (array *DicArray) GetSubIndex() uint8

func (*DicArray) GetUintVal

func (array *DicArray) GetUintVal() *uint64

func (*DicArray) IsDicVariable

func (array *DicArray) IsDicVariable() bool

func (*DicArray) Read

func (array *DicArray) Read() error

func (*DicArray) Save

func (array *DicArray) Save() error

func (*DicArray) SetBoolVal

func (array *DicArray) SetBoolVal(a bool)

func (*DicArray) SetByteVal

func (array *DicArray) SetByteVal(a byte)

func (*DicArray) SetData

func (array *DicArray) SetData(data []byte)

func (*DicArray) SetFloatVal

func (array *DicArray) SetFloatVal(a float64)

func (*DicArray) SetIntVal

func (array *DicArray) SetIntVal(a int64)

func (*DicArray) SetOffset

func (array *DicArray) SetOffset(s int)

func (*DicArray) SetSDO

func (array *DicArray) SetSDO(sdo *SDOClient)

func (*DicArray) SetSize

func (array *DicArray) SetSize(s int)

func (*DicArray) SetStringVal

func (array *DicArray) SetStringVal(a string)

func (*DicArray) SetUintVal

func (array *DicArray) SetUintVal(a uint64)

type DicObject

type DicObject interface {
	GetIndex() uint16
	GetSubIndex() uint8
	GetName() string
	AddMember(DicObject)
	FindIndex(uint16) DicObject
	FindName(string) DicObject

	GetDataType() byte
	GetDataLen() int

	SetSize(int)
	SetOffset(int)
	GetOffset() int

	Read() error
	Save() error

	GetData() []byte
	SetData([]byte)

	GetStringVal() *string
	GetFloatVal() *float64
	GetUintVal() *uint64
	GetIntVal() *int64
	GetBoolVal() *bool
	GetByteVal() *byte

	SetStringVal(string)
	SetFloatVal(float64)
	SetUintVal(uint64)
	SetIntVal(int64)
	SetBoolVal(bool)
	SetByteVal(byte)

	IsDicVariable() bool
	SetSDO(*SDOClient)
}

type DicObjectDic

type DicObjectDic struct {
	Baudrate int
	NodeID   int

	// Map of Object ids to objects
	Indexes map[uint16]DicObject

	// Index to map objects names to objects indexs
	NamesIndex map[string]uint16
}

func DicEDSParse

func DicEDSParse(in interface{}) (*DicObjectDic, error)

DicEDSParse If in is string, it must be a path to a file else if in must be eds data as []byte

func DicMustParse

func DicMustParse(a *DicObjectDic, err error) *DicObjectDic

func NewDicObjectDic

func NewDicObjectDic() *DicObjectDic

func (*DicObjectDic) AddObject

func (objectDic *DicObjectDic) AddObject(object DicObject)

func (*DicObjectDic) FindIndex

func (objectDic *DicObjectDic) FindIndex(index uint16) DicObject

func (*DicObjectDic) FindName

func (objectDic *DicObjectDic) FindName(name string) DicObject

type DicRecord

type DicRecord struct {
	Description string
	Index       uint16
	Name        string

	SDOClient *SDOClient

	SubIndexes map[uint8]DicObject
	SubNames   map[string]uint8
}

func (*DicRecord) AddMember

func (record *DicRecord) AddMember(object DicObject)

AddMember to DicRecord

func (*DicRecord) FindIndex

func (record *DicRecord) FindIndex(index uint16) DicObject

FindIndex find by index a DicObject in DicRecord

func (*DicRecord) FindName

func (record *DicRecord) FindName(name string) DicObject

FindName find by name a DicObject in DicRecord

func (*DicRecord) GetBoolVal

func (record *DicRecord) GetBoolVal() *bool

func (*DicRecord) GetByteVal

func (record *DicRecord) GetByteVal() *byte

func (*DicRecord) GetData

func (record *DicRecord) GetData() []byte

func (*DicRecord) GetDataLen

func (record *DicRecord) GetDataLen() int

func (*DicRecord) GetDataType

func (record *DicRecord) GetDataType() byte

func (*DicRecord) GetFloatVal

func (record *DicRecord) GetFloatVal() *float64

func (*DicRecord) GetIndex

func (record *DicRecord) GetIndex() uint16

GetIndex of DicRecord

func (*DicRecord) GetIntVal

func (record *DicRecord) GetIntVal() *int64

func (*DicRecord) GetName

func (record *DicRecord) GetName() string

GetName of DicRecord

func (*DicRecord) GetOffset

func (record *DicRecord) GetOffset() int

func (*DicRecord) GetStringVal

func (record *DicRecord) GetStringVal() *string

func (*DicRecord) GetSubIndex

func (record *DicRecord) GetSubIndex() uint8

GetSubIndex not applicable

func (*DicRecord) GetUintVal

func (record *DicRecord) GetUintVal() *uint64

func (*DicRecord) IsDicVariable

func (record *DicRecord) IsDicVariable() bool

func (*DicRecord) Read

func (record *DicRecord) Read() error

func (*DicRecord) Save

func (record *DicRecord) Save() error

func (*DicRecord) SetBoolVal

func (record *DicRecord) SetBoolVal(a bool)

func (*DicRecord) SetByteVal

func (record *DicRecord) SetByteVal(a byte)

func (*DicRecord) SetData

func (record *DicRecord) SetData(data []byte)

func (*DicRecord) SetFloatVal

func (record *DicRecord) SetFloatVal(a float64)

func (*DicRecord) SetIntVal

func (record *DicRecord) SetIntVal(a int64)

func (*DicRecord) SetOffset

func (record *DicRecord) SetOffset(s int)

func (*DicRecord) SetSDO

func (record *DicRecord) SetSDO(sdo *SDOClient)

SetSDO to DicRecord

func (*DicRecord) SetSize

func (record *DicRecord) SetSize(s int)

func (*DicRecord) SetStringVal

func (record *DicRecord) SetStringVal(a string)

func (*DicRecord) SetUintVal

func (record *DicRecord) SetUintVal(a uint64)

type DicVariable

type DicVariable struct {
	Unit        string
	Factor      int
	Min         int
	Max         int
	Default     []byte
	DataType    byte
	AccessType  string
	Description string

	SDOClient *SDOClient

	Data   []byte
	Offset int
	Size   int

	Index    uint16
	SubIndex uint8
	Name     string

	ValueDescriptions map[string]string
	BitDefinitions    map[string][]byte
}

func (*DicVariable) AddBitDefinition

func (variable *DicVariable) AddBitDefinition(name string, bits []byte)

func (*DicVariable) AddMember

func (variable *DicVariable) AddMember(object DicObject)

func (*DicVariable) AddValueDescription

func (variable *DicVariable) AddValueDescription(name string, des string)

func (*DicVariable) FindIndex

func (variable *DicVariable) FindIndex(index uint16) DicObject

func (*DicVariable) FindName

func (variable *DicVariable) FindName(name string) DicObject

func (*DicVariable) GetBoolVal

func (variable *DicVariable) GetBoolVal() *bool

func (*DicVariable) GetByteVal

func (variable *DicVariable) GetByteVal() *byte

func (*DicVariable) GetData

func (variable *DicVariable) GetData() []byte

func (*DicVariable) GetDataLen

func (variable *DicVariable) GetDataLen() int

func (*DicVariable) GetDataType

func (variable *DicVariable) GetDataType() byte

func (*DicVariable) GetFloatVal

func (variable *DicVariable) GetFloatVal() *float64

func (*DicVariable) GetIndex

func (variable *DicVariable) GetIndex() uint16

func (*DicVariable) GetIntVal

func (variable *DicVariable) GetIntVal() *int64

func (*DicVariable) GetName

func (variable *DicVariable) GetName() string

func (*DicVariable) GetOffset

func (variable *DicVariable) GetOffset() int

func (*DicVariable) GetStringVal

func (variable *DicVariable) GetStringVal() *string

func (*DicVariable) GetSubIndex

func (variable *DicVariable) GetSubIndex() uint8

func (*DicVariable) GetUintVal

func (variable *DicVariable) GetUintVal() *uint64

func (*DicVariable) IsDicVariable

func (variable *DicVariable) IsDicVariable() bool

func (*DicVariable) IsDomainDataType

func (variable *DicVariable) IsDomainDataType() bool

func (*DicVariable) Read

func (variable *DicVariable) Read() error

Read variable value using SDO

func (*DicVariable) Save

func (variable *DicVariable) Save() error

Save variable.Data using SDO

func (*DicVariable) SetBoolVal

func (variable *DicVariable) SetBoolVal(a bool)

func (*DicVariable) SetByteVal

func (variable *DicVariable) SetByteVal(a byte)

func (*DicVariable) SetData

func (variable *DicVariable) SetData(data []byte)

func (*DicVariable) SetFloatVal

func (variable *DicVariable) SetFloatVal(a float64)

func (*DicVariable) SetIntVal

func (variable *DicVariable) SetIntVal(a int64)

func (*DicVariable) SetOffset

func (variable *DicVariable) SetOffset(s int)

func (*DicVariable) SetSDO

func (variable *DicVariable) SetSDO(sdo *SDOClient)

func (*DicVariable) SetSize

func (variable *DicVariable) SetSize(s int)

func (*DicVariable) SetStringVal

func (variable *DicVariable) SetStringVal(a string)

func (*DicVariable) SetUintVal

func (variable *DicVariable) SetUintVal(a uint64)

func (*DicVariable) Write

func (variable *DicVariable) Write(data []byte) error

Write variable value using SDO

type INode added in v0.0.16

type INode interface {
	GetId() int
	FindName(name string) DicObject
	Send(arbID uint32, data []byte) error
	AcquireFramesChanFromNetwork(filterFunc networkFramesChanFilterFunc) *NetworkFramesChan
	ReleaseFramesChanFromNetwork(id string)
}

type ISDOClient

type ISDOClient interface {
	FindName(name string) DicObject
	Read(index uint16, subIndex uint8) ([]byte, error)
	Send(req []byte, expectFunc networkFramesChanFilterFunc, timeout *time.Duration, retryCount *int) (*can.Frame, error)
	SendRequest(req []byte) error
	Write(index uint16, subIndex uint8, forceSegment bool, data []byte) error
}

type NMTChangeChan

type NMTChangeChan struct {
	C chan NMTState
	// contains filtered or unexported fields
}

type NMTMaster

type NMTMaster struct {
	NodeID        int
	Network       *Network
	State         int
	StateReceived *int
	Timestamp     *time.Time
	Listening     bool

	ChangeChans []*NMTChangeChan
	// contains filtered or unexported fields
}

func NewNMTMaster

func NewNMTMaster(nodeID int, network *Network) *NMTMaster

NewNMTMaster return a new instance of Master

func (*NMTMaster) AcquireChangesChan

func (master *NMTMaster) AcquireChangesChan() *NMTChangeChan

AcquireChangesChan create a new NMTChangeChan

func (*NMTMaster) GetStateString

func (master *NMTMaster) GetStateString() string

GetStateString for target node

func (*NMTMaster) ListenForHeartbeat

func (master *NMTMaster) ListenForHeartbeat() error

ListenForHeartbeat listen message on network

func (*NMTMaster) ReleaseChangesChan

func (master *NMTMaster) ReleaseChangesChan(id string) error

ReleaseChangesChan release (close) a NMTChangeChan

func (*NMTMaster) SendCommand

func (master *NMTMaster) SendCommand(code int) error

SendCommand to target node

func (*NMTMaster) SetState

func (master *NMTMaster) SetState(cmd string) error

SetState for target node, and send command

func (*NMTMaster) UnlistenForHeartbeat

func (master *NMTMaster) UnlistenForHeartbeat() error

UnlistenForHeartbeat listen message on network

func (*NMTMaster) WaitForBootup

func (master *NMTMaster) WaitForBootup(timeout *time.Duration) error

WaitForBootup return when the node has *StateReceived == 0 with a default timeout of 10s

type NMTState

type NMTState struct {
	NodeID    int
	State     int
	Timestamp *time.Time
}

type Network

type Network struct {
	// mutex for FramesChans access
	sync.Mutex

	// Bus is the go-can bus
	Bus can.Bus

	// Nodes contain the network nodes
	Nodes map[int]*Node

	// FramesChans contains a list of chan when is sent each frames from network bus.
	FramesChans []*NetworkFramesChan

	// NMTMaster contain nmt control struct
	NMTMaster *NMTMaster

	// BusReadErrChan @TODO on go-can
	BusReadErrChan chan error
	// contains filtered or unexported fields
}

Network represent the global nodes network

func NewNetwork

func NewNetwork(bus can.Bus) (*Network, error)

NewNetwork a new Network with given bus

func (*Network) AcquireFramesChan

func (network *Network) AcquireFramesChan(filterFunc networkFramesChanFilterFunc) *NetworkFramesChan

AcquireFramesChan create a new FrameChan

func (*Network) AddNode

func (network *Network) AddNode(node *Node, objectDic *DicObjectDic, uploadEDS bool) *Node

AddNode add a node to the network

func (*Network) GetNode

func (network *Network) GetNode(nodeID int) (*Node, error)

GetNode by node id. Return error if node dont exist in network.Nodes

func (*Network) ReleaseFramesChan

func (network *Network) ReleaseFramesChan(id string)

ReleaseFramesChan release (close) a FrameChan

func (*Network) Run

func (network *Network) Run() error

Run listen handlers for frames on bus

func (*Network) Search

func (network *Network) Search(limit int, timeout time.Duration) ([]*Node, error)

Search send data to network and wait for nodes response

func (*Network) Send

func (network *Network) Send(arbID uint32, data []byte) error

Send a frame on network

func (*Network) Stop

func (network *Network) Stop() error

Stop handlers for frames on bus

type NetworkFramesChan

type NetworkFramesChan struct {
	ID     string
	C      chan *can.Frame
	Filter networkFramesChanFilterFunc
}

NetworkFramesChan contain a Chan, and ID and a Filter function Each FrameChan can have a filter function which return a boolean, and for each frame, the filter func is called. If func return true, the frame is returned, else dont send frame.

func (*NetworkFramesChan) Publish

func (networkFramesCh *NetworkFramesChan) Publish(frm *can.Frame)

type Node

type Node struct {
	// Each node has an id, which is ArbitrationID & 0x7F
	ID int

	Network   *Network
	ObjectDic *DicObjectDic

	SDOClient *SDOClient
	PDONode   *PDONode
	NMTMaster *NMTMaster
}

Node is a canopen node

func NewNode

func NewNode(id int, network *Network, objectDic *DicObjectDic) *Node

func (*Node) AcquireFramesChanFromNetwork added in v0.0.16

func (node *Node) AcquireFramesChanFromNetwork(filterFunc networkFramesChanFilterFunc) *NetworkFramesChan

AcquireFramesChanFromNetwork gets new Channel for given FilterFunc

func (*Node) FindName added in v0.0.16

func (node *Node) FindName(name string) DicObject

FindName gets DicObject from ObjectDic

func (*Node) GetId added in v0.0.16

func (node *Node) GetId() int

GetId returns Node ID

func (*Node) Init

func (node *Node) Init()

Init create sdo clients, pdo nodes, nmt master

func (*Node) ReleaseFramesChanFromNetwork added in v0.0.16

func (node *Node) ReleaseFramesChanFromNetwork(id string)

ReleaseFramesChanFromNetwork free channel with given id from network

func (*Node) Send added in v0.0.16

func (node *Node) Send(arbID uint32, data []byte) error

Send sends Frame with arbitration ID by connected network

func (*Node) SetNetwork

func (node *Node) SetNetwork(network *Network)

SetNetwork set node.Network to the desired network

func (*Node) SetObjectDic

func (node *Node) SetObjectDic(objectDic *DicObjectDic)

SetObjectDic set node.ObjectDic to the desired ObjectDic

func (*Node) Stop

func (node *Node) Stop()

Stop node

type PDOMap

type PDOMap struct {
	sync.Mutex

	PDONode   *PDONode
	ComRecord DicObject
	MapArray  DicObject

	Enabled    bool
	CobID      int
	RTRAllowed bool
	TransType  byte
	EventTimer byte

	Map map[int]DicObject

	OldData []byte
	Data    []byte

	Timestamp *time.Time
	Period    *time.Duration

	IsReceived bool

	ChangeChans []*PDOMapChangeChan
	// contains filtered or unexported fields
}

func NewPDOMap

func NewPDOMap(pdoNode *PDONode, comRecord, mapArray DicObject) *PDOMap

NewPDOMap return a PDOMap initialized

func (*PDOMap) AcquireChangesChan

func (m *PDOMap) AcquireChangesChan() *PDOMapChangeChan

AcquireChangesChan create a new PDOMapChangeChan

func (*PDOMap) FindIndex

func (m *PDOMap) FindIndex(idx int) DicObject

FindIndex find a object by index

func (*PDOMap) FindName

func (m *PDOMap) FindName(name string) DicObject

FindName find a object by name

func (*PDOMap) GetTotalSize

func (m *PDOMap) GetTotalSize() int

GetTotalSize of a map

func (*PDOMap) Listen

func (m *PDOMap) Listen() error

Listen for changes on map from network

func (*PDOMap) Read

func (m *PDOMap) Read() error

Read map values

func (*PDOMap) RebuildData

func (m *PDOMap) RebuildData()

RebuildData rebuild map data object from map variables

func (*PDOMap) ReleaseChangesChan

func (m *PDOMap) ReleaseChangesChan(id string) error

ReleaseChangesChan release (close) a PDOMapChangeChan

func (*PDOMap) Save

func (m *PDOMap) Save() error

Save pdo map @TODO: Not Working, DO NOT USE

func (*PDOMap) SetData

func (m *PDOMap) SetData(data []byte)

func (*PDOMap) Transmit

func (m *PDOMap) Transmit(rebuild bool) error

Transmit map data

func (*PDOMap) Unlisten

func (m *PDOMap) Unlisten()

Unlisten for changes on map from network

func (*PDOMap) UpdateDataSize

func (m *PDOMap) UpdateDataSize()

type PDOMapChangeChan

type PDOMapChangeChan struct {
	ID string
	C  chan []byte
}

type PDOMaps

type PDOMaps struct {
	PDONode *PDONode
	Maps    map[int]*PDOMap
}

PDOMaps define a PDO map

func NewPDOMaps

func NewPDOMaps(comOffset, mapOffset int, pdoNode *PDONode) *PDOMaps

NewPDOMaps create a new Maps

func (*PDOMaps) FindIndex

func (maps *PDOMaps) FindIndex(idx int) *PDOMap

FindIndex a map by index

func (*PDOMaps) FindName

func (maps *PDOMaps) FindName(name string) *PDOMap

FindName a map

type PDONode

type PDONode struct {
	Node *Node
	RX   *PDOMaps
	TX   *PDOMaps
}

func NewPDONode

func NewPDONode(n *Node) *PDONode

func (*PDONode) FindName

func (node *PDONode) FindName(name string) *PDOMap

func (*PDONode) Read

func (node *PDONode) Read() error

func (*PDONode) Save

func (node *PDONode) Save() error

type SDOClient

type SDOClient struct {
	Node      INode
	RXCobID   uint32
	TXCobID   uint32
	SendQueue []string
}

SDOClient represent an SDO client

func NewSDOClient

func NewSDOClient(node INode) *SDOClient

func (*SDOClient) FindName

func (sdoClient *SDOClient) FindName(name string) DicObject

FindName find an sdo object from object dictionary by name

func (*SDOClient) Read

func (sdoClient *SDOClient) Read(index uint16, subIndex uint8) ([]byte, error)

Read sdo

func (*SDOClient) Send

func (sdoClient *SDOClient) Send(
	req []byte,
	expectFunc networkFramesChanFilterFunc,
	timeout *time.Duration,
	retryCount *int,
) (*can.Frame, error)

Send message and optionaly wait for response

func (*SDOClient) SendRequest

func (sdoClient *SDOClient) SendRequest(req []byte) error

SendRequest to network bus

func (*SDOClient) Write

func (sdoClient *SDOClient) Write(index uint16, subIndex uint8, forceSegment bool, data []byte) error

Write sdo

type SDOReader

type SDOReader struct {
	SDOClient *SDOClient
	Index     uint16
	SubIndex  uint8
	Toggle    uint8
	Pos       int
	Size      uint32
	Data      []byte
}

func NewSDOReader

func NewSDOReader(sdoClient *SDOClient, index uint16, subIndex uint8) *SDOReader

func (*SDOReader) Read

func (reader *SDOReader) Read() (*can.Frame, error)

Read segmented uploads

func (*SDOReader) ReadAll

func (reader *SDOReader) ReadAll() ([]byte, error)

ReadAll ..

func (*SDOReader) RequestUpload

func (reader *SDOReader) RequestUpload() ([]byte, error)

RequestUpload returns data if EXPEDITED, else nil

type SDOWriter

type SDOWriter struct {
	SDOClient    ISDOClient
	Index        uint16
	SubIndex     uint8
	Toggle       uint8
	Pos          int
	Size         uint32
	ForceSegment bool
}

func NewSDOWriter

func NewSDOWriter(sdoClient ISDOClient, index uint16, subIndex uint8, forceSegment bool) *SDOWriter

func (*SDOWriter) RequestDownload

func (writer *SDOWriter) RequestDownload(data []byte) error

RequestDownload returns data if EXPEDITED, else nil

func (*SDOWriter) Write

func (writer *SDOWriter) Write(data []byte) error

Write data to sdo client

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL