C# Class Solar.Car.CanUsbHardware

A customized SerialPort, with support for our BUGGY CAN-USB cable. * asynchronously reads lines from a SerialPort, firing the LineReceived event. * locks the SerialPort for all reading and writing. * drains the SerialPort Read buffer when closing (WARNING this can infinite loop)
Inheritance: ICanUsbHardware
Mostra file Open project: nusolar/sc6-telemetry-code

Public Methods

Method Description
CanUsbHardware ( ) : System

Initializes a new instance of the SolarCar.SyncSerialPort class.

Close ( ) : void

Releases the SerialPort and performs other cleanup operations before the SolarCar.SyncSerialPort is reclaimed by garbage collection.

Dispose ( ) : void
LockReadData ( ) : void

Event Handler for this.port's SerialPort.DataReceived event. Acquires the SerialPort, reads data into buffer. It is invoked on a separate thread by SerialPort. Lines terminated by the NewLine character are passed to the LineReceivedDelegate.

LockWriteLine ( string line ) : void

Acquire the SerialPort, and write a line.

Open ( ) : void

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Method Details

CanUsbHardware() public method

Initializes a new instance of the SolarCar.SyncSerialPort class.
public CanUsbHardware ( ) : System
return System

Close() public method

Releases the SerialPort and performs other cleanup operations before the SolarCar.SyncSerialPort is reclaimed by garbage collection.
public Close ( ) : void
return void

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

LockReadData() public method

Event Handler for this.port's SerialPort.DataReceived event. Acquires the SerialPort, reads data into buffer. It is invoked on a separate thread by SerialPort. Lines terminated by the NewLine character are passed to the LineReceivedDelegate.
public LockReadData ( ) : void
return void

LockWriteLine() public method

Acquire the SerialPort, and write a line.
public LockWriteLine ( string line ) : void
line string Line.
return void

Open() public method

public Open ( ) : void
return void