Пример #1
0
        /// <summary>
        /// Connection to a bluetooth device is initiated.
        /// </summary>
        private void OnDeviceConnected(string p_device)
        {
            KreyosUtils.Log("BluetoothTest::OnDeviceConnected", " device:" + p_device);
            DeviceData selectedDevice = DeviceData.DeviceFromName(m_devices, p_device);

            selectedDevice.UpdateStatus(EDevice.Status_Connected);
            this.UpdateDevices();
        }
Пример #2
0
        /// <summary>
        /// Connection to a bluetooth device is initiated.
        /// </summary>
        private void OnDeviceConnected(string p_device)
        {
            Debug.WriteLine("BluetoothTest::OnDeviceConnected device:" + p_device);
            DeviceData deviceSelected = DeviceData.DeviceFromName(m_devices, p_device);

            deviceSelected.UpdateStatus(EDevice.Status_Connected);
            this.UpdateDevices();
            // BluetoothManager.Instance.AppMainScreen.InitActivityStatsData(); // Temp D:
        }
Пример #3
0
        /// <summary>
        /// LongListSelected Event that is triggered when an Item is selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnDeviceSelected(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count <= 0)
            {
                return;
            }

            DeviceData selectedDevice = (DeviceData)(e.AddedItems[0]);

            selectedDevice = DeviceData.DeviceFromName(m_devices, selectedDevice.Name);

            selectedDevice.UpdateStatus(EDevice.Status_Connecting);

            //~~~check if device is already connected
            if (selectedDevice.DeviceStatus == EDevice.Status_Connected)
            {
                // disconnect the device
                selectedDevice.UpdateStatus(EDevice.Status_Disconnected);
                BluetoothManager.Instance.DisconnectKreyosDevice();
                return;
            }

            //~~~check if the app is currently connected to a watch
            if (BluetoothManager.Instance.IsConnected)
            {
                //~~~disconnect the device
                BluetoothManager.Instance.DisconnectKreyosDevice();
            }

            selectedDevice.UpdateStatus(EDevice.Status_Connecting);

            //~~~Update device list
            this.UpdateDevices();

            KreyosUtils.Log("BluetoothTest::OnDeviceSelected", "cellData:" + selectedDevice);

            //~~~Connected to Watch
            BluetoothManager.Instance.ConnectKreyosDevice(selectedDevice.Name);
        }