Exemplo n.º 1
0
        /// <summary>
        /// Retorna a classe para comunicação
        /// </summary>
        /// <param name="config"></param>
        /// <returns></returns>
        public static ACBrDevice GetCommunication(ACBrDeviceConfig config)
        {
            var communication = (from c in communications
                                 where config.Porta.ToUpper().StartsWith(c.Key)
                                 select c.Value).FirstOrDefault();

            Guard.Against <ACBrException>(communication == null, "Classe de comunicação não localizada.");
            return((ACBrDevice)Activator.CreateInstance(communication, config));
        }
Exemplo n.º 2
0
        public ACBrTcpDevice(ACBrDeviceConfig config) : base(config)
        {
            var ports = Config.Porta.Split(':');

            if (ports.Length < 3)
            {
                throw new ArgumentException("Endereço e porta não informados");
            }

            conEndPoint = new IPEndPoint(IPAddress.Parse(ports[1]), int.Parse(ports[2]));
            client      = new TcpClient();
        }
Exemplo n.º 3
0
 public ACBrRawDevice(ACBrDeviceConfig config) : base(config)
 {
     printer = new RawPrinter();
 }
Exemplo n.º 4
0
 public ACBrSerialDevice(ACBrDeviceConfig config) : base(config)
 {
     serialPort = new SerialPort();
 }
Exemplo n.º 5
0
 protected ACBrDevice(ACBrDeviceConfig config)
 {
     Config = config;
 }