예제 #1
0
        internal void TestSetString(GattService service, TextCharacteristic textCharacteristic, string value)
        {
            // Write to store
            var entry = GetValueEntry(service.Index, textCharacteristic.Index);

            entry.Value = OS.Encode(value);

            // Call Handler
            EventSink.Fire(new BluetoothEvent
            {
                EventType           = BluetoothEventType.ValueWritten,
                ServiceIndex        = service.Index,
                CharacteristicIndex = textCharacteristic.Index,
            });
        }
예제 #2
0
        public void Service_Started()
        {
            host.Advertise(advertisement);

            var timeCharacteristic = service["Time"] as TimeCharacteristic;

            var stored = device.NativeGetValue(timeCharacteristic.ServiceIndex, timeCharacteristic.Index);

            Assert.AreEqual(timeCharacteristic.Value, TimeCharacteristic.Decode(stored));

            var textCharacteristic = service["Text"] as TextCharacteristic;

            stored = device.NativeGetValue(textCharacteristic.ServiceIndex, textCharacteristic.Index);
            Assert.AreEqual(textCharacteristic.Value, TextCharacteristic.Decode(stored));
        }