BlueZ 5 - Connecting to a Bluetooth LE heart rate watch - bluetooth

I'm pretty much new to using BlueZ 5 and I've been experimenting with a Bluetooth LE heart rate watch. I would really appreciate if someone can point me to the right direction.
When I run the "test-heartrate" test, I see the following error:
Traceback (most recent call last):
File "./test-heartrate", line 88, in <module>
properties = dev_prop.GetAll(HEARTRATE_INTERFACE)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line
651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.InvalidArgs:
No such interface 'org.bluez.HeartRate1'
Not sure what I'm doing wrong. Here're some relevant information
BlueZ version installed: 5.24
For installation, I followed the steps listed in: http://www.linuxfromscratch.org/blfs/view/svn/general/bluez.html (with one addition: I added --enable-experimental during configuration)
It seems I'm facing the same issue as described at:
http://comments.gmane.org/gmane.linux.bluez.kernel/47931
I've followed the suggestion provided as well as tried passing -E to
bluetoothd while running it but to no avail.
I can successfully run:
test-discovery : To discover devices, including the heart-rate watch
test-device connect : To connect to this device
But the one that is failing for me is test-heartrate
Even after connecting to the device, when I try to introspect:
dbus-send --system --dest=org.bluez --print-reply [obj_path] org.freedesktop.DBus.Introspectable.Introspect, I don't see the
org.bluez.HeartRate1 interface showing up, with its appropriate methods.
I can post the entire introspection data, along with the device properties that I get, if that helps.
Would really appreciate any helpful pointer in this regard. Thanks!!

Related

Method "StopDiscovery" with signature "" on interface "org.bluez.Adapter1" doesn't exist

