Inheritance: System.EventArgs
Exemplo n.º 1
0
 protected virtual void OnDeviceArrival(object sender, ArrivalEventArgs e)
 {
     if (Arrival != null)
     {
         Arrival(this, e);
     }
 }
Exemplo n.º 2
0
        protected override void OnDeviceArrival(object sender, ArrivalEventArgs e)
        {
            var bFound  = false;
            var arrived = e.Device;

            lock (Pads)
            {
                for (var index = 0; index < Pads.Count && !bFound; index++)
                {
                    if (arrived.DeviceAddress.Equals(_reservedPads[index]))
                    {
                        if (Pads[index].State == DsState.Connected)
                        {
                            if (Pads[index].Connection == DsConnection.Bluetooth)
                            {
                                Pads[index].Disconnect();
                            }

                            if (Pads[index].Connection == DsConnection.Usb)
                            {
                                arrived.Disconnect();

                                e.Handled = false;
                                return;
                            }
                        }

                        bFound = true;

                        arrived.PadId = (DsPadId)index;
                        Pads[index]   = arrived;
                    }
                }

                for (var index = 0; index < Pads.Count && !bFound; index++)
                {
                    if (Pads[index].State == DsState.Disconnected)
                    {
                        bFound = true;
                        _reservedPads[index] = arrived.DeviceAddress;

                        arrived.PadId = (DsPadId)index;
                        Pads[index]   = arrived;
                    }
                }
            }

            if (bFound)
            {
                _scpBus.Plugin((int)arrived.PadId + 1);

                if (!GlobalConfiguration.Instance.IsVBusDisabled)
                {
                    Log.InfoFormat("Plugged in Port #{0} for {1} on Virtual Bus", (int)arrived.PadId + 1,
                                   arrived.DeviceAddress.AsFriendlyName());
                }
            }
            e.Handled = bFound;
        }
Exemplo n.º 3
0
        protected virtual bool LogArrival(IDsDevice Arrived)
        {
            var args = new ArrivalEventArgs(Arrived);

            OnDeviceArrival(this, args);

            return(args.Handled);
        }
Exemplo n.º 4
0
        protected virtual Boolean LogArrival(IDsDevice Arrived)
        {
            ArrivalEventArgs args = new ArrivalEventArgs(Arrived);

            On_Arrival(this, args);

            return(args.Handled);
        }
Exemplo n.º 5
0
        protected virtual bool LogArrival(IDsDevice Arrived)
        {
            var args = new ArrivalEventArgs(Arrived);

            OnDeviceArrival(this, args);

            return args.Handled;
        }
Exemplo n.º 6
0
        protected override void OnDeviceArrival(object sender, ArrivalEventArgs e)
        {
            var bFound  = false;
            var arrived = e.Device;

            lock (_pads)
            {
                for (var index = 0; index < _pads.Length && !bFound; index++)
                {
                    if (arrived.Local == _mReserved[index])
                    {
                        if (_pads[index].State == DsState.Connected)
                        {
                            if (_pads[index].Connection == DsConnection.BTH)
                            {
                                _pads[index].Disconnect();
                            }

                            if (_pads[index].Connection == DsConnection.USB)
                            {
                                arrived.Disconnect();

                                e.Handled = false;
                                return;
                            }
                        }

                        bFound = true;

                        arrived.PadId = (DsPadId)index;
                        _pads[index]  = arrived;
                    }
                }

                for (var index = 0; index < _pads.Length && !bFound; index++)
                {
                    if (_pads[index].State == DsState.Disconnected)
                    {
                        bFound            = true;
                        _mReserved[index] = arrived.Local;

                        arrived.PadId = (DsPadId)index;
                        _pads[index]  = arrived;
                    }
                }
            }

            if (bFound)
            {
                _scpBus.Plugin((int)arrived.PadId + 1);

                Log.InfoFormat("++ Plugin Port #{0} for [{1}]", (int)arrived.PadId + 1, arrived.Local);
            }
            e.Handled = bFound;
        }
