C# 클래스 BrickPi.Brick

파일 보기 프로젝트 열기: Ellerbach/BrickPi 1 사용 예제들

공개 메소드들

메소드 설명
Brick ( ) : System

Initialize the brick, create the structure and setup the serial port

Brick ( SerialDevice myserial ) : System

Initialize the brick, create the structure and setup the serial port

Brick ( SerialDevice myserial, bool autostart ) : System

Initialize the birck, create the structure and setup the serial port

GetBrickVersion ( ) : int

Don't use in normal code, this will errase the sensor type use only for debug purpose

SetTimeout ( int timeout ) : void

Set brick timeout for motor to stop

SetupSensors ( ) : Task

Setup sensors. Don't use this function if the brick is started, only when not started

Start ( ) : void

Start reading the brick, getting info from sensors, moving motors

Stop ( ) : void

Stop the brick, stop all reading, writing, motor movement

UpdateValues ( ) : void

Update values. Don't use this function if the brick is started, only when not started

비공개 메소드들

메소드 설명
BrickPiChangeAddress ( byte OldAddr, byte NewAddr ) : Task

Used to change the address of the Ardunio WARNING: don't use it except if you really know what you are doing

BrickPiRx ( int timeout, int cancelAfter = CancelAfter ) : Task

Read data coming from the BrickPi

BrickPiSetTimeout ( ) : Task

Set a new timeout on the brick

BrickPiSetupSensors ( int idxArduino ) : Task

update the type of sensors. Needed to be able to change mode don't call directly this function, it will brak the running thread. Call it only thru the SetupSensros function.

BrickPiTx ( int dest, int byteCount, byte OutArray ) : void

Send data to the BrickPi

BrickPiUpdateValues ( ) : Task

Main function running in the main thread, checking all the time the status of sensors

CheckRetMessage ( byte InArray, byte msg, byte &OutArray, int OutArrayLength = 256 ) : bool

Check if the returned buffer is all correct

CloseDevice ( ) : void

CloseDevice: - Disposes SerialDevice object - Clears the enumerated device Id list

ContinuousUpdate ( IAsyncAction action ) : void

The main thread running all the time to check the sensor status

ReadAsync ( int timeout, CancellationToken cancellationToken ) : Task

ReadAsync: Task that waits on data and reads asynchronously from the serial device InputStream

SelectAndInitSerial ( SerialDevice myserial ) : Task

Initialize the Serial port, the BrickPi

SerialPort_ErrorReceived ( SerialDevice sender, ErrorReceivedEventArgs args ) : void

Used for debug only is any issue happen to the Serial port

UpdateButtons ( ) : void
sum ( int idxStart, int byteCount, byte arrayToCount ) : long

checksum calculator

메소드 상세

Brick() 공개 메소드

Initialize the brick, create the structure and setup the serial port
public Brick ( ) : System
리턴 System

Brick() 공개 메소드

Initialize the brick, create the structure and setup the serial port
public Brick ( SerialDevice myserial ) : System
myserial SerialDevice serial port to use
리턴 System

Brick() 공개 메소드

Initialize the birck, create the structure and setup the serial port
public Brick ( SerialDevice myserial, bool autostart ) : System
myserial SerialDevice serial port to use
autostart bool starts automatically the reading thread
리턴 System

GetBrickVersion() 공개 메소드

Don't use in normal code, this will errase the sensor type use only for debug purpose
public GetBrickVersion ( ) : int
리턴 int

SetTimeout() 공개 메소드

Set brick timeout for motor to stop
public SetTimeout ( int timeout ) : void
timeout int timeout in milliseconds
리턴 void

SetupSensors() 공개 메소드

Setup sensors. Don't use this function if the brick is started, only when not started
public SetupSensors ( ) : Task
리턴 Task

Start() 공개 메소드

Start reading the brick, getting info from sensors, moving motors
public Start ( ) : void
리턴 void

Stop() 공개 메소드

Stop the brick, stop all reading, writing, motor movement
public Stop ( ) : void
리턴 void

UpdateValues() 공개 메소드

Update values. Don't use this function if the brick is started, only when not started
public UpdateValues ( ) : void
리턴 void