Bluetooth через tcp ip

Can Android support Zeroconf/Bonjour over Bluetooth? How about TCP/IP?

On iPhone if I create custom service for example «_test._tcp.local.» in Bonjour I can seek/broadcast this service through WiFi or/and Bluetooth. It is possible on Android ? I know that there is jmDNS but from what I understand it works only through WiFi/Network, not Bluetooth. Thanks EDIT by Seva Alekseyev, who offered the bounty: I’m not after workarounds (like Zeroconf sans Bluetooth or Bluetooth sans Zeroconf). I’m after the real thing.

I’m very curious to know the answer regarding bluetooth. is JmDNS alowed to detect bonjour services exposed by bluetooth ??

Let start from the basics: is there a way to run TCP/IP over Bluetooth in Android? If so, one might be able to sic JmDNS on that particular interface. Maybe just the exposure, not the discovery, or vice versa.

PAN profile is not yet released for android. The code is present in the project but hidden. There are classes like BluetoothPan for PAN profile but but not to be used by developers

3 Answers 3

Not on bluetooth, because Android currently doesn’t support TCP/IP over bluetooth, and Android’s native NSD support (network service discovery) works over IP.

It DOES, however, work over Wi-Fi. Also, Android supports service discovery over Wi-Fi Direct, which gives you greater range and battery efficiency than bluetooth. For a guide on how to integrate service discovery into a wi-fi direct enabled application, check out the Android Training lesson.

Portions of this answer are duplicated from our Dear Android video response to this question

You can use BluetoothSocket and BluetoothServerSocket to create TCP like sockets over Bluetooth.

You may need to modify the jmdns library such that it creates bluetooth sockets if bluetooth is ON, otherwise creates simple sockets. Encapsulate the socket communication in a different class that creates socket conditionally.

Um, I’m ultimately after iOS-to-Android and vice versa service discovery. I don’t think those would interoperate, as the iOS implementation is TCP/IP-based.

yes, Thats a high probability, but the documentation says its similar to TCP sockets.. So give it a try..

The sample doesn’t claim Bluetooth compatibility and does not implement it. I had JmDNS integrated in my app for a while now; over TCP/IP on WiFi it talks to iOS fine. Now, just because the interface is similar, doesn’t mean RFCOMM sockets can talk to TCP/IP ones. Those are different transports. I don’t know enough about BT to know if it’s possible to reimplement TCP/IP from scratch on top of Android’s stack.

You can talk directly to the Bluetooth microcontroller and speak HCI to it, which lets you do anything, but that’s only possible if you’re root. The kernel’s public API to all this is firmly socket based. Unfortunately raw sockets in Bluetooth aren’t very useful and in order to do anything interesting you also have to talk to the local SDP server, which speaks godsdamned dbus and not any sensible protocol.

Читайте также:  Bluetooth гарнитура sennheiser hd 450 bt

There’s a couple of reasons why this is not possible currently. The one most related to your question is that — as you probably experienced — jmDNS requires a TCP/IP link to publish or browse services (it requires an IP address to bind to). As the other answers & comments state, you’d need an established PANU link for that, which Android currently doesn’t provide.

The other reasons it will not work are:

  • Apple uses a couple of mechanisms to assure iOS devices will only talk to other iOS devices. So even if you’d get Android into talking Bonjour-over-Bluetooth, it would only work Android-to-Android.
  • Apple certified devices in the MFi program have a special crypto chip which is supplied by Apple. I’m not sure if this applies to Bonjour-over-Bluetooth connections as well, but I’d assume it does.

You could instead look into using Bluetooth 4 LE — at least there’s an Apple API for that starting in iOS 5 providing a Slave profile, and extended to support a Master profile in iOS 6.

Источник

Bluetooth по IP?

Есть ли что-то похожее для Bluetooth через IP? (НЕ: IP через Bluetooth).

Это позволило бы физически отделить, скажем, смартфон с поддержкой BT от гарнитуры с поддержкой BT через Интернет.

