예제 #1
0
        /// <summary>
        /// Constructor. Initialises statuses and registered command array.
        /// </summary>
        /// <param name="port">The port which the RX engine is going to use to receive data from.</param>
        public Rx(Clide.Port port)
        {
            // Create new data table
            dataTable1 = new DataTable();

            statusArray.ok.id                               = StatusId_t.Ok;
            statusArray.ok.message                          = "O.K.";
            statusArray.dataIdDidNotMatch.id                = StatusId_t.DataIdDidNotMatch;
            statusArray.dataIdDidNotMatch.message           = "Data ID did not match.";
            statusArray.packetDecodingPassed.id             = StatusId_t.PacketDecodingPassed;
            statusArray.packetDecodingPassed.message        = "Packet successfully decoded.";
            statusArray.rxBufferOverflow.id                 = StatusId_t.RxBufferOverflow;
            statusArray.rxBufferOverflow.message            = "RX buffer overflow.";
            statusArray.unrecognisedCmd.id                  = StatusId_t.PacketDecodingFailed;
            statusArray.unrecognisedCmd.message             = "Received unrecognised command.";
            statusArray.packetUnexpectedlyTruncated.id      = StatusId_t.PacketUnexpectedlyTruncated;
            statusArray.packetUnexpectedlyTruncated.message = "Packet unexpectedly truncated.";
            statusArray.incorrectNumParameters.id           = StatusId_t.IncorrectNumParam;
            statusArray.incorrectNumParameters.message      = "Incorrect number of parameters.";

            // Instantiate registered commands
            _registeredCmds = new System.Collections.ObjectModel.Collection <Command>();

            _port = port;
        }
예제 #2
0
 /// <summary>
 /// Base constructor.
 /// </summary>
 /// <param name="port"></param>
 /// <param name="debugPrint">The function to call to pass debug information to.</param>
 public Tx(Clide.Port port, Action <string> debugPrint)
 {
     Port       = port;
     DebugPrint = debugPrint;
 }
예제 #3
0
 /// <summary>
 /// Simplified constructor. DebugPrint left as null.
 /// </summary>
 /// <param name="port"></param>
 public Tx(Clide.Port port)
 {
     _port = port;
 }
예제 #4
0
 /// <summary>
 /// Simplified constructor. Does not setup debug printing.
 /// </summary>
 public Controller()
 {
     Port = new Clide.Port();
     Tx   = new Clide.Tx(Port);
     Rx   = new Clide.Rx(Port);
 }
예제 #5
0
 /// <summary>
 /// Base constructor.
 /// </summary>
 /// <param name="debugPrint"></param>
 public Controller(Action <string> debugPrint)
 {
     Port = new Clide.Port();
     Tx   = new Clide.Tx(Port, debugPrint);
     Rx   = new Clide.Rx(Port);
 }