示例#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;
		}
 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 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);
            }
        }