我已经完成了两个教程并且正在阅读基本的C.通过做最好的学习并在过去一周左右编写了一些轻量级的应用程序.我正在加快编写一些将使用ibeacon的应用程序.当我浏览一些示例并阅读参考指南时,我看到可以通过为每个UUID运行startMonitoringForRegion来扫描多个区域.好的,所以我想我可以为每个UUID运行它,但那不起作用.我确定我正在做一些基本上完全错误的事情......下面的代码是一个彻底的黑客攻击 - 一旦我得到语义,我将从带有API调用的数据库中提取UUID,然后循环遍历它们以激活监视.下面的代码导致最后一个循环只显示四个UUID中的两个.
在标题中:
@property (strong, nonatomic) CLBeaconRegion *myBeaconRegion;
@property (strong, nonatomic) CLBeaconRegion *myBeaconRegion2;
@property (strong, nonatomic) CLBeaconRegion *myBeaconRegion3;
@property (strong, nonatomic) CLBeaconRegion *myBeaconRegion4;
Run Code Online (Sandbox Code Playgroud)
在主要:
NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"86E4BDEA-C6FF-442C-95CB-E6E557A23CF2"];
self.myBeaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"com.appcoda.testregion"];
NSUUID *uuid2 = [[NSUUID alloc] initWithUUIDString:@"C9AFF296-A722-4F2D-8669-47B7CCC79A14"];
self.myBeaconRegion2 = [[CLBeaconRegion alloc] initWithProximityUUID:uuid2 identifier:@"com.appcoda.testregion"];
NSUUID *uuid3 = [[NSUUID alloc] initWithUUIDString:@"1DBDDC7C-49BB-48BF-A2F6-A4825BD514EA"];
self.myBeaconRegion3 = [[CLBeaconRegion alloc] initWithProximityUUID:uuid3 identifier:@"com.appcoda.testregion"];
NSUUID *uuid4 = [[NSUUID alloc] initWithUUIDString:@"8D942B9E-0197-4C81-8722-92144599E9F7"];
self.myBeaconRegion4 = [[CLBeaconRegion alloc] initWithProximityUUID:uuid4 identifier:@"com.appcoda.testregion"];
[self.locationManager startMonitoringForRegion:self.myBeaconRegion];
[self.locationManager startMonitoringForRegion:self.myBeaconRegion2];
[self.locationManager startMonitoringForRegion:self.myBeaconRegion3];
[self.locationManager …Run Code Online (Sandbox Code Playgroud) 我有最新的Mac Mini 2012型号.
我想将它用作信标,并尝试使用此项目:https://github.com/timd/MactsAsBeacon
我已经设置了正确的UUID,主要和次要,但我的应用程序无法识别它.
这个mac支持蓝牙4.0,但它不能作为信标.
我正在尝试访问didEnterRegion委托中最近的信标的主要值和次要值.但是,将值打印到控制台时,它们返回null
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region {
if ([region isKindOfClass:[CLBeaconRegion class]]) {
CLBeaconRegion *beaconRegion = (CLBeaconRegion *)region;
int major = [beaconRegion.major intValue];
int minor = [beaconRegion.minor intValue];
NSLog(@" Major %@ Minor %@", beaconRegion.major, beaconRegion.minor);
}
}
Run Code Online (Sandbox Code Playgroud) 在用例方面,didEnterRegion和didRangeBeacons之间的确切区别是什么?我的意思是当我应该实现didEnterRegion/didExitRegion以及何时应该实现didRangeBeacons?
每个委托方法的确切功能是什么?从苹果的文档来看,它不是很清楚.
- (void)locationManager:(CLLocationManager *)manager
didEnterRegion:(CLRegion *)region
{
}
Run Code Online (Sandbox Code Playgroud)
和
- (void)locationManager:(CLLocationManager *)manager
didRangeBeacons:(NSArray *)beacons
inRegion:(CLBeaconRegion *)region
{
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试从部署在实验室天花板上的低功耗蓝牙信标获得平滑的rssi值。我使用了加权均值滤波器和移动平均滤波器,但效果不佳。通过各种期刊论文,我知道卡尔曼滤波器可以用于此目的。但是我无法获得合适的数学方程来使用Objective-C进行编码。有人可以提供有关数学方程式或卡尔曼滤波器实现的任何提示吗?非常感谢。
我正在考虑实施基于信标的应用程序,以根据信标放置进行一些位置跟踪.根据我的阅读和理解,信标监控在电池寿命方面相当无害,但绝对会对电池寿命产生更大的影响.
测量时是否有任何规格或技巧/技术可以最大限度地减少电池消耗?测距时的电池寿命与GPS位置跟踪相比如何?
我花了几个月的时间开发基于iBeacons的应用程序,我真的很沮丧.
一般的想法是,当检测到信标时,向用户通知特定于该iBeacon的信息.
该应用程序设计如下,所有iBeacons具有相同的UUID,Major决定建筑物(博物馆,商店......)和Minor特定产品(图片,鞋子......).所以这个应用程序可以服务多个客户
当应用程序启动时,我开始使用我们的UUID对区域进行监视和测距.当应用程序处于前台时,一切都很完美.但是在背景或暂停状态下,问题就开始了.在背景或暂停状态下不允许测距.
我知道当您进入或退出信标区域时,应用程序将在后台启动约5秒钟.你可以在这五秒钟的后台进行测距,之后iOS会再次暂停你的应用程序.
我设法通过这里学到的技术在后台扩展了最多3分钟.我还通过notifyEntryStateOnDisplay = YES获得额外的回调;
但这还不够,如果客户进入应用程序处于后台或暂停状态的区域,他将收到通知.在额外的3分钟内,如果测距检测到另一个iBeacon,他将收到通知,但是当3分钟后台任务到期时,如果没有触发任何区域退出,他将不再收到任何通知.
在这样的场景中没有真正的解决方案吗?我认为这是一个非常常见的情况,我很惊讶没办法处理它.
编辑:我试图通过监测两个地区作为推荐David Young的回答来找到问题的解决方案.为了获得更多的进入/退出地区事件.
我添加了我实现的代码,试图监控两个区域.
但是我做错了一些事情和didRangeBeacons:InRegion:当预期是每秒时,回调每10毫秒触发一次.
在AppDelegate.m,我正在做以下内容didFinishLaunchingWithOptions:
[self.locationManager startMonitoringForRegion:self.beaconRegion];
[self.locationManager stopRangingBeaconsInRegion:self.beaconRegion];
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
[self.locationManager startMonitoringForRegion:self.beaconRegion2];
[self.locationManager stopRangingBeaconsInRegion:self.beaconRegion2];
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion2];
Run Code Online (Sandbox Code Playgroud)
然后,开启 didRangeBeacons:InRegion:
- (void) locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region{
if(beacons.count > 0){
[self.locationManager stopRangingBeaconsInRegion:region];
for (CLBeacon *beacon in beacons){
NSLog(@"beacon detected major: %@ minor: %@", beacon.major,beacon.minor);
}
[self.locationManager startRangingBeaconsInRegion:region];
}
}
Run Code Online (Sandbox Code Playgroud)
当我在模拟器上运行应用程序,并且每个网络的信标都在范围内时,大约每10毫秒就会在控制台上显示该消息.
我怀疑停止并重新启动测距是打破预期的回调流程,但当只有一个区域在范围内时,回调按预期每秒发生一次.
我有一个应用程序,在后台有各种信标.当我初始化我的CLLocationManager实例时,我开始使用该startMonitoringForRegion方法.我处理locationManager:didEnterRegion,locationManager:didExitRegion以及locationManager:didDetermineState:ForRegion委托方法.在这些方法中,我正在开启/关闭.
这一切似乎都很有效,除非当CLLocationManager用户已经在该区域内时进行初始化.在那种情况下,直到我退出然后重新进入该区域之前都locationManager:didEnterRegion不会locationManager:DidDetermineState:ForRegion被调用.我总是觉得这至少会触发,locationManager:DidDetermineState:ForRegion但事实并非如此.
有没有办法在我第一次开火时确定用户是否最初在该区域内startMonitoringForRegion?
我正在使用petermetz/cordova-plugin-ibeacon来检测我的移动设备周围的信标.我可以看到插件提供了以下有关的信息beacon,例如
uuid,major,minor,rssi,tx,accuracy
我想知道的是实际上是什么rssi,tx并且accuracy?如何使用这三个值(rssi,tx和accuracy)来计算到信标的距离?
我已经阅读了这个文档:什么是广播电源,RSSI和信标信号的其他特性?,但没有得到我正在寻找的信息或它太高级别让我理解.
非常感谢您的所有反馈.
bluetooth cordova bluetooth-lowenergy ibeacon ibeacon-android
我想在不知道uuid的情况下开发能够检测到许多信标设备的应用程序.但是我找不到办法做到这一点.我必须在代码中定义uuid.
我开发了一种可与已知设备配合使用的POC.
我的视图控制器代码:
-(void)setUpview
{
// Regardless of whether the device is a transmitter or receiver, we need a beacon region.
NSUUID * uid = [[NSUUID alloc] initWithUUIDString:@"78CDC73D-D678-4B35-A88A-C2E09E5B963F"];//[UIDevice currentDevice].identifierForVendor;
treasureId = @"com.eden.treasure";
self.beaconRegion = [[CLBeaconRegion alloc] initWithProximityUUID:uid identifier:treasureId];
// Location manager.
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
if([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[self.locationManager requestAlwaysAuthorization];
}
[self.locationManager startMonitoringForRegion:self.beaconRegion];
[self.locationManager startRangingBeaconsInRegion:self.beaconRegion];
[self locationManager:self.locationManager didStartMonitoringForRegion:self.beaconRegion];
[self.beaconRegion setNotifyEntryStateOnDisplay:YES];
[self.beaconRegion setNotifyOnEntry:YES];
[self.beaconRegion setNotifyOnExit:YES];
// self.peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:nil];
if ([UIDevice currentDevice].userInterfaceIdiom==UIUserInterfaceIdiomPad || [[[UIDevice …Run Code Online (Sandbox Code Playgroud)