Ejemplo n.º 1
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.Arrival += On_Arrival;
                            _device.Report += On_Report;

                            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;
        }
Ejemplo n.º 2
0
        public override bool Open()
        {
            _device = new BthDongle();

            _device.Arrival += On_Arrival;
            _device.Report += On_Report;

            if (!_device.Open()) _device.Close();

            return true;
        }