コード例 #1
0
ファイル: BthHub.cs プロジェクト: zw5/WiinUPro
        public override DsPadId Notify(ScpDevice.Notified Notification, String Class, String Path)
        {
            LogDebug(String.Format("++ Notify [{0}] [{1}] [{2}]", Notification, Class, Path));

            switch (Notification)
            {
            case ScpDevice.Notified.Arrival:
            {
                if (Device.State != DsState.Connected)
                {
                    BthDongle Arrived = new BthDongle();

                    if (Arrived.Open(Path))
                    {
                        LogDebug(String.Format("-- Device Arrival [{0}]", Arrived.Local));

                        Device.Close();
                        Device = Arrived;

                        Device.Arrival += new EventHandler <ArrivalEventArgs>(On_Arrival);
                        Device.Debug   += new EventHandler <DebugEventArgs>  (On_Debug);
                        Device.Report  += new EventHandler <ReportEventArgs> (On_Report);

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

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

            case ScpDevice.Notified.Removal:

                if (Device.Path == Path)
                {
                    LogDebug(String.Format("-- Device Removal [{0}]", Device.Local));

                    Device.Stop();
                }
                break;
            }

            return(DsPadId.None);
        }
コード例 #2
0
ファイル: BthHub.cs プロジェクト: zw5/WiinUPro
        public override Boolean Open()
        {
            Device = new BthDongle();

            Device.Arrival += new EventHandler <ArrivalEventArgs>(On_Arrival);
            Device.Debug   += new EventHandler <DebugEventArgs>  (On_Debug);
            Device.Report  += new EventHandler <ReportEventArgs> (On_Report);

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

            return(true);
        }
コード例 #3
0
ファイル: BthHub.cs プロジェクト: metaxis/ScpServer
        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;
        }
コード例 #4
0
ファイル: BthHub.cs プロジェクト: metaxis/ScpServer
        public override bool Open()
        {
            _device = new BthDongle();

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

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

            return true;
        }
コード例 #5
0
ファイル: BthHub.cs プロジェクト: zw5/WiinUPro
        public override Boolean Close()
        {
            m_Started = false;

            return(Device.Close());
        }