I need to detect when an HDMI cable has been plugged or unplugged. Getting a notification would be best, but polling would also do. I am using Qt (and Qt Creator as IDE). I don't need this to be cross platform, I can use OS-specific system calls.
Just from the top of my head: you can write a udev rule which sends a message via dbus to your application.
Related
I have a Wemos D1 Mini (ESP8266), flashed with WLED and I want to create an application like .exe and have control on turning it on/off and choose colors. Does anyone have any idea how I can do without to connect on wifi and just do everything via USB?
To control the WLED firmware over USB, you would use the firmware's ability to be controlled over a serial connection. It looks like you would open the virtual serial port that appears when you plug in the device, at a speed of 115200, and then you take the same JSON that you would POST to /json/state for controlling it over WiFi, and instead send it over the serial connection, and get your responses back over the serial connection.
You could also implement the TPM2 protocol, or the Adalight protocol (which doesn't really seem to be documented except in code), as those are also supposed to be supported.
If you want to do all this in C++ on Windows, you might start by reading the (very old) Windows tutorials for Win32 API serial port programming. If you only want to target Win10 or newer, you could learn C++/WinRT and then use the new WinRT serial APIs. Or you could consult the answers to this question about serial programming on Windows.
I have an Android app (not written in Qt) and a Linux application (written in Qt). They shall communicate via NFC with each other. The Linux box has an ACR122 smart card reader.
My plan is to use the Linux side as the initiator and the Android app as the target of the NFC communication. Moreover, I plan to use the peer-to-peer mode of NFC in the passive variant. I.e. the Linux box actively powers the HF field all the time, NFCIP-1 is used on the transport layer, on top of that LLCP and finally NDEF messages are exchanged.
If I understand the specs correctly, the initiator dictates the operation mode (424 kb/s, p2p-mode, passive). But I do not find any way how to set the operation mode through the Qt library.
What am I missing?
Some more background info
My initial idea was to (only) use libnfc for the Linux application as the application is only a CLI daemon and so Qt is actually not a real requirement. However, then I found out that libnfc is really low level. It does not provide an interface for the LLCP level nor NDEF data structures. I also found libllcp from nfc-tools and libndef (which is based on Qt core) but both seem to lack any documentation. Finally, I ended up with the idea to use Qt for the Linux application.
Is there a cross platform way to receive a signal (or other notification) in Qt, when a new serial port device becomes present, or one that was present before becomes absent? This is a simple case of getting to know when someone connected a new USB to serial port converter (discovering COM ports in windows and ttyS in linux). My only idea now is to periodically (for example using QTimer) run the QSerialPortInfo routines. Is there a way to accomplish this with event driven system? I would appreciate all help.
As of Qt 5.9, there is no such cross-platform way.
Whatever you'll do will be platform-specific.
Currently I want to create a qt application on my Desktop that say, has 3 buttons. These 3 buttons can change certain variables for my device, which will be connected to the desktop with a microcontroller.
I want my desktop application to be able to communicate with the microcontroller. For example, clicking a button might flip a certain boolean variable and the microcontroller will adjust accordingly.
I have no idea how to start and what sort of questions I should be asking and how to tackle this at a high level.
Thank you.
My desktop is a macbook pro retina 15-inch 2014 and my microcontroller is either an Teensy, or an Intel Atom.
I don't know what type of microcontroller you are using, but if it has support for UART you can use the QSerialPort lib (http://doc.qt.io/qt-5/qserialport.html) to send data using a serial port.
In case of an arduino, you can send messages using this lib directly via the USB emulated COM port. If it don't have USB emulated COM port, you should use a serial adapter (an Arduino board can play this role).
The first thing to look at is what communication buses are common between your desktop computer and your microcontroller. Does your microcontroller have USB or ethernet capabilities? Does your microcontroller have expansion boards for WiFi or bluetooth support? Do you have access to an I2C bus in your desktop PC?
Depending on the answers above, if your microcontroller and your computer do not share common communication buses, you might have to use intermediary hardware, for instance, you might want to use something like the FTDI USB (on your desktop) to UART (for the microcontroller) cables, you can find those here: http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm
In that case I'd recommend using a cable with VCD drivers, so the cable appears as a Serial port to your computer, which you can access in QT by using QSerialPort (http://doc.qt.io/qt-5/qserialport.html)
There would be other similar solutions, but I'd say that, if there are no shared buses between your microcontroller and host, this would be one of the most universal. Maybe if you specify your microcontroller or embedded board We could help a little more.
is it possible to tap into the USB drivers / resources with a windows console app (win32 c++)?
i would like to detect connected hardware, send and receive midi from my USB keyboard.
but i don't want to build a complete GUI app for my small needs to test my own hardware on perf board.
the main purpose is also to test the software written for the pic microcontroller, it's much faster debugging, rather than compiling and running with the chip from zif socket tot zif socket.
i need some directions, thank you.
This is possible. For midi keyboards, check the midiIn... functions