使用altbeacon api未检测到信标

时间:2016-08-30 07:58:15

标签: ibeacon

一个iPhone用于使用locate app传输ibeacon(接近度为2F234454-CF6D-4A0F-ADF2-F4911BA9FFA6)。 Android手机用于检测ibeacon。 当我调试时,我可以收到以下消息:

  

08-30 15:33:57.051 D / BluetoothLeScanner(27939):onScanResult() - ScanResult {mDevice = 6D:CC:9D:8D:3A:F3,mScanRecord = ScanRecord [mAdvertiseFlags = 26,mServiceUuids = null, mManufacturerSpecificData = {76 = [2,21,47,35,68,84,-49,109,74,15,-83,-14,-12,-111,27,-87,-1,-90, 0,0,0,0,-59]},mServiceData = {},mTxPowerLevel = -2147483648,mDeviceName = null],mRssi = -31,mTimestampNanos = 58705755631306}

但是在功能UWP中,没有信标。

RangingBeaconsInRegion

以下是我的实施:

 void RangingBeaconsInRegion(object sender, RangeEventArgs e)
    {
             await ClearData();
             var allBeacons = new List<Beacon>();
             if (e.Beacons.Count > 0)
             {
                 foreach (var b in e.Beacons)
                 {
                        allBeacons.Add(b);
                        int rssi = b.Rssi;
                        System.Diagnostics.Debug.WriteLine(rssi.ToString());
                  }

                        var orderedBeacons = allBeacons.OrderBy(b => b.Distance).ToList();
                        await UpdateData(orderedBeacons);
                    }
                    else
                    {
                        // unknown
                        await ClearData();
                    }
                }

2 个答案:

答案 0 :(得分:0)

如果你仔细查看设置beaconParsers的代码,你会发现有两个是构造的,但只有一个像这样添加:

beaconManager.BeaconParsers.Add(parser);

添加第二个调用以添加其他信标解析器应该可以解决问题。

答案 1 :(得分:0)

谢谢,这是我的错!我添加第二个调用后添加另一个信标解析器!还有一些奇怪的情况:我没有启动任何信标发射器,但是当我调试时,我得到以下输出:D / BluetoothLeScanner(6864):onScanResult() - ScanResult {mDevice = 58:D6:74:3A:34 :C5,mScanRecord = ScanRecord [mAdvertiseFlags = 6,mServiceUuids = null,mManufacturerSpecificData = {76 = [12,14,0,126,81,116,-16,10,52,84,15,98,113,29, -15,34]},mServiceData = {},mTxPowerLevel = -2147483648,mDeviceName = null],mRssi = -89,mTimestampNanos = 122142418198514} 08-31 09:11:13.943 D / BluetoothLeScanner(6864):onScanResult() - ScanResult {mDevice = 58:D6:74:3A:34:C5,mScanRecord = ScanRecord [mAdvertiseFlags = 6,mServiceUuids = null,mManufacturerSpecificData = { 76 = [12,14,0,126,81,116,-16,10,52,84,15,98,113,29,-15,34]},mServiceData = {},mTxPowerLevel = -2147483648,mDeviceName = null],mRssi = -89,mTimestampNanos = 122142560625598}。似乎检测到一个信标。