예제 #1
0
        // Callback function that prints that the Arduino has experienced an error
        void OnError(ReceivedCommand arguments)
        {
            var unique_id = arguments.ReadUInt16Arg();
            var box       = arguments.ReadUInt16Arg();
            var error     = arguments.ReadUInt16Arg();

            Console.WriteLine("ID:{0} Error on Box:{1}, Error:{2:X}", unique_id, box, error);
        }
예제 #2
0
        // Callback function that prints that the Arduino has acknowledged
        void OnJobComplete(ReceivedCommand arguments)
        {
            JobCompleteCount++;
            var unique_id = arguments.ReadUInt16Arg();
            var box       = arguments.ReadUInt16Arg();
            var fed       = arguments.ReadUInt16Arg();

            Console.WriteLine("ID:{0} Job Complete on Box:{1}, Fed:{2}", unique_id, box, fed);
        }
예제 #3
0
        // Callback function that prints a message from the arduino
        void OnPrintMessage(ReceivedCommand arguments)
        {
            var unique_id = arguments.ReadUInt16Arg();
            var box       = arguments.ReadUInt16Arg();
            var message   = arguments.ReadStringArg();

            Console.WriteLine("Controller {0}, Box:{1}, PrintMessage:{2}", unique_id, box, message);
            Ready = true;
        }
예제 #4
0
        public void SendPrintCommand(UInt16 box, UInt16 to_feed)
        {
            Console.WriteLine("Sending Print command to box {0} and feed {1}", box, to_feed);
            // Send the command, wait for 1s for the the acknowledge command
            SendCommand command = new SendCommand((int)Command.Print, (int)Command.AcknowledgePrint, 1000);

            command.AddArgument(box);
            command.AddArgument(to_feed);

            ReceivedCommand rec_command = _cmdMessenger.SendCommand(command);

            var unique_id = rec_command.ReadUInt16Arg();

            box     = rec_command.ReadUInt16Arg();
            to_feed = rec_command.ReadUInt16Arg();

            Console.WriteLine("Acknowledge Print command with unique id {0} to box {1} and feed {2}", unique_id, box, to_feed);
        }
예제 #5
0
        public void SendConnectCommand(UInt16 box_id)
        {
            Console.WriteLine("Sending Connect command with unique id {0}", box_id);

            // Send the command, wait for 1s for the the acknowledge command
            SendCommand command = new SendCommand((int)Command.Connect, box_id, (int)Command.AcknowledgeConnect, 1000);

            _cmdMessenger.SendCommand(command);

            ReceivedCommand rec_command = _cmdMessenger.SendCommand(command);

            if (rec_command.Ok)
            {
                var unique_id = rec_command.ReadUInt16Arg();

                Console.WriteLine("Acknowledge Connect command with unique id {0}", unique_id);
            }
            else
            {
                Console.WriteLine("Bad messages");
            }
        }