Linux bnep мог бы сделать это, но я не смог найти инструкции, как это сделать.

5 ответов 5

Хотя в нашем технологическом мире сегодня все кажется возможным, насколько я знаю, настоящий Bluetooth-to-Bluetooth-over-IP никогда не был реализован. Я попытаюсь объяснить трудности, которые, хотя и не являются непреодолимыми, являются причиной этой ситуации.

Bluetooth сам по себе является стандартом беспроводной технологии для обмена данными на короткие расстояния. Обычно он используется для соединений между устройствами и включает в себя понятие сопряжения в целях безопасности. Протокол Bluetooth чрезвычайно универсален и может использоваться для многих целей. Его популярность проистекает из того факта, что он работает на частотах, которые нелицензированы на глобальном уровне (но не являются нерегулируемыми).

Для настоящего Bluetooth-to-Bluetooth-over-IP потребуется два устройства Bluetooth для сопряжения по IP. Это не то же самое, что, например, два человека, использующие Skype для общения через Интернет через гарнитуру Bluetooth, потому что гарнитуры связаны с их компьютерами, а не друг с другом.

Вот некоторые выдержки из модели OSI статьи Wikipedia:

Уровень 1: Физический уровень

Физический уровень Parallel SCSI работает на этом уровне, как и физические уровни Ethernet и других локальных сетей, таких как Token Ring, FDDI, ITU-T G.hn и IEEE 802.11 (Wi-Fi), а также в качестве персональных сетей, таких как Bluetooth и IEEE 802.15.4.

Уровень 4: Транспортный уровень

Примером протокола транспортного уровня в стандартном интернет-стеке является протокол управления передачей (TCP), обычно построенный поверх интернет-протокола (IP).

TCP и UDP являются протоколами транспортного уровня 4, тогда как Bluetooth является протоколом более низкого физического уровня 1. Таким образом, вы можете использовать TCP или UDP поверх Bluetooth, точно так же, как вы используете TCP и UDP поверх Ethernet, но наоборот гораздо сложнее.

Стек протоколов Bluetooth включает в себя свои собственные транспортные протоколы: L2CAP и RFCOMM, где каналы RFCOMM используют уровень L2CAP. Вы можете работать с IP-туннелированием через Bluetooth, инкапсулируя UDP-пакеты по каналам RFCOMM.

Читайте также:  Bluetooth speaker как подключить к

Использование чистой терминологии OSI невозможно, даже является противоречием терминов, использовать протокол уровня 1 над уровнем 4.

С практической точки зрения, мы могли бы представить программный виртуальный адаптер, который объявил бы себя в Linux на стороне клиента как физическое устройство Bluetooth и передавал через IP другое виртуальное устройство Bluetooth в серверной Linux. Но сложность, связанная с эмуляцией уровней OSI, и усилия по программированию, необходимые для реализации очень универсального протокола Bluetooth и его архитектуры «ведущий-ведомый», делают создание такой общей реализации очень трудоемким упражнением, которое вряд ли произойдет, поскольку в настоящее время нет спроса на такое программное обеспечение.

Источник

How to Use TCP/IP over Bluetooth

PAN and BNEP are the “official” way to do networking with BlueTooth. BNEP is a simple encapsulation of Ethernet frames in a L2CAP session. PAN is the BlueTooth profile using BNEP and defining how to do networking. It includes the definition of the SDP attributes and various node roles. What are the node roles ? It’s just something to make your life more complex. In a typical Ad-Hoc scenario, the server will have the role GN, and up to 7 clients with role PANU can be connected to it. An Access Point would take a NAP (yeah, boring).

The support of BNEP in BlueZ is quite new and and not yet documented in the Official Howto, but there is an alternate Unofficial Howto.

As usual, I’ll go straight to a very simple example of setting up TCP/IP between two nodes. You can do more complex stuff by reading the Howto above.
First, you need to set up the server. The server will listen for incomming connections. In our example, it’s not an Access Point, so we do :

