C# Класс AForge.Robotics.Lego.Internals.SerialCommunication

Implementation of serial communication interface with LEGO Mindstorm NXT brick.
Наследование: INXTCommunicationInterface
Показать файл Открыть проект

Открытые методы

Метод Описание
Connect ( ) : bool

Connect to NXT brick.

If communication interface was connected before the call, existing connection will be reused. If it is required to force reconnection, then Disconnect method should be called before.

Disconnect ( ) : void

Disconnect from NXT brick.

ReadMessage ( byte buffer, int &length ) : bool

Read message from NXT brick over the communication interface.

ReadMessage ( byte buffer, int offset, int &length ) : bool

Read message from NXT brick over the communication interface.

SendMessage ( byte message ) : bool

Send message to NXT brick over the communication interface.

This method assumes that message starts from the start of the specified buffer and occupies entire buffer.

SendMessage ( byte message, int length ) : bool

Send message to NXT brick over the communication interface.

This method assumes that message starts from the start of the specified buffer.

SendMessage ( byte message, int offset, int length ) : bool

Send message to NXT brick over the communication interface.

SerialCommunication ( string portName ) : System

Initializes a new instance of the SerialCommunication class.

This constructor initializes serial port with default write and read timeout values, which are 1000 milliseconds.

SerialCommunication ( string portName, int writeTimeout, int readTimeout ) : System

Initializes a new instance of the SerialCommunication class.

Описание методов

Connect() публичный Метод

Connect to NXT brick.
If communication interface was connected before the call, existing connection will be reused. If it is required to force reconnection, then Disconnect method should be called before.
public Connect ( ) : bool
Результат bool

Disconnect() публичный Метод

Disconnect from NXT brick.
public Disconnect ( ) : void
Результат void

ReadMessage() публичный Метод

Read message from NXT brick over the communication interface.
public ReadMessage ( byte buffer, int &length ) : bool
buffer byte Buffer to use for message reading.
length int On successful return the variable keeps message length.
Результат bool

ReadMessage() публичный Метод

Read message from NXT brick over the communication interface.
public ReadMessage ( byte buffer, int offset, int &length ) : bool
buffer byte Buffer to use for message reading.
offset int Offset in the buffer for message.
length int On successful return the variable keeps message length.
Результат bool

SendMessage() публичный Метод

Send message to NXT brick over the communication interface.
This method assumes that message starts from the start of the specified buffer and occupies entire buffer.
public SendMessage ( byte message ) : bool
message byte Buffer containing the message to send.
Результат bool

SendMessage() публичный Метод

Send message to NXT brick over the communication interface.
This method assumes that message starts from the start of the specified buffer.
public SendMessage ( byte message, int length ) : bool
message byte Buffer containing the message to send.
length int Length of the message to send.
Результат bool

SendMessage() публичный Метод

Send message to NXT brick over the communication interface.
public SendMessage ( byte message, int offset, int length ) : bool
message byte Buffer containing the message to send.
offset int Offset of the message in the buffer.
length int Length of the message to send.
Результат bool

SerialCommunication() публичный Метод

Initializes a new instance of the SerialCommunication class.
This constructor initializes serial port with default write and read timeout values, which are 1000 milliseconds.
public SerialCommunication ( string portName ) : System
portName string Serial port name to use for communication.
Результат System

SerialCommunication() публичный Метод

Initializes a new instance of the SerialCommunication class.
public SerialCommunication ( string portName, int writeTimeout, int readTimeout ) : System
portName string Serial port name to use for communication.
writeTimeout int Timeout value used for write operations.
readTimeout int Timeout value used for read operations.
Результат System