Exemplo n.º 7
0
        protected override void On_Arrival(object sender, ArrivalEventArgs e)
        {
            lock (this)
            {
                Boolean   bFound  = false;
                IDsDevice Arrived = e.Device;

                for (Int32 Index = 0; Index < m_Pad.Length && !bFound; Index++)
                {
                    if (Arrived.Local == m_Reserved[Index])
                    {
                        if (m_Pad[Index].State == DsState.Connected)
                        {
                            if (m_Pad[Index].Connection == DsConnection.BTH)
                            {
                                m_Pad[Index].Disconnect();
                            }

                            if (m_Pad[Index].Connection == DsConnection.USB)
                            {
                                Arrived.Disconnect();

                                e.Handled = false;
                                return;
                            }
                        }

                        bFound = true;

                        Arrived.PadId = (DsPadId)Index;
                        m_Pad[Index]  = Arrived;
                    }
                }

                for (Int32 Index = 0; Index < m_Pad.Length && !bFound; Index++)
                {
                    if (m_Pad[Index].State == DsState.Disconnected)
                    {
                        bFound            = true;
                        m_Reserved[Index] = Arrived.Local;

                        Arrived.PadId = (DsPadId)Index;
                        m_Pad[Index]  = Arrived;
                    }
                }

                if (bFound)
                {
                    scpBus.Plugin((int)Arrived.PadId + 1);

                    LogDebug(String.Format("++ Plugin Port #{0} for [{1}]", (int)Arrived.PadId + 1, Arrived.Local));
                }
                e.Handled = bFound;
            }
        }
Exemplo n.º 8
0
        protected Boolean LogArrival(IDs3Device Arrived)
        {
            ArrivalEventArgs args = new ArrivalEventArgs(Arrived);

            if (Arrival != null)
            {
                Arrival(this, args);
            }

            return(args.Handled);
        }
Exemplo n.º 9
0
        protected virtual void On_Arrival(object sender, ArrivalEventArgs e)
        {
            Boolean    bFound  = false;
            IDs3Device Arrived = e.Device;

            for (Int32 Index = 0; Index < m_Pad.Length && !bFound; Index++)
            {
                if (Arrived.Local == m_Reserved[Index])
                {
                    if (m_Pad[Index].State == DeviceState.Connected)
                    {
                        if (m_Pad[Index].Connection == Ds3Connection.BTH)
                        {
                            m_Pad[Index].Disconnect();
                        }

                        if (m_Pad[Index].Connection == Ds3Connection.USB)
                        {
                            Arrived.Disconnect();

                            e.Handled = false;
                            return;
                        }
                    }

                    bFound = true;

                    Arrived.PadId = (Ds3PadId)Index;
                    m_Pad[Index]  = Arrived;
                }
            }

            for (Int32 Index = 0; Index < m_Pad.Length && !bFound; Index++)
            {
                if (m_Pad[Index].State == DeviceState.Disconnected)
                {
                    bFound            = true;
                    m_Reserved[Index] = Arrived.Local;

                    Arrived.PadId = (Ds3PadId)Index;
                    m_Pad[Index]  = Arrived;
                }
            }

            if (bFound)
            {
                scpBus.Plugin((int)Arrived.PadId + 1);
            }
            e.Handled = bFound;
        }
Exemplo n.º 10
0
 protected virtual void On_Arrival(object sender, ArrivalEventArgs e)
 {
     if (Arrival != null) Arrival(this, e);
 }
