Tanoda
SerialControllerBytes Class Reference
Inheritance diagram for SerialControllerBytes:

Classes

struct  PoseReturn
 

Public Member Functions

string ReadSerialMessage ()
 
void SendSerialMessage (byte[] message)
 
delegate void TearDownFunction ()
 
void SetTearDownFunction (TearDownFunction userFunction)
 
void SendGripperOff ()
 
void ResetSavedPositions ()
 
void SavePosition ()
 
void SavePositionsToFile ()
 

Static Public Member Functions

static string ByteArrayToString (byte[] ba)
 
static T[] ConcatArrays< T > (params T[][] list)
 
static byte CalculateChecksum (byte[] payload)
 
static unsafe PoseReturn GetPoseFromArray (byte[] buffer)
 

Public Attributes

string portName = "COM7"
 
int baudRate = 115200
 
GameObject messageListener
 
int reconnectionDelay = 1000
 
int maxUnreadMessages = 1
 
float x
 
float y
 
float z
 
float r
 

Static Public Attributes

const string SERIAL_DEVICE_CONNECTED = "__Connected__"
 
const string SERIAL_DEVICE_DISCONNECTED = "__Disconnected__"
 

Protected Attributes

Thread thread
 
SerialThreadBytes serialThread
 

Detailed Description

This class allows a Unity program to continually check for messages from a serial device.

It creates a Thread that communicates with the serial port and continually polls the messages on the wire. That Thread puts all the messages inside a Queue, and this SerialController class polls that queue by means of invoking SerialThread.GetSerialMessage().

The serial device must send its messages separated by a newline character. Neither the SerialController nor the SerialThread perform any validation on the integrity of the message. It's up to the one that makes sense of the data.

Definition at line 34 of file SerialControllerBytes.cs.

Member Function Documentation

◆ ByteArrayToString()

static string SerialControllerBytes.ByteArrayToString ( byte[]  ba)
static

Definition at line 157 of file SerialControllerBytes.cs.

◆ CalculateChecksum()

static byte SerialControllerBytes.CalculateChecksum ( byte[]  payload)
static

Definition at line 218 of file SerialControllerBytes.cs.

◆ ConcatArrays< T >()

static T[] SerialControllerBytes.ConcatArrays< T > ( params T  list[][])
static

Definition at line 205 of file SerialControllerBytes.cs.

◆ GetPoseFromArray()

static unsafe PoseReturn SerialControllerBytes.GetPoseFromArray ( byte[]  buffer)
static

Definition at line 334 of file SerialControllerBytes.cs.

◆ ReadSerialMessage()

string SerialControllerBytes.ReadSerialMessage ( )

Definition at line 230 of file SerialControllerBytes.cs.

◆ ResetSavedPositions()

void SerialControllerBytes.ResetSavedPositions ( )

Definition at line 299 of file SerialControllerBytes.cs.

◆ SavePosition()

void SerialControllerBytes.SavePosition ( )

Definition at line 305 of file SerialControllerBytes.cs.

◆ SavePositionsToFile()

void SerialControllerBytes.SavePositionsToFile ( )

Definition at line 311 of file SerialControllerBytes.cs.

◆ SendGripperOff()

void SerialControllerBytes.SendGripperOff ( )

Definition at line 280 of file SerialControllerBytes.cs.

◆ SendSerialMessage()

void SerialControllerBytes.SendSerialMessage ( byte[]  message)

Definition at line 240 of file SerialControllerBytes.cs.

◆ SetTearDownFunction()

void SerialControllerBytes.SetTearDownFunction ( TearDownFunction  userFunction)

Definition at line 253 of file SerialControllerBytes.cs.

◆ TearDownFunction()

delegate void SerialControllerBytes.TearDownFunction ( )

Member Data Documentation

◆ baudRate

int SerialControllerBytes.baudRate = 115200

Definition at line 41 of file SerialControllerBytes.cs.

◆ maxUnreadMessages

int SerialControllerBytes.maxUnreadMessages = 1

Definition at line 53 of file SerialControllerBytes.cs.

◆ messageListener

GameObject SerialControllerBytes.messageListener

Definition at line 45 of file SerialControllerBytes.cs.

◆ portName

string SerialControllerBytes.portName = "COM7"

Definition at line 38 of file SerialControllerBytes.cs.

◆ r

float SerialControllerBytes.r

Definition at line 162 of file SerialControllerBytes.cs.

◆ reconnectionDelay

int SerialControllerBytes.reconnectionDelay = 1000

Definition at line 49 of file SerialControllerBytes.cs.

◆ SERIAL_DEVICE_CONNECTED

const string SerialControllerBytes.SERIAL_DEVICE_CONNECTED = "__Connected__"
static

Definition at line 60 of file SerialControllerBytes.cs.

◆ SERIAL_DEVICE_DISCONNECTED

const string SerialControllerBytes.SERIAL_DEVICE_DISCONNECTED = "__Disconnected__"
static

Definition at line 61 of file SerialControllerBytes.cs.

◆ serialThread

SerialThreadBytes SerialControllerBytes.serialThread
protected

Definition at line 65 of file SerialControllerBytes.cs.

◆ thread

Thread SerialControllerBytes.thread
protected

Definition at line 64 of file SerialControllerBytes.cs.

◆ x

float SerialControllerBytes.x

Definition at line 162 of file SerialControllerBytes.cs.

◆ y

float SerialControllerBytes.y

Definition at line 162 of file SerialControllerBytes.cs.

◆ z

float SerialControllerBytes.z

Definition at line 162 of file SerialControllerBytes.cs.


The documentation for this class was generated from the following file: