示例#1
0
        public Task WriteCommand(Comando commando)
        {
            var concatCommand = "";

            switch (commando.Accion)
            {
            case PortAccionEnum.READ:
                concatCommand = WriteCommandClass.Generate("R", commando.Pin, commando.Valor);
                break;

            case PortAccionEnum.WRITE:
                concatCommand = WriteCommandClass.Generate("W", commando.Pin, commando.Valor);
                break;
            }
            if (!string.IsNullOrWhiteSpace(concatCommand))
            {
                return(this.Write(concatCommand));
            }
            return(null);
        }
示例#2
0
        /// <summary>
        /// Permite escribir un comando directamente.
        /// </summary>
        /// <param name="command"></param>
        public Task WriteCommand(string command, string pin, string value)
        {
            var concatCommand = WriteCommandClass.Generate(command, pin, value);

            return(this.Write(concatCommand));
        }
        private void ApagarPuerto(Port port)
        {
            var command = WriteCommandClass.Generate(CommandTypeEnum.WRITE, port.Pin, "0");

            this._writeFunction(command);
        }