Exemplo n.º 11
0
        protected override void OnDeviceArrival(object sender, ArrivalEventArgs e)
        {
            var bFound = false;
            var arrived = e.Device;

            lock (Pads)
            {
                for (var index = 0; index < Pads.Count && !bFound; index++)
                {
                    if (arrived.DeviceAddress.Equals(_reservedPads[index]))
                    {
                        if (Pads[index].State == DsState.Connected)
                        {
                            if (Pads[index].Connection == DsConnection.Bluetooth)
                            {
                                Pads[index].Disconnect();
                            }

                            if (Pads[index].Connection == DsConnection.Usb)
                            {
                                arrived.Disconnect();

                                e.Handled = false;
                                return;
                            }
                        }

                        bFound = true;

                        arrived.PadId = (DsPadId)index;
                        Pads[index] = arrived;
                    }
                }

                for (var index = 0; index < Pads.Count && !bFound; index++)
                {
                    if (Pads[index].State == DsState.Disconnected)
                    {
                        bFound = true;
                        _reservedPads[index] = arrived.DeviceAddress;

                        arrived.PadId = (DsPadId)index;
                        Pads[index] = arrived;
                    }
                }
            }

            if (bFound)
            {
                _scpBus.Plugin((int)arrived.PadId + 1);

                if (!GlobalConfiguration.Instance.IsVBusDisabled)
                {
                    Log.InfoFormat("Plugged in Port #{0} for {1} on Virtual Bus", (int)arrived.PadId + 1,
                        arrived.DeviceAddress.AsFriendlyName());
                }
            }
            e.Handled = bFound;
        }
Exemplo n.º 12
0
        protected override void On_Arrival(object sender, ArrivalEventArgs e)
        {
            var bFound = false;
            var arrived = e.Device;

            lock (_mPad)
            {
                for (var index = 0; index < _mPad.Length && !bFound; index++)
                {
                    if (arrived.Local == _mReserved[index])
                    {
                        if (_mPad[index].State == DsState.Connected)
                        {
                            if (_mPad[index].Connection == DsConnection.BTH)
                            {
                                _mPad[index].Disconnect();
                            }

                            if (_mPad[index].Connection == DsConnection.USB)
                            {
                                arrived.Disconnect();

                                e.Handled = false;
                                return;
                            }
                        }

                        bFound = true;

                        arrived.PadId = (DsPadId)index;
                        _mPad[index] = arrived;
                    }
                }

                for (var index = 0; index < _mPad.Length && !bFound; index++)
                {
                    if (_mPad[index].State == DsState.Disconnected)
                    {
                        bFound = true;
                        _mReserved[index] = arrived.Local;

                        arrived.PadId = (DsPadId)index;
                        _mPad[index] = arrived;
                    }
                }
            }

            if (bFound)
            {
                _scpBus.Plugin((int)arrived.PadId + 1);

                Log.DebugFormat("++ Plugin Port #{0} for [{1}]", (int)arrived.PadId + 1, arrived.Local);
            }
            e.Handled = bFound;
        }
Exemplo n.º 13
0
        protected override void OnDeviceArrival(object sender, ArrivalEventArgs e)
        {
            var bFound = false;
            var arrived = e.Device;

            lock (_mPad)
            {
                for (var index = 0; index < _mPad.Length && !bFound; index++)
                {
                    if (arrived.Local == _mReserved[index])
                    {
                        if (_mPad[index].State == DsState.Connected)
                        {
                            if (_mPad[index].Connection == DsConnection.BTH)
                            {
                                _mPad[index].Disconnect();
                            }

                            if (_mPad[index].Connection == DsConnection.USB)
                            {
                                arrived.Disconnect();

                                e.Handled = false;
                                return;
                            }
                        }

                        bFound = true;

                        arrived.PadId = (DsPadId)index;
                        _mPad[index] = arrived;
                    }
                }

                for (var index = 0; index < _mPad.Length && !bFound; index++)
                {
                    if (_mPad[index].State == DsState.Disconnected)
                    {
                        bFound = true;
                        _mReserved[index] = arrived.Local;

                        arrived.PadId = (DsPadId)index;
                        _mPad[index] = arrived;
                    }
                }
            }

            if (bFound)
            {
                _scpBus.Plugin((int)arrived.PadId + 1);

                Log.InfoFormat("++ Plugin Port #{0} for [{1}]", (int)arrived.PadId + 1, arrived.Local);

                // TODO: this isn't the correct execution path, fix
                AudioPlayer.Instance.PlayCustomFile(GlobalConfiguration.Instance.UsbConnectSoundFile);
            }
            e.Handled = bFound;
        }