示例#1
0
        /// <summary>
        ///     Resets the service events.
        /// </summary>
        private void ResetServiceEvents()
        {
            DisConnectFromWand();
            if (_batteryService != null)
            {
                _batteryService.CharacteristicsDiscovered -= ReadCharecteristics;
            }
            if (SelectedDevice != null)
            {
                SelectedDevice.ServicesDiscovered -= ServicesDiscovered;
            }

            Settings       = new BleSettings();
            SelectedDevice = null;
            if (_services != null)
            {
                _services.Clear();
            }

            _temperatureService = null;
            _deviceInfoService  = null;
            _batteryService     = null;

            _measurementTimeChar      = null;
            _measurementScaleChar     = null;
            _autooffIntervalChar      = null;
            _sleepTimeChar            = null;
            _resetAutoOffChar         = null;
            _disConnectPeripheralChar = null;

            _batteryServieOn     = false;
            _temperatureServieOn = false;
            _deviceServieOn      = false;
            Debug.WriteLine("ResetServiceEvents..");
        }
示例#2
0
        /// <summary>
        ///     Devices connected.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">E.</param>
        public async void DeviceConnected(object sender, DeviceConnectionEventArgs e)
        {
            SelectedDevice = e.Device;

            IsConnected            = true;
            ReadingBlue2Data       = true;
            GotTemperartureReading = false;
            Settings = new BleSettings();
            SelectedDevice.ServicesDiscovered += ServicesDiscovered;
            SelectedDevice.DiscoverServices();
            MessagingCenter.Send(new BleConnectionStatusMessage(), HaccpConstant.BleconnectionStatus);
            ScanTimeOutElapsed = true;
            await StopScanning();
        }