Bluetooth

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Bluetooth

BenediktH

Hi,

i would like to use bluetooth to discover any bt-enabled device nearby.. i've try'd to initialize CoreBluetooth, but it always reports an unsupported state..

i have created CBCentralManager with a custom delegate 

            CBM = new MyCBCentralDelegate();
            manager = new CBCentralManager (CBM, MonoTouch.CoreFoundation.DispatchQueue.MainQueue);

 

        private class MyCBCentralDelegate : CBCentralManagerDelegate
        {
            public override void UpdatedState (CBCentralManager central)
            {
                switch (central.State) {
                    case CBCentralManagerState.PoweredOn:
                    {
                        PeripheralScanningOptions options = new PeripheralScanningOptions ();
                        options.AllowDuplicatesKey = true;
                        CBUUID[] serviceGuids = null;
                        central.ScanForPeripherals (serviceGuids, options);

                        break;
                    }
                    case CBCentralManagerState.Unsupported:
                    {
                        Console.WriteLine ("Unsupported");
                        break;
                    }
                        default:
                    {
                        Console.WriteLine (central.State.ToString());
                        break;
                    }
                }
            }

            public override void DiscoveredPeripheral (CBCentralManager central, CBPeripheral peripheral, NSDictionary advertisementData, NSNumber RSSI)
            {
                Console.WriteLine ("RSSI: " + RSSI);
            }
        }

 

any ideas?

 

Thanks in advance,

Benedikt

 

_______________________________________________
MonoTouch mailing list
[hidden email]
http://lists.ximian.com/mailman/listinfo/monotouch
fread() || die()