private void ShutupCompiler() { this.deviceInfo = new BLUETOOTH_DEVICE_INFO(); this.authenticationMethod = BluetoothAuthenticationMethod.Legacy; this.ioCapability = BluetoothIoCapability.Undefined; this.authenticationRequirements = BluetoothAuthenticationRequirements.MITMProtectionNotDefined; this.Numeric_Value_Passkey = 0; }
internal BluetoothAuthenticationEventArgs(BLUETOOTH_DEVICE_INFO device, ref BLUETOOTH_AUTHENTICATION_CALLBACK_PARAMS?authCallbackParams) : this(device) { _authMethod = authCallbackParams.Value.authenticationMethod; _authReq = authCallbackParams.Value.authenticationRequirements; _authIoCapa = authCallbackParams.Value.ioCapability; const uint MaxSixDigitDecimal = 999999; Debug.Assert(authCallbackParams.Value.Numeric_Value_Passkey <= MaxSixDigitDecimal); _numberOrPasskey = checked ((int)authCallbackParams.Value.Numeric_Value_Passkey); }
/// <summary> /// Initialize an instance of <see cref="T:InTheHand.Net.Bluetooth.BluetoothWin32AuthenticationEventArgs"/>. /// </summary> /// - /// <param name="device">The device information to store in the event args. /// </param> public BluetoothAuthenticationEventArgs(BluetoothDeviceInfo device) { if (device == null) { throw new ArgumentNullException("device"); } m_device = device; _authMethod = BluetoothAuthenticationMethod.Legacy; _authReq = BluetoothAuthenticationRequirements.MITMProtectionNotDefined; _authIoCapa = BluetoothIoCapability.Undefined; _numberOrPasskey = null; // Keep compiler happy on CF2 build. }
internal BluetoothAuthenticationEventArgs(int errorCode, BluetoothAuthenticationEventArgs previousEa) { if (previousEa == null) { throw new ArgumentNullException("previousEa"); } m_device = previousEa.Device; _authIoCapa = previousEa._authIoCapa; _authMethod = previousEa._authMethod; _authReq = previousEa._authReq; _numberOrPasskey = previousEa._numberOrPasskey; m_attemptNumber = previousEa.AttemptNumber + 1; // m_errorCode = errorCode; }
//---- void DoTestSsbProps(BluetoothAuthenticationMethod am, BluetoothAuthenticationRequirements req, BluetoothIoCapability ioCapa, bool?expectedJustWorksValue) { var cbParams = new BLUETOOTH_AUTHENTICATION_CALLBACK_PARAMS(); cbParams.authenticationMethod = am; cbParams.authenticationRequirements = req; cbParams.ioCapability = ioCapa; var e = Create_EA(cbParams); // Assert.AreEqual(am, e.AuthenticationMethod, "am"); Assert.AreEqual(req, e.AuthenticationRequirements, "req"); Assert.AreEqual(ioCapa, e.IoCapability, "ioCapa"); Assert.AreEqual(expectedJustWorksValue, e.JustWorksNumericComparison, "jw"); }