/// <summary>
        /// Initializes a new instance of the <see cref="BatteryLevelCharacteristic" /> class.
        /// </summary>
        /// <param name="characteristic">The characteristic that this wraps</param>
        public BatteryLevelCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
        {
            // generate random value 1-100%
            Random rnd = new Random();

            batteryLevelIndication = rnd.Next(1, 100);
            Value = BLEServices.Helpers.ToIBuffer(batteryLevelIndication);
        }
Ejemplo n.º 2
0
        public LightBulbColorCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
        {
            // argb
            Value = BLEServices.Helpers.ToIBuffer(argb);

            //generate random PIN
            Random rnd = new Random();

            pin[0] = (byte)rnd.Next(0, 10);
            pin[1] = (byte)rnd.Next(0, 10);
            pin[2] = (byte)rnd.Next(0, 10);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GenericGattCharacteristic" /> class.
        /// </summary>
        /// <param name="characteristic">Characteristic this wraps</param>
        public GenericGattCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service)
        {
            Characteristic = characteristic;
            ParentService  = service;

            if (Characteristic.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Read))
            {
                Characteristic.ReadRequested += Characteristic_ReadRequested;
            }

            if (Characteristic.CharacteristicProperties.HasFlag(GattCharacteristicProperties.Write) ||
                Characteristic.CharacteristicProperties.HasFlag(GattCharacteristicProperties.WriteWithoutResponse))
            {
                Characteristic.WriteRequested += Characteristic_WriteRequested;
            }

            Characteristic.SubscribedClientsChanged += Characteristic_SubscribedClientsChanged;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="HeartRateMeasurementCharacteristic" /> class.
 /// </summary>
 /// <param name="characteristic">Characteristic this wraps</param>
 public HeartRateMeasurementCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
 {
     heartRateTicker = new Timer(UpdateHeartRate, "", TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1));
 }
Ejemplo n.º 5
0
 public QuickLockOpenTimeCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
 {
     // for now just static 5 seconds, setting the value not yet implemented in HackMe
     Value = BLEServices.Helpers.ToIBuffer((byte)5);
 }
Ejemplo n.º 6
0
 public QuickLockCommandCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
 {
     Value = BLEServices.Helpers.ToIBuffer((byte)0);
 }
Ejemplo n.º 7
0
 public LightBulbTTSCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
 {
     Value = BLEServices.Helpers.ToIBuffer(0);
 }
 public CurrentTimeCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
 {
     UpdateCurrentTimeValue();
 }
 public QuickLockHistoryDataCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
 {
     Value = Helpers.HexStringToIBuffer(LOG_END_DELIMITER);
 }
 public QuickLockHistoryControlCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
 {
     Value = Helpers.ToIBuffer((byte)1);
 }
 public QuickLockUsernameCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
 {
     // "smartlockpick" user
     Value = Helpers.HexStringToIBuffer("0d736d6172746c6f636b7069636b00");
 }
Ejemplo n.º 12
0
 public LightBulbSwitchCharacteristic(GattLocalCharacteristic characteristic, GenericGattService service) : base(characteristic, service)
 {
     Value         = BLEServices.Helpers.ToIBuffer((byte)0);
     switchCounter = 0;
 }