简体   繁体   English

iOS和蓝牙低能耗,可能性?

[英]iOS and Bluetooth low energy, possibilities?

I want to connect a robot, via Bluetooth, with an iPhone (4S or more) via Bluetooth low energy (BLE) 4.0. 我想通过蓝牙将机器人与iPhone(4S或更高)通过蓝牙低功耗 (BLE)4.0连接起来。 This robots require to send all the notifications of the iPhone to the device. 此机器人需要将iPhone的所有通知发送到设备。

For example: If the iPhone gets a new email, I must send the event to the robot, and it will blink an LED. 例如:如果iPhone收到新电子邮件,我必须将事件发送给机器人,它会使LED闪烁。 Stop. 停止。

I want to know if the iOS Bluetooth APIs of the Bluetooth framework can do this, or better, can share the Internet connection or whatever that can do this work. 我想知道蓝牙框架的iOS蓝牙API是否可以做到这一点,或者更好,可以共享互联网连接或任何可以做这项工作的东西。

I'm asking this, because I have heard that the APIs have some restrictions. 我问这个,因为我听说API有一些限制。

PS: ANY solution that can do this is very accepted (no Wi-Fi connection solution). PS:可以做到这一点的任何解决方案都是非常接受的(没有Wi-Fi连接解决方​​案)。

Bluetooth LE would be the way you want to go here, because standard Bluetooth requires your device to be MFi -compliant. 蓝牙LE将是您想要的方式,因为标准蓝牙要求您的设备符合MFi标准。 Standard Wi-Fi could also work, if you're able to require the presence of the supporting network. 如果您能够要求支持网络的存在,标准Wi-Fi也可以工作。

As of iOS 6.0, you can set up your iPhone as a Bluetooth LE peripheral, which would allow it to send notifications to your device, if it is configured in a central role. 从iOS 6.0开始,您可以将iPhone设置为蓝牙LE外围设备,如果配置为中心角色,则可以向设备发送通知。 That would be a pretty power-efficient way of updating your device with new data. 这将是一种使用新数据更新设备的一种非常省电的方式。

However, there's one large hurdle to doing what you want here. 然而,在这里做你想做的事情有一个很大的障碍。 iOS applications have no access to system-wide notifications, so you won't be able to listen for incoming emails or other notifications like that. iOS应用程序无法访问系统范围的通知,因此您将无法收听传入的电子邮件或其他类似的通知。 You'll be able to send data to your device via Bluetooth LE, but you're not going to know when emails come in so that you could send that to your device. 您将能够通过蓝牙LE将数据发送到您的设备,但您不会知道电子邮件何时进入,以便您可以将其发送到您的设备。

With bluetooth 4, you could control a robot, as well as create a "notification" bot. 使用蓝牙4,您可以控制机器人,以及创建“通知”机器人。 It could be done quite easily. 它可以很容易地完成。 However as mentioned, you can't access system wide notifications in iOS. 但是,如上所述,您无法在iOS中访问系统范围的通知。

However, you could use an external solution to listen for system notifications and then an API to listen a singular encoded notification and have your app listen to that. 但是,您可以使用外部解决方案来侦听系统通知,然后使用API​​来侦听单个编码通知,并让您的应用程序收听。

One such system is https://ifttt.com (no affiliation) 一个这样的系统是https://ifttt.com (没有隶属关系)

There are also some great plug and play BLE options for rapid prototyping. 还有一些很棒的即插即用BLE选项可用于快速原型设计。

You can do it. 你能行的。 A simple solution would be let a phone check your email periodically. 一个简单的解决方案是让手机定期检查您的电子邮件。 Don't rely or try to use external Apple applications to do that, but use services provided by your mail. 不要依赖或尝试使用外部Apple应用程序来执行此操作,而是使用您的邮件提供的服务。

In the case of Gmail , try to go to https://mail.google.com/mail/feed/atom . 如果是Gmail ,请尝试访问https://mail.google.com/mail/feed/atom If you are logged in your Gmail, you will see the unread mail in XML format. 如果您已登录Gmail,则会看到XML格式的未读邮件。 The way you would login using a URL is: https://username:password@mail.google.com/mail/feed/atom 您使用网址登录的方式是: https://username:password@mail.google.com/mail/feed/atom

So what you can do is periodically parse the output and when <fullcount>0</fullcount> value changes call your robot service via BLE which should act as a callback for this specific event. 所以你可以做的是定期解析输出,当<fullcount>0</fullcount>值改变时,通过BLE调用你的机器人服务,这应该作为这个特定事件的回调。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM