ipccommon

package
v0.0.0-...-91f4ae2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IpcCmdNotification     = 0x01 // S => C: Text messages to the client
	IpcCmdResponse         = 0x02 // S => C: Response to a IPC_CMD
	IpcCmdError            = 0x03 // S => C: Exceptions that should be raised in the client
	IpcCmdGetServerVersion = 0x04 // C => S: Get the version of this application
	IpcCmdGetPowType       = 0x05 // C => S: Get the name of the used POW implementation (e.g. PiDiver)
	IpcCmdGetPowVersion    = 0x06 // C => S: Get the version of the used POW implementation (e.g. PiDiver FPGA Core Version)
	IpcCmdPowFunc          = 0x07 // C => S: Do POW

	// Different states of the receivement of the frame via interprocess communication
	FrameStateSearchEnq     byte = 1 // FrameStateSearchEnq: Search the Start byte of the frame
	FrameStateSearchVersion byte = 2 // Search the Version byte of the frame
	FrameStateSearchLength  byte = 3 // Search the length information of the frame
	FrameStateSearchData    byte = 4 // Search all the data embedded in the frame
	FrameStateSearchCRC     byte = 5 // Search the CRC checksum of the embedded data
)

Variables

Functions

This section is empty.

Types

type IpcFrameV1

type IpcFrameV1 struct {
	ReqID      byte   `struc:"byte"`
	Command    byte   `struc:"byte"`
	DataLength int    `struc:"uint16,sizeof=Data"`
	Data       []byte `struc:"[]byte"`
}

IpcFrameV1 contains the information of the IPC communication

func BytesToIpcFrameV1

func BytesToIpcFrameV1(data []byte) (*IpcFrameV1, error)

BytesToIpcFrameV1 converts a byte slice to an IpcFrameV1

func (*IpcFrameV1) ToBytes

func (f *IpcFrameV1) ToBytes() ([]byte, error)

ToBytes converts an IpcFrameV1 to a byte slice

type IpcMessage

type IpcMessage struct {
	StartByte    byte   `struc:"byte"`
	FrameVersion byte   `struc:"byte"`
	FrameLength  int    `struc:"uint16,sizeof=FrameData"`
	FrameData    []byte `struc:"[]byte"`
	CRC8         byte   `struc:"byte"`
}

IpcMessage is the container of an IPC frame with additional communication control data

func BytesToIpcMessage

func BytesToIpcMessage(data []byte) (*IpcMessage, error)

BytesToIpcMessage converts a byte slice to an IpcMessage

func NewIpcMessageV1

func NewIpcMessageV1(requestID byte, command byte, data []byte) (*IpcMessage, error)

NewIpcMessageV1 creates a new IpcFrameV1 embedded in an IpcMessage

func (*IpcMessage) ToBytes

func (m *IpcMessage) ToBytes() ([]byte, error)

ToBytes converts an IpcMessage to a byte slice

Jump to

Keyboard shortcuts

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