I just tried to run a vala bluez example (found in the DbusClientSamples page) and I got this error:
GDBus.Error:org.freedesktop.DBus.Error.UnknownObject:
Method "DiscoverDevices" with signature "" on interface "org.bluez.Adapter"
doesn't exist
Is the sample using deprecated API? If yes, where can I find an updated document about bluez's DBUS API? All documents I find (by googling) contain the DiscoverDevices method, so I'm quite confused.
AFAICT org.bluez.Adapter is gone (I don't see it on my Fedora 20 system, running bluez-5.12). In its place is org.bluez.Adapter1. You can get all the latest documentation for the bluez D-Bus API at https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc
The best way to get the BlueZ DBus documentation is to download the source from the BlueZ web site, unpack it, then look in the doc directory. All of the current DBus APIs are listed there.
I've been using those documents a lot lately. You could ask for better, but they're good enough. It is mostly obvious, and the most non-obvious issues are explained.
The official BlueZ site also provides a blog post for BlueZ 5 API introduction and porting guide, that provides some descriptions on their DBus APIs. At the top of the page they wrote:
The BlueZ 5 D-Bus API contains significant changes compared to BlueZ
4. The bulk of the changes are due to the following features in BlueZ 5:
...
Introduction of interface versions (e.g. org.bluez.Adapter1). When new versions are introduced we’ll try to keep supporting at least the two latest versions simultaneously.
...
There is a section that discusses the DBus Object Manager:
Instead, an application would discover the available adapters by performing a ObjectManager.GetManagedObjects call and look for any returned objects with an “org.bluez.Adapter1″ interface.
Also, aside from checking out the docs directory of the BlueZ source code (as mentioned in the this and this answers), I find it also helpful to check the sample source codes in the test directory (https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test).
Here are parts of the example-advertisement code:
BLUEZ_SERVICE_NAME = 'org.bluez'
LE_ADVERTISING_MANAGER_IFACE = 'org.bluez.LEAdvertisingManager1'
DBUS_OM_IFACE = 'org.freedesktop.DBus.ObjectManager'
DBUS_PROP_IFACE = 'org.freedesktop.DBus.Properties'
...
def main(timeout=0):
...
adapter_props = dbus.Interface(bus.get_object(BLUEZ_SERVICE_NAME, adapter),
"org.freedesktop.DBus.Properties")
adapter_props.Set("org.bluez.Adapter1", "Powered", dbus.Boolean(1))
Related
I am doing research on quickbooks online integration using node and angular 8.
The official intuit developer site provides two node packages.
one is official from intuit and one is from community.
I have glanced through both of them.
the official package is fairly universal. It essentially is just a API client to send a request to remote server and the payload is basic json format.
the community package seems a bit more specific but the documentation seems a bit confusing.
Which one would you choose to do the work and why?
I would love to hear your input.
Thanks :)
The Intuit provided library (intuit-oauth) is specifically for authenticating and getting the OAuth token you need to communicate with the Quickbooks API, the other library (node-quickbooks) is for making the actual calls against the API endpoints.
You will need both libraries, unless you are handling authentication in a different way.
Fwiw for whoever finds this useful:
I forked intuit-oauth, added typescript and fixed vulnerabilities that have been fixed in the PRs of their repo for years and never updated here: https://www.npmjs.com/package/intuit-oauth-ts
Additionally I forked node-quickbooks, updated the api to return promises rather than relying on callbacks, resolved the discovery URLs automatically, changed the format of response objects to be more sensible, and added (unfortunately only some) of the typescript definitions for it here: https://www.npmjs.com/package/qbo. I don't have enough time to add the definitions for all of the files (largey because the included ones should be completely exhaustive for every property in the QBO api, which is timeconsuming to define). If someone would like to contribute by adding more of the typescript definitions or adding all of them, I would really appreciate it.
I am interested in any example angular app using intuit-oauth
Trying to work it out but getting issues since there is no document for typescript.
The help for configure in Qt commercial source 4.8.7 lists an option "-commercial" with the following description.
-commercial ........ Compile and link the Commercial Edition of Qt.
The options are also listed here, with the same brief explanation of this parameter, http://doc.qt.io/qt-4.8/configure-options.html
Since there are separate source packages for commercial (or enterprise) and open source, why is a flag needed? Also I can confirm that it successfully compiles also without giving this flag, which makes me wonder even more...
What does it actually do?
If you configure without commercial or opensource option you get asked with which license you want to use Qt: the commercial or the opensource one. I assume using one of these options just pre-answers this question.
EDIT: Sorry, I mixed something up. Forget the "answer".
I'm following the advice of Zimano on using the Bluez client as an example to implement Bluetooth in my Linux application.
I have installed:
libbluetooth-dev
libglib2.0-dev
libdbus-1-dev
The Bluez client example uses a D-Bus helper library that is included as part of Bluez in a gdbus folder when the soure code is downloaded.
I have looked at it for a few hours and I think if I want to follow the Bluez client example, I need to add and compile the gdbus source from the Bluez source with my program. My question is, do I have that wrong? Is that gdbus included elsewhere? The naming is so close to files in glib-2.0/gio that I am concerned that I am missing something.
GDBus is part of GIO, which is distributed with GLib.
Based on the package names you've provided I'm guessing you are using a Debian-derived distribution, so libglib2.0-dev is the package you need.
This is indeed quite a mess for naming. It appears to be that:
Official Glib Dbus library is named "GDBus", BUT it is part of "GIO" => thus you would (*) need (<glib.h> and) <gio/gio.h> , not <gdbus.h>
Bluez "gdbus.h" is their completely own local support library not found anywhere in binary form as such, also their license is restrictive for free inclusion.
(*) But of course the Bluez client still remains dependent on their own "gdbus.h" support library.
I need to get similar information on the current windows and virtual desktops as that provided by the command-line app wmctrl. I s there some (C/C++) API header & lib-files that I can use?
If it must be in C/C++, i think libxcb-wm is the most prominent one: very mature, still actively developed, and from Freedesktop, the same organization that created the EWMH spec.
On Debian/Ubuntu you have the binary packages libxcb-ewmh2 (run-time library) and libxcb-ewmh-dev (development headers), both from source package xcb-util-wm:
sudo apt install libxcb-ewmh-dev # also pulls libxcb-ewmh2, as usual
And official Documentation and Tutorial from Xorg
Download the source code of wmctrl and study it. If you are making some free software with the same or compatible GPLv2 license you could take some code from it.
There is only one source file main.c and it seems to do ordinary Xlib calls, notably XGetWindowProperty calls wrapped in get_property
I'm very surprised you asked the question here. With free software, it is so much simpler and quicker to download the source code and study it.
Is there any UI library that can be to build both a text user interface (ncurses) and graphical user interface (GTK? QT?) from the same source?
I know that debconf can be used with various frontends, I would like to build something similar but programmable.
The library that powers YaST independence to do ncurses, gtk and qt with one codebase provides what you are looking for, and it is not tied to YaST itself.
Actually libyui only requires the standard C++ library and phtreads (IIRC). The UI plugins require of course the respective libraries (Qt, ncurses). YaST uses libyui via a set of YCP bindings that export a YCP like API on top of libyui.
The library is a bit lowlevel (one layer below an event loop), my colleage Klaus Kämpf wrote about using it some time ago in his blog, including binding to scripting languages it using swig.
The only part that is SUSE specific is the packaging, so you would need to package it yourself. Stackoverflow did not allow me to link more than once. The code of the library is linked from Klaus blog. Replace libyui for "qt" and "ncurses" for the plugin's code.
Also google for "YaST Independence From YCP" to find a blog entry from Andreas Jäger on the subject.
you could write your program to uses ncurses, and then use PDCurses to convert it to an X11 application - as the readme advertise.
I know it because I've used it as portable curses, though I've never tested its X11 capabilities
Not exactly a library but you could consider writing a web app that degrades well to Lynx
The GoboLinux guys have created their own toolkit for python called AbsTK, they use it for their installer, which actually works really good. I have never used the toolkit myself, but the apps built with it seems solid.
There's Cursed GTK, but it seems a bit dated. I found some references to a port of Qt to ncurses called Qt Console, but it seems to have disappeared.
By using a library that targets both the text-mode and GUI environments, you have a big risk of getting stuck with the worst of both worlds.
You will be better off structuring your code using the MVC pattern, and providing separate views and controllers for each platform you target. Pushing all the logic down to the model classes has several other benefits:
The code will be easier to test because you are forced to keep the user interface out of the actual domain logic.
Your program can have user interfaces that have very little in common, e.g. a web UI, or an UI driven by speech.
You can run the program easily with no UI at all (i.e. script it) by accessing the model classes directly in the same way that the controller classes do.
I think what's used for configuring the linux kernel when compiling is dialog/cdialog/xdialog. But it's been a while since I've compiled a kernel, so my memory may be off. The most promising link I can find is this one for Xdialog.
Maybe tcl/tk would provide what you want http://www.tcl.tk/
Here's the page on interfacing with curses. There is a claim there of integration with ncurses.
http://www2.tcl.tk/2372