示例#1
0
        private void _Send(CommandFrame frame, Callback responseCallback = null)
        {
            this.responseCallback = responseCallback;

            try
            {
                conn.Send(frame.ToArray());
            }
            catch (HardwareException e)
            {
                this.responseCallback?.Invoke(null, e);
            }
        }
示例#2
0
        /// <summary>
        /// Send a command with no response call back
        /// </summary>
        /// <typeparam name="T">Type of command to send</typeparam>
        /// <param name="parameters">Parameters of the command</param>
        public void SendCommand <T>(params object[] parameters) where T : Command
        {
            CommandFrame frame = new CommandFrame((Command)Activator.CreateInstance(typeof(T), parameters));

            _Send(frame);
        }
示例#3
0
        /// <summary>
        /// Send a command to the Tappy
        /// </summary>
        /// <param name="command">Command to send</param>
        /// <param name="responseCallback">Method to be called when a data is receieved or a error has occurred</param>
        public void SendCommand(Command command, Callback responseCallback = null)
        {
            CommandFrame frame = new CommandFrame(command);

            _Send(frame, responseCallback);
        }