Esempio n. 1
0
        public override bool Stop()
        {
            m_Started = false;

            if (_device.State == DsState.Connected)
            {
                _device.Stop();
            }

            return(!m_Started);
        }
Esempio n. 2
0
        public override DsPadId Notify(ScpDevice.Notified notification, string Class, string path)
        {
            Log.DebugFormat("++ Notify [{0}] [{1}] [{2}]", notification, Class, path);

            switch (notification)
            {
            case ScpDevice.Notified.Arrival:
            {
                if (_device.State != DsState.Connected)
                {
                    var arrived = new BthDongle();

                    if (arrived.Open(path))
                    {
                        Log.DebugFormat("-- Device Arrival [{0}]", arrived.Local);

                        _device.Close();
                        _device = arrived;

                        _device.DeviceArrived     += OnDeviceArrival;
                        _device.HidReportReceived += OnHidReportReceived;

                        if (m_Started)
                        {
                            _device.Start();
                        }
                        break;
                    }

                    arrived.Close();
                    arrived.Dispose();
                }
            }
            break;

            case ScpDevice.Notified.Removal:

                if (_device.Path == path)
                {
                    Log.DebugFormat("-- Device Removal [{0}]", _device.Local);

                    _device.Stop();
                }
                break;
            }

            return(DsPadId.None);
        }