R
R
Risent Veber2016-08-12 11:59:14
Python
Risent Veber, 2016-08-12 11:59:14

What port should be specified in order to connect from a computer to an android device using Python?

There is a bluetooth button designed to connect to an Android mobile phone
There is a code from the instructions for the pybluez library: https://people.csail.mit.edu/albert/bluez-intro/x2...

import bluetooth

bd_addr = "01:23:45:67:89:AB"

port = 1#какой порт указать?

sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )
sock.connect((bd_addr, port))

The Mac address of the device can be successfully determined using the command bluetooth.discover_devices()
Which port to specify in order for the connection to be successful? Maybe someone knows the standard ports on which it is worth trying to connect?
PS The context of the task is as follows: there is a bluetooth button (originally designed to connect to the phone in order to take a selfie) - you need to connect to it from a computer and process the click in python.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Chudnovsky, 2016-08-12
@Frankenstine

First you need to figure out what kind of interaction (according to what protocol) this "bluetooth button" supports, and from this already "dance". Trying to randomly open a port if the device is not listening to it is a peculiar occupation.
I suspect that this "button" is a HID-device, i.e. looks like a banal blue-toothed keyboard, so look here for example:
https://shkspr.mobi/blog/2016/02/cheap-bluetooth-b...

D
davidnum95, 2016-08-12
@davidnum95

Depending on socket type: https://developer.android.com/reference/android/bl...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question