Example #1
0
        private void OnCommunicationStatusChanged(object sender, DeviceCommunicationEventArgs e)
        {
            var device        = e.Device as EposDevice;
            var eposEventArgs = e as EposCommunicationEventArgs;
            var status        = eposEventArgs?.Status;

            MsgLogger.WriteDebug($"{GetType().Name} - method", $"Device: {device.Family} ({device.PortName}) - state = {status}");

            switch (status)
            {
            case EposCommunicationStatus.Connected:
            {
                if (_statusManager.CheckState())     //detect fake connect
                {
                    Identification.Read();

                    Status = DeviceStatus.Connected;
                }
                else
                {
                    (Communication as Epos4DeviceCommunication).Disconnect();     // fake connection -> disconnect
                }
            } break;

            case EposCommunicationStatus.Disconnected:
            {
                Status = DeviceStatus.Disconnected;
            } break;

            case EposCommunicationStatus.Failed:
            {
                Status = DeviceStatus.Undefined;
            } break;
            }
        }
Example #2
0
        protected override void OnStatusChanged(DeviceCommunicationEventArgs e)
        {
            Console.WriteLine($"status changed, status = {e.Device.Status}, error code = {e.LastErrorCode}");

            if (e.Device.Status == DeviceStatus.Disconnected)
            {
                StopCounting();
            }

            base.OnStatusChanged(e);
        }
Example #3
0
 protected virtual void OnStatusChanged(DeviceCommunicationEventArgs e)
 {
     StatusChanged?.Invoke(this, e);
 }
        protected override void OnStatusChanged(DeviceCommunicationEventArgs e)
        {
            Console.WriteLine($"status changed, status = {e.Device.Status}, error code = {e.LastErrorCode}");

            base.OnStatusChanged(e);
        }