예제 #1
0
        public override Boolean Open()
        {
            Device = new BthDevice();

            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);
        }
예제 #2
0
        public override Ds3PadId 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 != DeviceState.Connected)
                {
                    BthDevice Arrived = new BthDevice();

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

                        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();
                }
            }
            break;

            case ScpDevice.Notified.Removal:

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

                    Device.Stop();
                }
                break;
            }

            return(Ds3PadId.None);
        }
예제 #3
0
        public override Ds3PadId 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 != DeviceState.Connected)
                        {
                            BthDevice Arrived = new BthDevice();

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

                                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();
                        }
                    }
                    break;

                case ScpDevice.Notified.Removal:

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

                        Device.Stop();
                    }
                    break;
            }

            return Ds3PadId.None;
        }
예제 #4
0
        public override Boolean Open()
        {
            Device = new BthDevice();

            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;
        }