Ejemplo n.º 1
0
        private TimeSpan SCAN_INTERVAL_PRESENT = new TimeSpan(0, 30, 1); // Keep a multiple of this slightly longer than AWAY_TIMEOUT to prevent evaulating 1sec before the timeout.

        #endregion Fields

        #region Constructors

        public BluetoothService(ServiceCreationInfo info)
            : base("bluetooth", info)
        {
            mBluetooth = new BluetoothHelper();

            // Refresh available devices
            mBluetooth.RefreshDevices();
            mDeviceNames = mBluetooth.GetDevices();
            Log.Info("Bluetooth devices: {0}", mDeviceNames);

            // Set up scan thread.
            mEvents = new EventWaitHandle[] { mStopEvent, mDeviceEvent };
            mThread = new Thread(_searchThread);
            mThread.Start();
        }
Ejemplo n.º 2
0
        public BluetoothService(ServiceCreationInfo info)
            : base("bluetooth", info)
        {
            mBluetooth = new BluetoothHelper();

            // Refresh available devices
            mBluetooth.RefreshDevices();
            mDeviceNames = mBluetooth.GetDevices();
            if (mDeviceNames != null)
            {
                Log.Info("Bluetooth devices: {0}", mDeviceNames);
            }

            // Set up scan thread.
            mEvents = new EventWaitHandle[] { mStopEvent, mDeviceEvent };
            mThread = new Thread(_searchThread);
            mThread.Start();
        }