C# Class Serial, UnitySerialPort

Inheritance: UnrealBuildTool.ModuleRules
Afficher le fichier Open project: prossel/UnitySerialPort Class Usage Examples

Méthodes publiques

Свойство Type Description
EnableDebugInfos bool
NotifyData bool
NotifyLines bool
NotifyValues bool
RememberLines int
SkipFirstLine bool
ValuesSeparator char

Méthodes publiques

Méthode Description
ClearReceivedBytes ( ) : void

Clears the received bytes. Warning: This prevents line detection and notification. To be used when no \n is expected to avoid keeping unnecessary big amount of data in memory You should normally not call this function if \n are expected.

GetLastLine ( bool keepLines = false ) : string
GetLines ( bool keepLines = false ) : List
OnApplicationQuit ( ) : void
OnDisable ( ) : void
OnEnable ( ) : void
OnGUI ( ) : void
OnValidate ( ) : void
ReadSerialLoop ( ) : IEnumerator
ReadSerialLoopWin ( ) : IEnumerator
SimulateDataReceptionLn ( float data ) : void

Act as if the serial port has received data followed by a new line.

SimulateDataReceptionLn ( string data ) : void

Act as if the serial port has received data followed by a new line.

Start ( ) : void
Update ( ) : void
Write ( string message ) : void

Send data to the serial port.

WriteLn ( string message = "" ) : void

Send data to the serial port and append a new line character (\n)

checkOpen ( int portSpeed = 9600 ) : bool

Verify if the serial port is opened and opens it if necessary

Méthodes protégées

Méthode Description
receivedData ( string data ) : void

Private Methods

Méthode Description
GetPortName ( ) : string

Method Details

ClearReceivedBytes() public méthode

Clears the received bytes. Warning: This prevents line detection and notification. To be used when no \n is expected to avoid keeping unnecessary big amount of data in memory You should normally not call this function if \n are expected.
public ClearReceivedBytes ( ) : void
Résultat void

GetLastLine() public méthode

public GetLastLine ( bool keepLines = false ) : string
keepLines bool
Résultat string

GetLines() public méthode

public GetLines ( bool keepLines = false ) : List
keepLines bool
Résultat List

OnApplicationQuit() public méthode

public OnApplicationQuit ( ) : void
Résultat void

OnDisable() public méthode

public OnDisable ( ) : void
Résultat void

OnEnable() public méthode

public OnEnable ( ) : void
Résultat void

OnGUI() public méthode

public OnGUI ( ) : void
Résultat void

OnValidate() public méthode

public OnValidate ( ) : void
Résultat void

ReadSerialLoop() public méthode

public ReadSerialLoop ( ) : IEnumerator
Résultat IEnumerator

ReadSerialLoopWin() public méthode

public ReadSerialLoopWin ( ) : IEnumerator
Résultat IEnumerator

SimulateDataReceptionLn() public méthode

Act as if the serial port has received data followed by a new line.
public SimulateDataReceptionLn ( float data ) : void
data float
Résultat void

SimulateDataReceptionLn() public méthode

Act as if the serial port has received data followed by a new line.
public SimulateDataReceptionLn ( string data ) : void
data string
Résultat void

Start() public méthode

public Start ( ) : void
Résultat void

Update() public méthode

public Update ( ) : void
Résultat void

Write() public static méthode

Send data to the serial port.
public static Write ( string message ) : void
message string
Résultat void

WriteLn() public static méthode

Send data to the serial port and append a new line character (\n)
public static WriteLn ( string message = "" ) : void
message string
Résultat void

checkOpen() public static méthode

Verify if the serial port is opened and opens it if necessary
public static checkOpen ( int portSpeed = 9600 ) : bool
portSpeed int Port speed.
Résultat bool

receivedData() protected méthode

protected receivedData ( string data ) : void
data string
Résultat void

Property Details

EnableDebugInfos public_oe property

The enable debug infos. The first script with debug infos enabled will enable them until the program stop. Therefore, only one script need to enable the debug info to have them in all app, even with multiple scene and multiple instances, until the program stops.
public bool EnableDebugInfos
Résultat bool

NotifyData public_oe property

Enable notification of data as it arrives Sends OnSerialData(string data) message
public bool NotifyData
Résultat bool

NotifyLines public_oe property

Enable line detection and notification on received data. Message OnSerialLine(string line) is sent for every received line
public bool NotifyLines
Résultat bool

NotifyValues public_oe property

Enable lines detection, values separation and notification. Each line is split with the value separator (TAB by default) Sends Message OnSerialValues(string [] values)
public bool NotifyValues
Résultat bool

RememberLines public_oe property

Maximum number of lines to remember. Get them with GetLines() or GetLastLine()
public int RememberLines
Résultat int

SkipFirstLine public_oe property

Discard all received data until first line. Do not enable if you do not expect a \n as this would prevent the notification of any line or value. Data notification is not impacted by this parameter.
public bool SkipFirstLine
Résultat bool

ValuesSeparator public_oe property

The values separator.
public char ValuesSeparator
Résultat char