Running a script here that connects to 2 Bluetooth adapters and collects data to send via mqtt. Its been running relatively smoothly on my RPi Zero 2 W with LM1010 BT USB adapter (internal wifi and BT adapter for RPi are disabled) for about 2 years now. However, yesterday, I ran just your normal system updates 'sudo apt-get update then upgrade', now when I try to run the script, I get these errors.
I don't know even where to start with this one, and if you can provide some suggestions, that would be great.
INFO: Adapter status - Powered: True
INFO: Starting discovery...
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.9/site-packages/gatt/gatt_linux.py", line 156, in stop_discovery
self._adapter.StopDiscovery()
File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
return self._connection.call_blocking(self._named_service,
File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: Method "StopDiscovery" with signature "" on interface "org.bluez.Adapter1" doesn't exist
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/solar-monitor/solar-monitor.py", line 84, in <module>
device_manager.stop_discovery()
File "/home/pi/.local/lib/python3.9/site-packages/gatt/gatt_linux.py", line 161, in stop_discovery
raise _error_from_dbus_error(e)
gatt.errors.Failed: Method "StopDiscovery" with signature "" on interface "org.bluez.Adapter1" doesn't exist
ran script, but seems to crash at BLE scan part now after system updates

Problem running odoo-bin on MacOS (ValueError: current limit exceeds maximum limit)

I am unable to get Odoo 14 running on my MacOS machine. Some research into the following error suggests that I can manually configure the memory limits which may resolve the issue but I cannot find the relevant config files on my machine.
I've checked and reinstalled all of the requirements and I can't find much information to point me in the right direction.
(venv) kilgow#wmbp odoo-dev % python3 odoo/odoo-bin
2021-09-18 15:56:53,295 1931 INFO ? odoo: Odoo version 14.0
2021-09-18 15:56:53,295 1931 INFO ? odoo: addons paths: ['/Users/kilgow/Desktop/odoo-dev/odoo/odoo/addons', '/Users/kilgow/Library/Application Support/Odoo/addons/14.0', '/Users/kilgow/Desktop/odoo-dev/odoo/addons']
2021-09-18 15:56:53,295 1931 INFO ? odoo: database: default#default:default
2021-09-18 15:56:53,351 1931 INFO ? odoo.addons.base.models.ir_actions_report: You need Wkhtmltopdf to print a pdf version of the reports.
Traceback (most recent call last):
File "/Users/kilgow/Desktop/odoo-dev/odoo/odoo-bin", line 8, in <module>
odoo.cli.main()
File "/Users/kilgow/Desktop/odoo-dev/odoo/odoo/cli/command.py", line 61, in main
o.run(args)
File "/Users/kilgow/Desktop/odoo-dev/odoo/odoo/cli/server.py", line 178, in run
main(args)
File "/Users/kilgow/Desktop/odoo-dev/odoo/odoo/cli/server.py", line 172, in main
rc = odoo.service.server.start(preload=preload, stop=stop)
File "/Users/kilgow/Desktop/odoo-dev/odoo/odoo/service/server.py", line 1298, in start
rc = server.run(preload, stop)
File "/Users/kilgow/Desktop/odoo-dev/odoo/odoo/service/server.py", line 510, in run
self.start(stop=stop)
File "/Users/kilgow/Desktop/odoo-dev/odoo/odoo/service/server.py", line 452, in start
set_limit_memory_hard()
File "/Users/kilgow/Desktop/odoo-dev/odoo/odoo/service/server.py", line 83, in set_limit_memory_hard
resource.setrlimit(rlimit, (config['limit_memory_hard'], hard))
ValueError: current limit exceeds maximum limit
(venv) kilgow#wmbp odoo-dev % python3 odoo/odoo-bin
You should check out this documentation for more info, so the easy way is add an extra argument to your run script like below.
python3 odoo-bin --addons-path=addons -d mydb --limit-memory-hard 0
I believe this could be due to the machine using an M1 chip. Manually increasing the memory limits did not resolve the problem.
I’ve managed to work around the issue by running Odoo and Postgres in Docker containers instead.

Switching to new Tor identity on Android using QPython

After successfully installing QPython and Orbot on my Android device, I've pip-installed a well-known stem library and tried to use it for changing Tor identity by sending NEWNYM signal to control port.
On PC, this code
from stem.control import Controller
from stem import Signal
with Controller.from_port(port=9051) as ctrl:
ctrl.authenticate()
ctrl.signal(Signal.NEWNYM)
works perfectly.
But, on Android device, QPython returns an error:TypeError: decode() argument 1 must be string, not None. Authentication fails.
How could I overcome this problem? Maybe, I should look towards AnroidFacade SL4A API to interact with Tor?
I'am running Android 7.1 at Nokia 3. ControlPort was set to constantly be 9051 by using Torrc Custom Config in Orbot Settings.
Upd Here's a traceback stack:
/data/user/0/org.qpython.qpy/files/bin/qpython-android5.sh "/storage/emulated/0/qpython/scripts/new.py" && exit
d/0/qpython/scripts/new.py" && exit <
Traceback (most recent call last):
File "/storage/emulated/0/qpython/scripts/new.py", line 6, in <module>
ctrl.authenticate()
File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/stem-1.6.0-py2.7.egg/stem/control.py", line 1092, in authenticate
stem.connection.authenticate(self, *args, **kwargs)
File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/stem-1.6.0-py2.7.egg/stem/connection.py", line 530, in authenticate
protocolinfo_response = get_protocolinfo(controller)
File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/stem-1.6.0-py2.7.egg/stem/connection.py", line 1022, in get_protocolinfo
stem.response.convert('PROTOCOLINFO', protocolinfo_response)
File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/stem-1.6.0-py2.7.egg/stem/response/__init__.py", line 124, in convert
message._parse_message(**kwargs)
File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/stem-1.6.0-py2.7.egg/stem/response/protocolinfo.py", line 110, in _parse_message
self.cookie_path = line.pop_mapping(True, True, get_bytes = True)[1].decode(sys.getfilesystemencoding())
TypeError: decode() argument 1 must be string, not None
1|NE1:/ $

Phone Book Access (PBAP) client for Linux (Raspberry Pi)

i want to access the contacts of my smartphone over bluetooth. This should be made as first step of a project of my with a raspberry pi. I read something about the phone bok access protocol (PBAP).
But all i could was not very helpful for me. The most examples i found where to old.
I already managed to pair and connect my smart phone (OnePlus One). I also can see that is support PBAP. I use bluez in version 5.23-2+rpi1.
I found two examples of an PBAP client, one from obexd (http://code.metager.de/source/xref/linux/bluetooth/obexd/test/pbap-client) and one from bluez (http://code.metager.de/source/xref/linux/bluetooth/bluez/test/pbap-client).
If i execute the obexd example on the pi i get the following error:
Creating Session
Traceback (most recent call last):
File "pbap-client-obexd.py", line 110, in <module>
session_path = client.CreateSession(sys.argv[1], { "Target": "PBAP" })
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.bluez.obex.Error.Failed: No adapter found
If i execute the bluez example i get the following error:
Creating Session
Traceback (most recent call last):
File "pbap-client-bluez.py", line 128, in <module>
session_path = client.CreateSession(sys.argv[1], { "Target": "PBAP" })
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: Method "CreateSession" with signature "sa{ss}" on interface "org.bluez.obex.Client1" doesn't exist
Does anyone of you have an idea to fix it, an actual tutorial or an other example?
Thank you
After searching a few hours later, i found a python library called PyOBEX. It contains some examples, e.g. a PBAP-Client, a example to download files over bluetooth and much more. It also contains all methods for pairing and connecting. Works on first try for me.
Link:
https://bitbucket.org/dboddie/pyobex/overview
PyOBEX is the right choice. you can also have a look into pypbap which has both pbap client and server built on top of PyOBEX. And has nice REPL to playaround with all pbap functionalities.

Cqlsh error on cassandra 2.0.1

We recently upgraded to cassandra 2.0.1 with cqlsh 4.0.1. I am seeing timeout errors/ broken pipe while using the cqlsh client. Please see error trace below. I have verified that the cluster is Up using nodetool and I am able to read/write using mapreduce. Please advice.
Thanks,
Prateek
Traceback (most recent call last):
File "./bin/cqlsh", line 897, in perform_statement_untraced
self.cursor.execute(statement, decoder=decoder)
File "./bin/../lib/cql-internal-only-1.4.0.zip/cql-1.4.0/cql/cursor.py", line 80, in execute
response = self.get_response(prepared_q, cl)
File "./bin/../lib/cql-internal-only-1.4.0.zip/cql-1.4.0/cql/thrifteries.py", line 77, in get_response
return self.handle_cql_execution_errors(doquery, compressed_q, compress, cl)
File "./bin/../lib/cql-internal-only-1.4.0.zip/cql-1.4.0/cql/thrifteries.py", line 96, in handle_cql_execution_errors
return executor(*args, **kwargs)
File "./bin/../lib/cql-internal-only-1.4.0.zip/cql-1.4.0/cql/cassandra/Cassandra.py", line 1782, in execute_cql3_query
self.send_execute_cql3_query(query, compression, consistency)
File "./bin/../lib/cql-internal-only-1.4.0.zip/cql-1.4.0/cql/cassandra/Cassandra.py", line 1793, in send_execute_cql3_query
self._oprot.trans.flush()
File "./bin/../lib/thrift-python-internal-only-0.9.1.zip/thrift/transport/TTransport.py", line 292, in flush
self.__trans.write(buf)
File "./bin/../lib/thrift-python-internal-only-0.9.1.zip/thrift/transport/TSocket.py", line 128, in write
plus = self.handle.send(buff)
error: [Errno 32] Broken pipe
If you have an open cqlsh session, it will always give you Errno 32 if the Cassandra instance that it connected to was stopped or even just restarted. You will have to restart cqlsh in order to re-establish a connection to the server.
If you see this problem without having stopped or restarted a Cassandra server, then please supply and additional details about conditions that lead up to this error.

Resources