internal string ConnectedToAddr;                  // The address of the device to which this connection is connected to

        //--//

        /// <summary>
        /// Creates a new BTConnection that is associated with the specified BTManager.
        /// </summary>
        /// <param name="manager">
        /// The BTManager
        /// </param>
        public BTConnection(BTManager manager)
        {
            m_manager      = manager;
            m_commandQueue = new ArrayList();
            m_disposed     = false;

            Connected       = false;
            IsMaster        = false;
            ConnectedToAddr = null;
        }
Beispiel #2
0
        /// <summary>
        /// Creates a new instance of BTManager.  Locks the BTManager type so that only one
        /// manager can be created.
        /// </summary>
        /// <param name="driver">
        /// The BTDriver to be used to communicate with the underlying Bluetooth chip.
        /// </param>
        /// <param name="pp">
        /// The power policy to be used while managing connections.
        /// </param>
        /// <returns>
        /// The singleton instance of BTManager
        /// </returns>
        public static BTManager GetManager(BTDriver driver, IPowerPolicy pp)
        {
            if (null == s_manager)
            {
                lock (typeof(BTManager))
                {
                    if (null == s_manager)
                    {
                        s_manager = new BTManager(driver, pp);
                    }
                }
            }

            return(s_manager);
        }
Beispiel #3
0
        public void Dispose()
        {
            if (!m_disposed)
            {
                // Shut down worker thread
                m_outstandingConnections.Clear();
                m_newCommand.Set();
                m_scheduler.Join();

                // Release HW resources
                m_driver.Disconnect();
                m_driver.Dispose();
            }

            s_manager  = null;
            m_disposed = true;
        }
        public void Dispose()
        {
            if (!m_disposed)
            {
                // Shut down worker thread
                m_outstandingConnections.Clear();
                m_newCommand.Set();
                m_scheduler.Join();

                // Release HW resources
                m_driver.Disconnect();
                m_driver.Dispose();
            }

            s_manager = null;
            m_disposed = true;
        }
        /// <summary>
        /// Creates a new instance of BTManager.  Locks the BTManager type so that only one
        /// manager can be created.
        /// </summary>
        /// <param name="driver">
        /// The BTDriver to be used to communicate with the underlying Bluetooth chip.
        /// </param>
        /// <param name="pp">
        /// The power policy to be used while managing connections.
        /// </param>
        /// <returns>
        /// The singleton instance of BTManager
        /// </returns>
        public static BTManager GetManager(BTDriver driver, IPowerPolicy pp)
        {
            if (null == s_manager)
            {
                lock (typeof(BTManager))
                {
                    if (null == s_manager)
                    {
                        s_manager = new BTManager(driver, pp);
                    }
                }
            }

            return s_manager;
        }
        internal string ConnectedToAddr;                    // The address of the device to which this connection is connected to

        //--//

        /// <summary>
        /// Creates a new BTConnection that is associated with the specified BTManager.
        /// </summary>
        /// <param name="manager">
        /// The BTManager
        /// </param>
        public BTConnection(BTManager manager)
        {
            m_manager = manager;
            m_commandQueue = new ArrayList();
            m_disposed = false;

            Connected = false;
            IsMaster = false;
            ConnectedToAddr = null;
        }