public Characteristic(Guid uuid, CharacterisiticPermissionType permissions, CharacteristicPropertyType properties)
        {
            CBAttributePermissions nativePermissions = 0;

            nativePermissions     = GetNativePermissions(permissions);
            _nativeCharacteristic = new CBMutableCharacteristic(CBUUID.FromString(uuid.ToString()), (CBCharacteristicProperties)properties, null, nativePermissions);
        }
        public void WriteType_set(CharacteristicWriteType writeType, CharacteristicPropertyType currentProperties)
        {
            var characteristic = new CharacteristicMock { MockPropterties = currentProperties };
            characteristic.WriteType = writeType;

            Assert.Equal(writeType, characteristic.WriteType);
        }
 public void WriteType_set_throws_InvalidOperationException(CharacteristicWriteType writeType, CharacteristicPropertyType currentProperties)
 {
     var characteristic = new CharacteristicMock { MockPropterties = currentProperties };
     Assert.Throws<InvalidOperationException>(() =>
     {
         characteristic.WriteType = writeType;
     });
 }
Esempio n. 4
0
        public void WriteType_set_throws_InvalidOperationException(CharacteristicWriteType writeType,
                                                                   CharacteristicPropertyType currentProperties)
        {
            CharacteristicMock characteristic = new CharacteristicMock {
                MockPropterties = currentProperties
            };

            Assert.Throws <InvalidOperationException>(() => { characteristic.WriteType = writeType; });
        }
        public void WriteType_set(CharacteristicWriteType writeType, CharacteristicPropertyType currentProperties)
        {
            var characteristic = new CharacteristicMock
            {
                MockPropterties = currentProperties,
                WriteType       = writeType
            };

            Assert.Equal(writeType, characteristic.WriteType);
        }
        public async Task Write_WriteType(CharacteristicWriteType expectedWriteType, CharacteristicWriteType currentWriteType, CharacteristicPropertyType currentProperties)
        {
            var characteristic = new CharacteristicMock
            {
                MockPropterties = currentProperties,
                WriteType = currentWriteType
            };

            await characteristic.WriteAsync(new byte[0]);
            var writtenType = characteristic.WriteHistory.First().WriteType;

            Assert.Equal(expectedWriteType, writtenType);
        }
Esempio n. 7
0
        public async Task Write_WriteType(CharacteristicWriteType expectedWriteType,
                                          CharacteristicWriteType currentWriteType, CharacteristicPropertyType currentProperties)
        {
            CharacteristicMock characteristic = new CharacteristicMock
            {
                MockPropterties = currentProperties,
                WriteType       = currentWriteType
            };

            await characteristic.WriteAsync(new Byte[0]);

            CharacteristicWriteType writtenType = characteristic.WriteHistory.First().WriteType;

            Assert.Equal(expectedWriteType, writtenType);
        }
 public ICharacteristic Create(Guid uuid, CharacterisiticPermissionType permissions, CharacteristicPropertyType propeties)
 {
     return(new Characteristic(uuid, permissions, propeties));
 }
        private void AddCharacteristic(ref IService service, Guid guid, CharacterisiticPermissionType permissions, CharacteristicPropertyType properties, byte[] value)
        {
            var charFactory    = DependencyService.Get <ICharacteristicsFactory>();
            var characteristic = charFactory.Create(guid, permissions, properties);

            characteristic.ValueUpdated += CharacteristicOnValueUpdated;
            characteristic.Value         = value;
            service.Characteristics.Add(characteristic);
        }
Esempio n. 10
0
        public Characteristic(Guid uuid, CharacterisiticPermissionType permissions, CharacteristicPropertyType properties)
        {
            GattPermission gattPermissions = GetNativePermissions(permissions);

            _nativeCharacteristic = new BluetoothGattCharacteristic(UUID.FromString(uuid.ToString()), (GattProperty)properties, gattPermissions);
        }