示例#1
0
        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);
        }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
 static BluetoothClass Make(A_DeviceClass dc, A_ServiceClass sc)
 {
     return(SimpleBluetoothClassMock.Create(dc, sc));
 }