Beispiel #1
0
        public override bool Open()
        {
            _device = new BthDongle();

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

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

            return(true);
        }
Beispiel #2
0
        public override bool Open()
        {
            _device = new BthDongle();

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

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

            return(true);
        }
Beispiel #3
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);
        }
Beispiel #4
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.BluetoothHostAddress.AsFriendlyName());

                        _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.BluetoothHostAddress.AsFriendlyName());

                    _device.Stop();
                }
                break;
            }

            return(DsPadId.None);
        }
Beispiel #5
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);

                        AudioPlayer.Instance.PlayCustomFile(GlobalConfiguration.Instance.BluetoothDisconnectSoundFile);

                        _device.Stop();
                    }
                    break;
            }

            return DsPadId.None;
        }
Beispiel #6
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.BluetoothHostAddress.AsFriendlyName());

                            _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.BluetoothHostAddress.AsFriendlyName());

                        _device.Stop();
                    }
                    break;
            }

            return DsPadId.None;
        }
Beispiel #7
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;
        }
Beispiel #8
0
        public override bool Open()
        {
            _device = new BthDongle();

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

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

            return true;
        }
Beispiel #9
0
        public override bool Open()
        {
            _device = new BthDongle();

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

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

            return true;
        }