Example #1
0
		public ICharacteristic FindCharacteristic (KnownCharacteristic characteristic)
		{
			//TODO: why don't we look in the internal list _chacateristics?
			foreach (var item in this._nativeService.Characteristics) {
				if ( string.Equals(item.Uuid.ToString(), characteristic.ID.ToString()) ) {
					return new Characteristic(item, this._gatt, this._gattCallback);
				}
			}
			return null;
		}
Example #2
0
 public ICharacteristic FindCharacteristic(KnownCharacteristic characteristic)
 {
     //TODO: why don't we look in the internal list _chacateristics?
     foreach (var item in this._nativeService.Characteristics)
     {
         if (string.Equals(item.Uuid.ToString(), characteristic.ID.ToString()))
         {
             return(new Characteristic(item, this._gatt, this._gattCallback));
         }
     }
     return(null);
 }
		public static void LoadItemsFromJson()
		{
			_items = new Dictionary<Guid, KnownCharacteristic> ();
			//TODO: switch over to CharacteristicStack.Text when it gets bound.
			KnownCharacteristic characteristic;
			string itemsJson = ResourceLoader.GetEmbeddedResourceString (typeof(KnownCharacteristics).GetTypeInfo ().Assembly, "KnownCharacteristics.json");
			var json = JValue.Parse (itemsJson);
			foreach (var item in json.Children() ) {
				JProperty prop = item as JProperty;
				characteristic = new KnownCharacteristic () { Name = prop.Value.ToString(), ID = Guid.ParseExact (prop.Name, "d") };
				_items.Add (characteristic.ID, characteristic);
			}
		}
        public ICharacteristic FindCharacteristic(KnownCharacteristic characteristic)
        {
            // TODO: why don't we look in the internal list _chacateristics?
            foreach (var item in _nativeService.Characteristics)
            {
                if (string.Equals(item.UUID.ToString(), characteristic.ID.ToString()))
                {
                    return(new Characteristic(item, _parentDevice));
                }
            }

            return(null);
        }
Example #5
0
        public static void LoadItemsFromJson()
        {
            _items = new Dictionary <Guid, KnownCharacteristic> ();
            //TODO: switch over to CharacteristicStack.Text when it gets bound.
            KnownCharacteristic characteristic;
            string itemsJson = ResourceLoader.GetEmbeddedResourceString(typeof(KnownCharacteristics).GetTypeInfo().Assembly, "KnownCharacteristics.json");
            var    json      = JValue.Parse(itemsJson);

            foreach (var item in json.Children())
            {
                JProperty prop = item as JProperty;

                characteristic = new KnownCharacteristic()
                {
                    Name = prop.Value.ToString(), ID = Guid.ParseExact(prop.Name, "d")
                };
                _items.Add(characteristic.ID, characteristic);
            }
        }
Example #6
0
        public ICharacteristic FindCharacteristic(KnownCharacteristic characteristic)
        {
            var c = this.nativeService.GetCharacteristics(characteristic.ID).FirstOrDefault();

            return(new Characteristic(c));
        }