是否有可能使用蓝牙进行连接iOS和Android设备? [英] Is it possible to connect iOS and android device using Bluetooth?

查看:207
本文介绍了是否有可能使用蓝牙进行连接iOS和Android设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要提出申请,配对的iOS和Android设备(iPhone 5,iPad 3的,银河S3,的Nexus 7都使用蓝牙4.0),然后将数据发送给对方。

I have to make an application to pair an iOS and Android device (iPhone 5, iPad 3, Galaxy S3, Nexus 7 they all use Bluetooth 4.0) and then send data to each other.


  • 是这个数据量的限制?我们可以发送类似照片或PDF?

我已经做了使用CoreBluetooth 2 iOS设备,并从苹果公司的 BTLE_Transfer

I've already done the pairing and sending data between 2 iOS devices using CoreBluetooth and the sample code from Apple BTLE_Transfer

什么,我的理解,外围设备(服务器)可以发布到中央(客户端)。
这个中心是自缚扫描,然后试图通过寻找广告服务的UUID找到服务器。

Of what i understood, a Peripheral (Server) can Advertise to a Central (Client). This central is scanning around itself, and then try to find the Server by looking for the UUID of the service advertised.

当我在Android服务器,它正在等待(听)的连接,我知道的UUID和我的服务器的MAC地址。
但是,当我与我的iPhone(扫描当然相同的UUID)扫描,我无法找到服务器。

When i make a Server on Android, it is waiting for a connection (listening), i know the UUID and the mac address of my Server. But when i scan with my iPhone (scanning for the same UUID of course), i can't find the server.


  • 那么,有没有为Android服务器做广告一样外围iOS上?
  • 可能性
  • 或者,也许我的iPhone客户端使用服务器的MAC地址来连接可能性?

推荐答案

问:这种数据量的限制?我们可以发送类似照片或PDF?

蓝牙低功耗不是为发送大量数据的优化的,也不是为流优化。它更适合用于发送数据的小块定期地(例如,温度的读数,时间等)。请看看<一个href=\"http://stackoverflow.com/questions/23049137/bluetooth-low-energy-devices-go-to-deep-sleep-in-transactions/23077940#23077940\">this回答了解如何转移BLE是经典蓝牙不同。话虽这么说,你仍然可以发送大量的数据在BLE和数据量是无限的。然而,这可能最终会被不可靠和相对较慢。

Bluetooth Low Energy was not optimised for sending large amounts of data, nor is it optimised for streaming. It is more suitable for sending small chunks of data periodically (e.g. temperature readings, time, etc). Please have a look at this answer to understand how BLE transfer is different from classic Bluetooth. That being said, you can still send large amounts of data over BLE, and the amount of data is unlimited. However, this might end up being unreliable and relatively slow.

问:那么,有没有为Android服务器做广告一样外围iOS上的可能性

作为一个服务器/客户端是从一个完全不同的事情外设/中央: -

Being a server/client is a completely different thing from being a peripheral/central:-

周边/中心决定了如何建立连接的。中央设备应该发起连接。外围设备应该做广告,等待连接请求。

Peripheral/central dictates how the connection is made. A central device should initiate the connection. A peripheral device should advertise and wait for a connection request.

客户端/服务器决定了数据的分布。关贸总协定服务器存储数据。关贸总协定客户可以读,写或通知(获得读数的连续流),这个数据。在大多数情况下,服务器也外围,但这不是强制性的。

Client/Server dictates how the data is distributed. The Gatt Server holds the data. The Gatt Client can read, write or be notified (getting a continuous stream of readings) of this data. In most cases, the server is also the peripheral, but this is not mandatory.

因此​​,要回答你的问题,是的,服务器可以做广告像在iOS上的外设。然而,针对Android,这个功能还不可用,将是下一个版本(Android版L)发布的一部分。请参阅本<一个href=\"http://stackoverflow.com/questions/18008507/android-4-3-as-a-bluetooth-le-peripheral/18020153#18020153\">answer了解更多信息。

So to answer your question, yes, the server can advertise like the peripheral on iOS. However, for Android, this feature is not yet available and will be part of the next version (Android L) release. Please see this answer for more information.

问:也许我的iPhone客户端使用服务器的MAC地址来连接可能性

据我所知,在coreBluetooth你需要的UUID,而不是MAC地址,外围设备连接到它。不需要知道从外围设备被通告的服务。你最好的选择将是扫描外围设备,然后连接到一个具有UUID和/或广告数据,美知道属于你的周围。

As far as I know, in coreBluetooth you would need the UUID, not the MAC Address, of a peripheral device to connect to it. You do not need to know the services being advertised from the peripheral device. Your best bet would be to scan for peripheral devices, and then connect to the one with the UUID and/or the advertising data that u know belong to your peripheral.

我希望这有助于。

这篇关于是否有可能使用蓝牙进行连接iOS和Android设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