On my Raspberry Pi 4, I would like to use bluetoothctl in non interactive mode but cannot figure out how to access the gatt menu. The command should be something like "bluetoothctl gatt menu list-attributes" but this syntax doesn't work.
For info, in interactive mode one must type "menu gatt" to switch to gatt menu and then commands like "list-attributes" are available.
Thanks in advance !
Eric
bluetoothctl allows for the commands to be specified using a dot to indicate the hierarchy. e.g gatt.list-attributes
For accessing information with code BlueZ provides APIs using D-Bus bindings.
For example, to get all the information BlueZ has can be done like this:
import pydbus
bus = pydbus.SystemBus()
obj_mngr = bus.get('org.bluez', '/')
mngd_objs = obj_mngr.GetManagedObjects()
for path, obj in mngd_objs.items():
print(obj)
The API is documented at:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc
Examples are available at:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test
Related
Previously it was possible to check device orientation
driver.getOrientation()
In appium java-client 8.3 this method is no longer available. How to check current device orientation now?
Found it - Mobile specific extensions have been respectively moved to IOSDriver and AndroidDriver.
You will need to cast the driver. From Java Client 8.x.x and Appium 2.0, mobile specific extension commands have been moved to respective drivers.
Basically, if you have initialised the driver like below,
AppiumDriver driver = new AndroidDriver() or
AppiumDriver driver = new IOSDriver(),
Then, cast the driver like below,
((AndroidDriver) driver).getOrientation(); OR
((IOSDriver) driver).getOrientation();
This way, you access the mobile specific extension commands.
My apps using bonjour service to conversation with each other via local network.
I am facing a problem on Xcode12 with OS14 device.
A device publish a service with server type name depends on self device IP address
(example: 192.168.33.20 -> _1921683320._tcp)
B device searching a service with service type depends on A device IP address
(example: _1921683320._tcp)
According to apple document..From OS14~
https://developer.apple.com/documentation/multipeerconnectivity
Important
Apps that use the local network must provide a usage string in their Info.plist with the key NSLocalNetworkUsageDescription. Apps that use Bonjour must also declare the services they browse, using the NSBonjourServices key.
because my service type name is named by local network ip, it is changeable base on local network setting, so I am thinking about to using wildcard to define the service type name.
example: _*._tcp
but seems wildcard is not available on this definition.(I tried it)
I am also thinking about changing the naming method on A device
(example: 192.168.33.20 -> _20._tcp)
and add _1.tcp ~ _255.tcp to info-plist
But if I changed the naming method, B device could not find A device until version up.
Any idea for this problem? Please help.
I'm currently working through the same issue - Bonjour service name is dynamically created based off the iPad name to form a local mesh network. The conclusion that I have came to is com.apple.developer.networking.multicast is required for this to function without completely overhauling how all that logic is done. (More info here)
You will have to request permission from apple by filling out a form here. Let me know if this works for you!
The thing I am finding is, you "might" not be able to use a wildcard, but you can put multiple entries in the plist:
Item 0 _multicastapp0-p._tcp
Item 1 _multicastapp1-p._tcp
Item 2 _multicastapp2-p._tcp
Item 3 _multicastapp3-p._tcp
etc
Item N _multicastappN-p._tcp
So for some reason if you are trying to have multiple "Groups" of 8 or have a device have it's own "collection" i.e. be a server and have 3 devices connect to that, you can.
I haven't "fully" tested but I am going to be doing this in my apps, I did test using multiple keys tho, but not fully, no errors...
I start my qt application in the user's .profile file (not root) to make the app start on boot. Sometimes when my application start, it reports an warning as below:
"No such interface 'org.freedesktop.DBus.Properties' on object at path /org/freedesktop/NetworkManager/ActiveConnection/1"
I searched on google but did not find a explanation.
It seems my app is still working fine, but I want to locate the problem.
The application is running on ubuntu and using Qt5.
Thanks in advance.
Edit
I tried to debug dbus based on Eligijus Pupeikis's help with running:
gdbus introspect --system \
--dest org.freedesktop.NetworkManager \
--object-path /org/freedesktop/NetworkManager/ActiveConnection
it returns:
node /org/freedesktop/NetworkManager/ActiveConnection {
node 0 {
};
};
So, this means there is no such object just as the error message said, right?
And also, this gns3 team member says this problem is about Qt and Ubuntu.
Does this mean I don't need to solve it? I not familiar with the relationship between dbus and qt.
Most likely there is no such object "/org/freedesktop/NetworkManager/ActiveConnection/1" and because of that it can't find 'org.freedesktop.DBus.Properties' interface.
From documentation org.freedesktop.NetworkManager.Connection.Active :
Objects that implement the Connection.Active interface represent an attempt to connect to a network using the details provided by a Connection object. The Connection.Active object tracks the life-cycle of the connection attempt and if successful indicates whether the connected network is the "default" or preferred network for access. NetworkManager has the concept of connections, which can be thought of as settings, a profile or a configuration that can be applied on a networking device. Such settings-connections are exposed as D-Bus object and the active-connection expresses this relationship between device and settings-connection. At any time a settings-connection can only be activated on one device and vice versa. However, during activation and deactivation multiple active-connections can reference the same device or settings-connection as they are waiting to be activated or to be deactivated.
You can't know that that ActiveConnection object with specifically index 1 exists so you need to check by reading ActiveConnections property from /org/freedesktop/NetworkManager object's org.freedesktop.NetworkManager interface.
To have better visualize and understand how it looks I suggest D-Bus debugger. If you are using Gnome check out D-Feet.
I'm trying to programmatically control a twain scanner within my custom application. I don't want to show the scanner's native UI.
I set CAP_INDICATORS capability to FALSE, and set CAP_UICONTROLLABLE capability to TRUE.
Then I start the scan using DG_CONTROL / DAT_USERINTERFACE / MSG_ENABLEDS, while ShowUI in TW_USERINTERFACE structure is set to FALSE.
I tested through different scanners. While my Epson DS-30 scanner is working as expected without ui, my Avision A6 scanner still shows a progress UI during scan:
This UI appears when I call DG_IMAGE / DAT_IMAGEINFO / MSG_GET operation, to get the image details from scanner. With DAT_IMAGEINFO command, this A6 scanner start to scan the paper, and after scanning complete, I could finally recieve the TW_IMAGEINFO structure.
I don't receive any TWRC_CHECKSTATUS while setting the UI mode.
So does this particular scanner actually doesn't support twain without UI?
Or could I have something workaround to disable this UI?
Actually a lot depends on the driver implementation.
So what happens is the options you set from the application configures the driver based on the capabilities it supports. If the driver capability for UI-less scanning is not allowed to be configurable by the driver in that case your application implementation may not work as expected.
Please refer to the TWAIN documentation for complete details.
In openmoko (stable hybrid release, SHR), how do you programatically turn-off the screensaver (the dimmed/blank screen after a few seconds of inactivity) just while your app is running?
In X, you can run
xset s off
to turn off the screensaver. Similarly gnome/freedesktop exposes a DBUS API to control and inhibit screensaver mode. I don't know if OpenMoko supports the freedesktop spec, but if it does you should be able to use DBUS directly. You can see how Totem does it here.
FSORaw is a wrapper that you can use externally to claim resources like the display. This will prevent screen blanking. But if it is your own application I would recommend claiming the same display resources within your software.
more about fsoraw and resources
It is possible to do that through the D-BUS API of freesmartphone, it is also possible to prevent suspends.
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage org.freesmartphone.Usage.SetResourcePolicy CPU auto
mdbus -s org.freesmartphone.ousaged /org/freesmartphone/Usage org.freesmartphone.Usage.SetResourcePolicy Display auto
Replace auto with enabled or disabled.
You can find the documentation for this D-BUS method at http://git.freesmartphone.org/?p=specs.git;a=blob_plain;f=html/org.freesmartphone.Usage.html;hb=HEAD#GetResourcePolicy