Documentation ¶
Overview ¶
Package flnet provides simple handling of FL-net protocol, implemented in the Go Programming Language.
THIS PROJECT IS STILL WIP.
Index ¶
Constants ¶
const ( TCDToken uint16 = iota + 65000 TCDCyclic TCDParticipationRequest TCDByteBlockReadRequest TCDByteBlockWriteRequest TCDWordBlockReadRequest TCDWordBlockWriteRequest TCDNetworkParameterReadRequest TCDNetworkParameterWriteRequest TCDStopCommandRequest TCDOperationCommandRequest TCDProfileReadRequest TCDTrigger )
TCD definitions.
Variables ¶
var ( ErrTooShortToMarshalBinary = errors.New("insufficient buffer to serialize parameter to") ErrTooShortToParse = errors.New("too short to decode as parameter") ErrNotImplemented = errors.New("not implemented") )
Error definitions.
Functions ¶
This section is empty.
Types ¶
type Cyclic ¶
type Cyclic struct { Header *FALinkHeader Data []byte }
Cyclic is a cyclic frame of FA Link frame.
func (*Cyclic) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a Cyclic.
func (*Cyclic) MarshalLen ¶
MarshalLen returns the serial length of Cyclic.
func (*Cyclic) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a cyclic frame.
type FALinkHeader ¶
type FALinkHeader struct { HType [4]byte TFL uint32 SA uint32 DA uint32 VSeq uint32 Seq uint32 MCTL uint32 ULS uint16 MSZ uint16 MADD uint32 MFT uint8 MRLT uint8 Reserved uint16 TCD uint16 Ver uint16 CAD1 uint16 CSZ1 uint16 CAD2 uint16 CSZ2 uint16 Mode uint16 PType uint8 Pri uint8 CBN uint8 TBN uint8 BSize uint16 LKS uint8 TW uint8 RCT uint16 }
FALinkHeader is a FL-net header.
func NewFALinkHeader ¶
func NewFALinkHeader( htype [4]byte, tfl uint32, sna uint8, dna uint8, vseq uint32, seq uint32, bct bool, ppt bool, rpl bool, uls uint16, msz uint16, madd uint32, mft uint8, mrlt uint8, reserved uint16, tcd uint16, ver uint16, cad1 uint16, csz1 uint16, cad2 uint16, csz2 uint16, minver uint, majver uint, tokmode bool, ptype uint8, pri uint8, cbn uint8, tbn uint8, bsize uint16, lks uint8, tw uint8, rct uint16, ) *FALinkHeader
NewFALinkHeader creates a new FALinkHeader.
func ParseHeader ¶
func ParseHeader(b []byte) (*FALinkHeader, error)
ParseHeader decodes given byte sequence as a FL-net common header.
func (*FALinkHeader) MarshalBinary ¶
func (h *FALinkHeader) MarshalBinary() ([]byte, error)
MarshalBinary returns the byte sequence generated from a FALinkHeader instance.
func (*FALinkHeader) MarshalLen ¶
func (h *FALinkHeader) MarshalLen() int
MarshalLen returns the serial length.
func (*FALinkHeader) MarshalTo ¶
func (h *FALinkHeader) MarshalTo(b []byte) error
MarshalTo puts the byte sequence in the byte array given as b.
func (*FALinkHeader) UnmarshalBinary ¶
func (h *FALinkHeader) UnmarshalBinary(b []byte) error
UnmarshalBinary sets the values retrieved from byte sequence in a FL-net common header.
type FLnet ¶
type FLnet interface { MarshalBinary() ([]byte, error) MarshalTo(b []byte) error MarshalLen() int UnmarshalBinary(b []byte) error }
FLnet is an interface that defines FL-net messages.
type ParticipationHeader ¶
type ParticipationHeader struct { Header *FALinkHeader NDN [10]byte VDN [10]byte MSN [10]byte Reserve uint16 }
ParticipationHeader is used for the commands of token participation.
func (*ParticipationHeader) MarshalBinary ¶
func (p *ParticipationHeader) MarshalBinary() ([]byte, error)
MarshalBinary returns the byte sequence generated from a participation header.
func (*ParticipationHeader) MarshalLen ¶
func (p *ParticipationHeader) MarshalLen() int
MarshalLen returns the serial length of Trigger
func (*ParticipationHeader) MarshalTo ¶
func (p *ParticipationHeader) MarshalTo(b []byte) error
MarshalTo puts the byte sequence in the byte array given as b.
func (*ParticipationHeader) UnmarshalBinary ¶
func (p *ParticipationHeader) UnmarshalBinary(b []byte) error
UnmarshalBinary sets the values retrieved from byte sequence in a participation header.
type ParticipationRequest ¶
type ParticipationRequest struct {
*ParticipationHeader
}
ParticipationRequest is a ParticipationRequest frame of FA Link frame.
func NewParticipationRequest ¶
func NewParticipationRequest(sna, dna uint8, vseq, seq uint32, ndn, vdn, msn string) *ParticipationRequest
NewParticipationRequest creates a new ParticipationRequest.
func (*ParticipationRequest) MarshalBinary ¶
func (p *ParticipationRequest) MarshalBinary() ([]byte, error)
MarshalBinary returns the byte sequence generated from a ParticipationRequest.
func (*ParticipationRequest) MarshalLen ¶
func (p *ParticipationRequest) MarshalLen() int
MarshalLen returns the serial length of ParticipationRequest
func (*ParticipationRequest) MarshalTo ¶
func (p *ParticipationRequest) MarshalTo(b []byte) error
MarshalTo puts the byte sequence in the byte array given as b.
func (*ParticipationRequest) UnmarshalBinary ¶
func (p *ParticipationRequest) UnmarshalBinary(b []byte) error
UnmarshalBinary sets the values retrieved from byte sequence in a ParticipationRequest frame.
type Token ¶
type Token struct {
Header *FALinkHeader
}
Token is a token frame of FA Link frame.
func (*Token) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a Token.
func (*Token) MarshalLen ¶
MarshalLen returns the serial length of Token.
func (*Token) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a FL-net common header.
type Trigger ¶
type Trigger struct {
*ParticipationHeader
}
Trigger is a trigger frame of FA Link frame.
func NewTrigger ¶
NewTrigger creates a new Trigger.
func (*Trigger) MarshalBinary ¶
MarshalBinary returns the byte sequence generated from a Trigger.
func (*Trigger) MarshalLen ¶
MarshalLen returns the serial length of Trigger
func (*Trigger) UnmarshalBinary ¶
UnmarshalBinary sets the values retrieved from byte sequence in a trigger frame.