Tanoda
|
Public Member Functions | |
string | ReadSerialMessage () |
void | SendSerialMessage (string message) |
delegate void | TearDownFunction () |
void | SetTearDownFunction (TearDownFunction userFunction) |
Public Attributes | |
string | portName = "COM3" |
int | baudRate = 9600 |
GameObject | messageListener |
int | reconnectionDelay = 1000 |
int | maxUnreadMessages = 1 |
Static Public Attributes | |
const string | SERIAL_DEVICE_CONNECTED = "__Connected__" |
const string | SERIAL_DEVICE_DISCONNECTED = "__Disconnected__" |
Protected Attributes | |
Thread | thread |
SerialThreadLines | serialThread |
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 26 of file SerialController.cs.
string SerialController.ReadSerialMessage | ( | ) |
Definition at line 134 of file SerialController.cs.
void SerialController.SendSerialMessage | ( | string | message | ) |
Definition at line 144 of file SerialController.cs.
void SerialController.SetTearDownFunction | ( | TearDownFunction | userFunction | ) |
Definition at line 156 of file SerialController.cs.
delegate void SerialController.TearDownFunction | ( | ) |
int SerialController.baudRate = 9600 |
Definition at line 33 of file SerialController.cs.
int SerialController.maxUnreadMessages = 1 |
Definition at line 45 of file SerialController.cs.
GameObject SerialController.messageListener |
Definition at line 37 of file SerialController.cs.
string SerialController.portName = "COM3" |
Definition at line 30 of file SerialController.cs.
int SerialController.reconnectionDelay = 1000 |
Definition at line 41 of file SerialController.cs.
|
static |
Definition at line 52 of file SerialController.cs.
|
static |
Definition at line 53 of file SerialController.cs.
|
protected |
Definition at line 57 of file SerialController.cs.
|
protected |
Definition at line 56 of file SerialController.cs.