Core Serial Library in C#  1.2
Public Member Functions | Public Attributes | List of all members
AsciiCommand Class Reference

A class to represent ASCII commands to be sent to Zaber devices. More...

Inheritance diagram for AsciiCommand:
Command

Public Member Functions

 AsciiCommand ()
 Create an empty command. More...
 
 AsciiCommand (string command)
 Parses the string "command" and creates a representation of that ASCII command. More...
 
 AsciiCommand (ZaberAsciiAxis targetAxis, string data)
 Create a new AsciiCommand for a specified ZaberAsciiAxis. More...
 
 AsciiCommand (byte deviceAddress, int axisNumber, string data)
 Create a new AsciiCommand from a specified set of arguments. More...
 
override bool Equals (object obj)
 Tests the equality of any object against this command. More...
 
override bool Equals (Command command)
 Checks to see if this command is equal to another Command. More...
 
bool Equals (AsciiCommand command)
 Checks whether this AsciiCommand is equal to another one. More...
 
override int GetHashCode ()
 Returns a hash code based off the command's attributes. More...
 
override string ToString ()
 Returns a human-readable representation of this command. More...
 

Public Attributes

int AxisNumber = 0
 The number of the axis to which to send a command, or 0 to send a command to all axes. More...
 
string Data = ""
 The data of the command to be sent to the device. More...
 
byte DeviceAddress
 The address of the device to which to send a command, or 0 to send a command to all devices on the chain. More...
 

Detailed Description

A class to represent ASCII commands to be sent to Zaber devices.

Constructor & Destructor Documentation

AsciiCommand ( )
inline

Create an empty command.

Data is set to the empty string instead of null by default, so this constructor can be used to quickly create the minimal ASCII command ("/\n").

AsciiCommand ( string  command)
inline

Parses the string "command" and creates a representation of that ASCII command.

Parameters
commandThe string to be parsed into a Command object.
AsciiCommand ( ZaberAsciiAxis  targetAxis,
string  data 
)
inline

Create a new AsciiCommand for a specified ZaberAsciiAxis.

This constructor is an alias for AsciiCommand( targetAxis.Parent.Address, targetAxis.Number, data). It is provided as a convenience.

Parameters
targetAxisThe axis to which to send this command.
dataThe data of the command to be sent, including command keywords and any command parameters.
AsciiCommand ( byte  deviceAddress,
int  axisNumber,
string  data 
)
inline

Create a new AsciiCommand from a specified set of arguments.

Parameters
deviceAddressThe address of the device to which to send this command.
axisNumberThe number of the axis to which to send this command.
dataThe data of the command to be sent, including command keywords and any command parameters.

Member Function Documentation

override bool Equals ( object  obj)
inlineinherited

Tests the equality of any object against this command.

Parameters
objThe object to be compared.
Returns
True if the object and this command are equal, false if they are inequal.
override bool Equals ( Command  command)
inlinevirtual

Checks to see if this command is equal to another Command.

Parameters
commandThe command to compare this one to.
Returns
True if the commands are equal, false if inequal.

Implements Command.

bool Equals ( AsciiCommand  command)
inline

Checks whether this AsciiCommand is equal to another one.

Equality is based on attribute equality, including mutable attributes. There is no guarantee that if a Command equals another at a certain time, it will always equal that other Command in the future.

Parameters
commandThe command to which to compare this one.
Returns
True if the commands are equal, false if they are inequal.
override int GetHashCode ( )
inlinevirtual

Returns a hash code based off the command's attributes.

The hash code returned by this function depends on all of the attributes of the object, including the mutable ones. This means that when using this class in a HashMap or similar structure, it should be considered immutable, or else it will be lost upon being changed.

Returns
The calculated hash code.

Implements Command.

override string ToString ( )
inlinevirtual

Returns a human-readable representation of this command.

This method will return the "encoded" string format of the command which should be sent to the device. This is also the format expected by the AsciiCommand constructor which takes one argument, a string.

Returns
A string representing the command.

Implements Command.

Member Data Documentation

int AxisNumber = 0

The number of the axis to which to send a command, or 0 to send a command to all axes.

Most commands must be sent to axis 0: only certain commands can be sent to particular axes. See the Zaber ASCII Protocol Manual for more info.

string Data = ""

The data of the command to be sent to the device.

The data string may contain one or more command keywords, as well as extra data related to that command.

byte DeviceAddress
inherited

The address of the device to which to send a command, or 0 to send a command to all devices on the chain.


The documentation for this class was generated from the following file: