void DoTest(T_DeviceClass expectedDC, T_ServiceClass expectedSC, A_DeviceClass testDC, A_ServiceClass TestSC) { var abc = Make(testDC, TestSC); var cod = AndroidBthUtils.ConvertCoDs(abc); Assert.AreEqual(new ClassOfDevice(expectedDC, expectedSC), cod); }
private static void Assert(ServiceClass serviceClassWe, Android.Bluetooth.ServiceClass serviceClassAndroid) { var iwe = (int)serviceClassWe; var ian = (int)serviceClassAndroid; Debug.Assert(iwe == ConvertServiceClassAndroidTo32feet(ian), string.Format(CultureInfo.InvariantCulture, "Not equal {0}=0x{1:X} and {2}=0x{3:X}", serviceClassWe, iwe, serviceClassAndroid, ian)); }
private static int CountBits(Android.Bluetooth.ServiceClass checkSc) { int v = (int)checkSc; int count = 0; for (int i = 1; i != 0; ShiftLeftUnchecked(ref i)) { if ((v & i) != 0) { ++count; } } return(count); }
private static object DoHasServiceFunction(IMethodCallMessage mcMsg, Android.Bluetooth.ServiceClass sc) { object ret; var checkSc = (Android.Bluetooth.ServiceClass)mcMsg.InArgs[0]; var retB = (sc & checkSc) != 0; ret = retB; #if DEBUG var cb = CountBits(checkSc); Debug.Assert(cb == 1, "Check bits has more that one bit set, has " + cb + "set, it is: " + checkSc + " i.e. 0x" + ((int)checkSc).ToString("X8")); #endif return(ret); }
private static AndroidMockValues GetOriginalValuesClass() { Android.Bluetooth.ServiceClass scIIII = Android.Bluetooth.ServiceClass.LimitedDiscoverability | Android.Bluetooth.ServiceClass.ObjectTransfer; var v = new AndroidMockValues { Radio_Address = "00:11:22:AA:BB:CC", Radio_Name = "MyRadio1", // Adapter Radio_State = Android.Bluetooth.State.On, Radio_ScanMode = Android.Bluetooth.ScanMode.Connectable, // Device Device1_Address = "00:91:A2:2A:3B:4C", Device1_Name = "TheRemoteDeviceName", Device1_BondState = Bond.None, // Class Device1_Class_DeviceClass = Android.Bluetooth.DeviceClass.HealthPulseOximeter, Device1_Class_ServiceClass = scIIII, }; return(v); }
static BluetoothClass Make(A_DeviceClass dc, A_ServiceClass sc) { return(SimpleBluetoothClassMock.Create(dc, sc)); }