comfoconnect

package
v0.0.0-...-c582d63 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSearchGatewayResponse

func CreateSearchGatewayResponse(ipAddress string, uuid []byte) []byte

take an IP address, and a MAC address to respond with and create search gateway response

func DiscoverGateway

func DiscoverGateway(ip string) (uuid []byte, err error)

send a UDP packet to `ip` and expect a searchGatewayResponse with the uuid

func ReadBytes

func ReadBytes(conn net.Conn, size int) ([]byte, error)

func SpanSetMessage

func SpanSetMessage(span opentracing.Span, message Message)

Types

type BroadcastListener

type BroadcastListener struct {
	ResponseIP string
	// contains filtered or unexported fields
}

func NewBroadcastListener

func NewBroadcastListener(myIP string, myUUID []byte) *BroadcastListener

func (*BroadcastListener) Run

func (l *BroadcastListener) Run()

func (*BroadcastListener) Stop

func (l *BroadcastListener) Stop()

type Message

type Message struct {
	Src           []byte
	Dst           []byte
	Operation     proto.GatewayOperation
	RawMessage    []byte
	OperationType OperationType
	Span          opentracing.Span
}

func GetMessageFromSocket

func GetMessageFromSocket(conn net.Conn) (Message, error)

func (Message) CreateCustomResponse

func (m Message) CreateCustomResponse(span opentracing.Span, operationType proto.GatewayOperation_OperationType, operationTypeStruct OperationType) []byte

func (Message) CreateResponse

func (m Message) CreateResponse(span opentracing.Span, status proto.GatewayOperation_GatewayResult) []byte

creates the correct response message as a byte slice, for the parent message

func (Message) DecodePDO

func (m Message) DecodePDO() RpdoTypeConverter

func (Message) Encode

func (m Message) Encode() []byte

func (Message) String

func (m Message) String() string

type OperationType

type OperationType interface {
	XXX_Unmarshal([]byte) error
	XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
}

func GetStructForType

func GetStructForType(operationTypeString string) OperationType

takes the name for an operation type and finds the struct for it

type RpdoType0

type RpdoType0 struct {
	// contains filtered or unexported fields
}

func (RpdoType0) GetDescription

func (r RpdoType0) GetDescription() string

func (RpdoType0) GetID

func (r RpdoType0) GetID() string

func (RpdoType0) Tofloat64

func (r RpdoType0) Tofloat64() float64

type RpdoType1

type RpdoType1 struct {
	// contains filtered or unexported fields
}

func (RpdoType1) GetDescription

func (r RpdoType1) GetDescription() string

func (RpdoType1) GetID

func (r RpdoType1) GetID() string

func (RpdoType1) Tofloat64

func (r RpdoType1) Tofloat64() float64

type RpdoType2

type RpdoType2 struct {
	// contains filtered or unexported fields
}

func (RpdoType2) GetDescription

func (r RpdoType2) GetDescription() string

func (RpdoType2) GetID

func (r RpdoType2) GetID() string

func (RpdoType2) Tofloat64

func (r RpdoType2) Tofloat64() float64

type RpdoType3

type RpdoType3 struct {
	// contains filtered or unexported fields
}

func (RpdoType3) GetDescription

func (r RpdoType3) GetDescription() string

func (RpdoType3) GetID

func (r RpdoType3) GetID() string

func (RpdoType3) Tofloat64

func (r RpdoType3) Tofloat64() float64

type RpdoType6

type RpdoType6 struct {
	// contains filtered or unexported fields
}

func (RpdoType6) GetDescription

func (r RpdoType6) GetDescription() string

func (RpdoType6) GetID

func (r RpdoType6) GetID() string

func (RpdoType6) Tofloat64

func (r RpdoType6) Tofloat64() float64

type RpdoTypeConverter

type RpdoTypeConverter interface {
	Tofloat64() float64
	GetID() string
	GetDescription() string
}

func NewPpid

func NewPpid(ppid uint32, data []byte) RpdoTypeConverter

type Session

type Session struct {
	IP   string
	Src  []byte
	Dst  []byte
	Conn net.Conn
}

func NewSession

func NewSession(ctx context.Context, wg *sync.WaitGroup, comfoConnectIP string, pin uint32, src []byte) (*Session, error)

func (*Session) Close

func (s *Session) Close()

func (*Session) Receive

func (s *Session) Receive() (Message, error)

func (*Session) Send

func (s *Session) Send(message Message) error

Jump to

Keyboard shortcuts

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