> modprobe bnep > pand --listen --role GN

On the client side, we first need to know the address of the server ; the inquiry is currently done like this :

> hcitool inq Inquiring . 50:C2:00:03:C4:DC clock offset: 0x2454 class: 0x020300

Now, you just need to connect to the other side :

> modprobe bnep > pand --connect 50:C2:00:03:C4:DC

Unfortunately, pand can fail silently, so the way to check if this succeed is to see if a new device bnep0 has been created, either using cat /proc/net/dev or ifconfig bnep0. You may notice that the interface is down, that’s perfectly normal at this point. In case of problem, you need to check the logs for details, in my case /var/log/daemon.log.

What’s left ? BNEP is only a Ethernet emulation. We need to configure TCP/IP on the new interface. This is done with :

> ifconfig bnep0 10.10.10.1 broadcast 10.10.10.255 netmask 255.255.255.0

Just remember that you need to assign an different IP address on each node, otherwise it won’t work. After that, you should be able to ping, telnet and all that jazz.

To terminate your connection on the client, just do :

> ifconfig bnep0 down > pand --kill 50:C2:00:03:C4:DC

If you want to get more fancy, you can use HotPlug to automatically assign IP addresses to the bnep interfaces, and you can start playing with the SPD to know which node support PAN or not. And, if you want to build an Access Point, you will need to enable bridging. The HOWTO explains that in details.

Читайте также:  Блютуз колонка hopestar h41

Источник

Is it possible to have a TCP/IP network using bluetooth?

If you’re talking about using your mobile phone as a tethering device over Bluetooth then sure this is:

PdaNet QR Code

Is Linux (Ubuntu etc.) supported?

Meanwhile only Bluetooth DUN is supported (requires android 2.0) on Linux.

We are working on a linux port for USB Tether but it may take a while.

via junefabrics.com

Sorry for misunderstanding you. Could any of the following MPD control applications on the Android Market help you?

TCP/IP and Bluetooth are different protocols. Although, technically this would be WiFi vs Bluetooth. A WiFi device (which uses TCP/IP) cannot communicate with a Bluetooth device, they essentially speak different languages.

It would be possible to have an application on your phone and computer which communicate via bluetooth and then the computer side could then send the necessary commands to the music player. You’d have to develop, or get someone to develop, the apps though.

I’ve never said I wanted to connect a wifi device with a bluetooth device, even a child would know that’s not possible. What I want is the bluetooth of my phone and the bluetooth of my laptop talking to each one, using the upper layer as a TCP/IP protocol.

Oh right. Sorry. This may help and I guess concludes that you can — giovanni.wordpress.com/2007/04/06/…

Источник

Is it possible to a establish a TCP/IP connection over bluetooth?

Well, the following situation: Devices need to communicate offline. The only option is Bluetooth. Here, the issue is that Bluetooth’s encryption is insecure and broken. See KNOB attack. Therefore, I’m looking for a way to securely exchange data between two bluetooth devices (e.g.,Android and iOS). My current guess is to establish a TCP/IP connection to make use of typical SSL/TLS libraries with all its other advantages (certificate check etc.) and disable bluetooth’s encryption for performance increase. https://developer.android.com/reference/android/bluetooth/BluetoothSocket Unfortunately, it appears that this idea is already not supported by Android. They do offer some sort of BluetoothSocket, but that is not a TCP/IP connection afaik. Does anyone know a way to enable a TCP/IP connection between two bluetooth devices? Any other idea to secure that broken bluetooth connection?

1 Answer 1

Answer is yes. Nevertheless, there is no usable API on Android (before Android 9 via reflections maybe) and it still has the hide annotation on Android 11 in its source code, besides the requirement of a special permission to be used by system apps only.

The only option is to enable Bluetooth tethering via system settings (if available). Next devices connecting over Bluetooth will get an IP address, while the smartphone acts as the router. The access of services on the smartphone is permitted.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.12.43529

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Оцените статью
Adblock
detector