예제 #1
0
        private async Task TriggerAuthentication()
        {
            Trace.WriteLine("Writing authentication-key..");
            byte[] KeyBytes = new byte[18];
            byte[] AuthKey  = MiBand3ConversionHelper.GenerateAuthKey(); // Key needs to be saved somewhere (BLEDevice or Something)
            _miBand3.SecretKey = AuthKey;
            KeyBytes[0]        = 0x01;
            KeyBytes[1]        = 0x00;
            Buffer.BlockCopy(AuthKey, 0, KeyBytes, 2, 16);

            await _authCharacteristic.WriteWithoutResponse(KeyBytes);
        }
예제 #2
0
 private async Task RequestRandomEncryptionKey(byte[] data)
 {
     Trace.WriteLine("2.Requesting random encryption key");
     await _authCharacteristic.WriteWithoutResponse(MiBand3ConversionHelper.CreateKey(data, _miBand3.SecretKey));
 }