Ejemplo n.º 1
0
        //----
        internal WidcommSppClient(WidcommBluetoothFactoryBase fcty)
        {
            _fcty           = fcty;
            _singleThreader = fcty.GetSingleThreader();
            if (_singleThreader == null)
            {
                throw new InvalidOperationException("Internal Error: No GetSingleThreader");
            }
            _handleClientStateChange = HandleClientStateChange;
            bool success = false;

            try {
                _singleThreader.AddCommand(new WidcommPortSingleThreader.MiscNoReturnCommand(
                                               () => NativeMethods.SppClient_Create(out _pSppCli, _handleClientStateChange)
                                               )).WaitCompletion();
                if (_pSppCli == IntPtr.Zero)
                {
                    throw new InvalidOperationException("Failed to initialise CSppClient.");
                }
                success = true;
            } finally {
                if (!success)
                {
                    Debug.Assert(_pSppCli == IntPtr.Zero, "but failed!");
                }
            }
        }
Ejemplo n.º 2
0
        protected WidcommRfcommStreamBase(IRfcommPort port, IRfCommIf rfCommIf, WidcommBluetoothFactoryBase factory)
        {
            m_factory = factory;
            //----
            _singleThreader = factory.GetSingleThreader();
            bool created = false;

            try {
                SetPort(port);
                if (rfCommIf != null)
                {
                    m_RfCommIf = new WidcommRfcommInterface(rfCommIf);
                    rfCommIf.Create();
                }
                created = true;
            } finally {
                if (!created)
                {
                    GC.SuppressFinalize(this);
                }
            }
        }
 public WidcommStBtIf(WidcommBluetoothFactoryBase factory, IBtIf child)
 {
     _st    = factory.GetSingleThreader();
     _child = child;
     Debug.Assert(_st != null, "_st != null");
 }
Ejemplo n.º 4
0
 public WidcommStRfCommIf(WidcommBluetoothFactoryBase factory, IRfCommIf child)
 {
     _st    = factory.GetSingleThreader();
     _child = child;
 }