Exemple #1
0
        private async void OnSelectDevice(DeviceNode deviceNode)
        {
            lock (locker) // make sure we don't create multiple device connections by a trigger happy user
            {
                if (DeviceConnection != null)
                {
                    return;
                }
            }

            var device = await ftManager.OpenByDeviceId(deviceNode.Id);

            DeviceConnection newConnection;

            lock (locker) // make sure we don't create multiple device connections by a trigger happy user
            {
                if (DeviceConnection != null)
                {
                    return;
                }
                newConnection    = new DeviceConnection(deviceNode, device);
                DeviceConnection = newConnection;
            }

            var defaultSettings = DeviceConnection.DefaultSettings;
            await newConnection.InitializeSettings(defaultSettings);
        }
Exemple #2
0
        public DeviceConnection(DeviceNode deviceNode, ISerialDevice device)
        {
            DeviceNode = deviceNode;
            this.device = device;
            State = ConnectionState.Initializing;

            ReadBuffer = new byte[] { };
            WriteASCIICommand = new DelegateCommand<string>(OnWriteASCII, _ => State == ConnectionState.Ready);
            WriteBytesCommand = new DelegateCommand<string>(OnWriteBytes, _ => State == ConnectionState.Ready);
        }
Exemple #3
0
        public DeviceConnection(DeviceNode deviceNode, ISerialDevice device)
        {
            DeviceNode  = deviceNode;
            this.device = device;
            State       = ConnectionState.Initializing;

            ReadBuffer        = new byte[] { };
            WriteASCIICommand = new DelegateCommand <string>(OnWriteASCII, _ => State == ConnectionState.Ready);
            WriteBytesCommand = new DelegateCommand <string>(OnWriteBytes, _ => State == ConnectionState.Ready);
        }
        private async void OnSelectDevice(DeviceNode deviceNode)
        {
            DeviceConnection newConnection;
            lock (locker) // make sure we don't create multiple device connections by a trigger happy user
            {
                if (DeviceConnection != null)
                    return;

                var device = ftManager.OpenByDeviceID(deviceNode.DeviceId);
                newConnection = new DeviceConnection(deviceNode, device);
                DeviceConnection = newConnection;
            }

            var defaultSettings = DeviceConnection.DefaultSettings;
            await newConnection.InitializeSettings(defaultSettings);
        }