Model Railroad System
2.2.1
|
#include <mrd.h>
Classes | |
union | status1_union |
Status byte 1 union type. More... | |
union | status2_union |
Status byte 2 union type. More... | |
Public Member Functions | |
~MRD () | |
Base destructor. More... | |
ErrorCode | SetChan1 () const |
Set channel 1 relays and status bits. More... | |
ErrorCode | SetChan2 () const |
Set channel 2 relays and status bits. More... | |
ErrorCode | ClearExternallyChanged () const |
Clear ‘ExternallyChanged’ status bit. More... | |
ErrorCode | DisableExternal () const |
Disable external changes of turnout state. More... | |
ErrorCode | EnableExternal () const |
Enable external changes of turnout state. More... | |
ErrorCode | Identify_2 () const |
Identify 2. More... | |
ErrorCode | Identify_1_2 () const |
Identify 1 and 2. More... | |
ErrorCode | ResetStopwatch () const |
Reset Stopwatch. More... | |
bool | Sense_1 () const |
Sensor one active. More... | |
bool | Sense_2 () const |
Sensor two active. More... | |
bool | Latch_1 () const |
Latch one. More... | |
bool | Latch_2 () const |
Latch two. More... | |
bool | HasRelays () const |
Has Relays? More... | |
bool | ResetStatus () const |
Reset status? More... | |
bool | StopwatchTicking () const |
Stopwatch Ticking? More... | |
bool | ExternallyChanged () const |
Externally changed? More... | |
bool | AllowingExternalChanges () const |
Allowing External Changes? More... | |
OperatingMode_Type | OperatingMode () const |
Operating mode. More... | |
void | Stopwatch (uint8_t &fract, uint8_t &seconds, uint8_t &minutes, uint8_t &hours) const |
Stopwatch time. More... | |
![]() | |
~Azatrax () | |
Base destructor. More... | |
ErrorCode | RestoreLEDFunction () const |
Restore LED function. More... | |
ErrorCode | Identify_1 () const |
Identify 1. More... | |
ErrorCode | GetStateData () |
Get State Data. More... | |
uint8_t | PacketCount () const |
Packet count. More... | |
const char * | SerialNumber () const |
Serial Number. More... | |
const char * | MyProduct () const |
My product name. More... | |
unsigned short int | MyProductId () const |
My product code. More... | |
Protected Member Functions | |
MRD (const char *serialnumber, char **outmessage=NULL) | |
Base constructor. More... | |
![]() | |
Azatrax (const char *serialnumber, unsigned short int idProduct, char **outmessage=NULL) | |
Base constructor. More... | |
ErrorCode | sendByte (uint8_t commandByte) const |
Send a command byte. More... | |
ErrorCode | send2Bytes (uint8_t commandByte, uint8_t byte2) const |
Send a command byte with 1 data byte. More... | |
ErrorCode | send3Bytes (uint8_t commandByte, uint8_t byte2, uint8_t byte3) const |
Send a command bytewith 2 data bytes. More... | |
Friends | |
class | Azatrax |
Additional Inherited Members | |
![]() | |
static int | NumberOfOpenDevices () |
Open device count. More... | |
static char ** | AllConnectedDevices () |
List serial numbers of all connected devices. More... | |
static Azatrax * | OpenDevice (const char *serialnumber, unsigned short int idProduct=0, char **outmessage=NULL) |
Open an Azatrax device by serial number. More... | |
static unsigned short int | ProductIdCode (const char *productName) |
Product id code. More... | |
![]() | |
static bool | IsThisTheAzatraxWeAreLookingFor (libusb_device *dev, const char *serialnumber, unsigned short int idProduct) |
Is this the device we want? More... | |
static unsigned short int | GetProductId (libusb_device *dev, const char *serialnumber, unsigned short int idProductMatch=0) |
Return the matching product id for this device and serial number. More... | |
![]() | |
struct libusb_device_handle * | handle |
USB Device Handle. More... | |
char | mySerialNumber [10] |
Serial number buffer. More... | |
unsigned short int | myProductId |
Product id. More... | |
struct azatrax::Azatrax::StateDataPacket | stateDataPacket |
![]() | |
static int | deviceOpenCount |
Device open count. More... | |
MRD I/O Class.
MRD interface class.
This class implements the interface logic for a MRD2-S or MRD2-U device.
The constructor opens a connection to a MRD2-S or MRD2-U device, given its serial number. Each MRD2-S or MRD2-U device has a unique, factory defined serial number, which is printed on a sticker attached to the module. This serial number is much like the MAC address of an Ethernet interface. The destructor closes the connection to the device and frees any resources allocated.
The class provides methods to send commands to the device, read back its state and interrogate the state read back. This way each class instance encapsulates each device instance.
|
inlineprotected |
Base constructor.
serialnumber | The serial number of the device to open. |
outmessage | To hold an error message, if any. |
|
inline |
Base destructor.
|
inline |
Allowing External Changes?
References azatrax::MRD::status2_union::allowExternalChanges, azatrax::Azatrax::stateDataPacket, azatrax::Azatrax::StateDataPacket::status2, azatrax::MRD::status2_union::theBits, and azatrax::MRD::status2_union::theByte.
|
inline |
Clear ‘ExternallyChanged’ status bit.
Clear ‘ExternallyChanged’ status bit (data packet byte 2).
References azatrax::Azatrax::cmd_ClearExternallyChanged, and azatrax::Azatrax::sendByte().
|
inline |
Disable external changes of turnout state.
Disable external changes of turnout state (-S only).
References azatrax::Azatrax::cmd_DisableExternal, and azatrax::Azatrax::sendByte().
|
inline |
Enable external changes of turnout state.
Enable external changes of turnout state (-S only).
References azatrax::Azatrax::cmd_EnableExternal, and azatrax::Azatrax::sendByte().
|
inline |
|
inline |
|
inline |
Identify 1 and 2.
Identify 1 and 2 - Flashes sensor 1 and 2 LEDs.
References azatrax::Azatrax::cmd_Identify_1_2, and azatrax::Azatrax::sendByte().
|
inline |
Identify 2.
Identify 2 - Flashes sensor 2's LED.
References azatrax::Azatrax::cmd_Identify_2, and azatrax::Azatrax::sendByte().
|
inline |
|
inline |
|
inline |
Operating mode.
Returns the operating mode.
References azatrax::Azatrax::StateDataPacket::operatingMode, and azatrax::Azatrax::stateDataPacket.
|
inline |
|
inline |
Reset Stopwatch.
ResetStopwatch - Stops the stopwatch and resets time to 0.
References azatrax::Azatrax::cmd_ResetStopwatch, and azatrax::Azatrax::sendByte().
|
inline |
|
inline |
|
inline |
Set channel 1 relays and status bits.
Sets the relays and status bits as it a train activated channel 1 (-S, turnour mode only).
References azatrax::Azatrax::cmd_SetChan1, and azatrax::Azatrax::sendByte().
|
inline |
Set channel 2 relays and status bits.
Sets the relays and status bits as it a train activated channel 2 (-S, turnour mode only).
References azatrax::Azatrax::cmd_SetChan2, and azatrax::Azatrax::sendByte().
|
inline |
Stopwatch time.
Returns the current Stopwatch time.
fract | 1/100s of a second. |
seconds | Whole seconds. |
minutes | Whole minutes. |
hours | Whole hours. |
References azatrax::Azatrax::stateDataPacket, azatrax::Azatrax::StateDataPacket::stopwatchHours, and azatrax::Azatrax::StateDataPacket::stopwatchMinutes.
|
inline |
|
friend |