Beispiel #1
0
        protected void Initialize()
        {
            this._tableSource = new CharacteristicTableSource();

//			// when the characteristic is selected in the table, make a request to disover the descriptors for it.
            this._tableSource.CharacteristicSelected += (object sender, CharacteristicTableSource.CharacteristicSelectedEventArgs e) => {
                Console.WriteLine("Characteristic: " + e.Characteristic.Name);

                UIViewController _characteristicDetailScreen = null;
                if (e.Characteristic.Uuid == CBUUID.FromPartial(0x2A37).ToString())                    // heart rate characteristic
                {
                    _characteristicDetailScreen = new CharacteristicDetailScreen_Hrm();
                    ((CharacteristicDetailScreen_Hrm)_characteristicDetailScreen).SetDeviceServiceAndCharacteristic(this._connectedDevice, this._currentService, e.Characteristic);
                }
                if (_connectedDevice.Name == "TI BLE Sensor Tag")                     // TI SensorTag device
                {
                    _characteristicDetailScreen = new CharacteristicDetailScreen_TISensorTag();
                    ((CharacteristicDetailScreen_TISensorTag)_characteristicDetailScreen).SetDeviceServiceAndCharacteristic(this._connectedDevice, this._currentService, e.Characteristic);
                }
                else
                {
                    _characteristicDetailScreen = new CharacteristicDetailScreen();
                    ((CharacteristicDetailScreen)_characteristicDetailScreen).SetDeviceServiceAndCharacteristic(this._connectedDevice, this._currentService, e.Characteristic);
                }
                this.NavigationController.PushViewController(_characteristicDetailScreen, true);
            };
        }
		protected void Initialize()
		{
			this._tableSource = new CharacteristicTableSource ();

//			// when the characteristic is selected in the table, make a request to disover the descriptors for it.
			this._tableSource.CharacteristicSelected += (object sender, CharacteristicTableSource.CharacteristicSelectedEventArgs e) => {

				Console.WriteLine("Characteristic: " + e.Characteristic.Name);

				UIViewController _characteristicDetailScreen = null;
				if (e.Characteristic.Uuid == CBUUID.FromPartial (0x2A37).ToString()) { // heart rate characteristic
					_characteristicDetailScreen = new CharacteristicDetailScreen_Hrm();
					((CharacteristicDetailScreen_Hrm)_characteristicDetailScreen).SetDeviceServiceAndCharacteristic ( this._connectedDevice, this._currentService, e.Characteristic );
				} if (_connectedDevice.Name == "TI BLE Sensor Tag") { // TI SensorTag device
					_characteristicDetailScreen = new CharacteristicDetailScreen_TISensorTag();
					((CharacteristicDetailScreen_TISensorTag)_characteristicDetailScreen).SetDeviceServiceAndCharacteristic ( this._connectedDevice, this._currentService, e.Characteristic );
				} else {
					_characteristicDetailScreen = new CharacteristicDetailScreen();
					((CharacteristicDetailScreen)_characteristicDetailScreen).SetDeviceServiceAndCharacteristic ( this._connectedDevice, this._currentService, e.Characteristic );
				}
				this.NavigationController.PushViewController(_characteristicDetailScreen, true);
			};
		}