Hi, as I am advancing with TQt slowly, there are many things I want to know, so I am wondering right now what is the convenient method of reading a device, so that I can trigger somethin on events emitted by the device. I see there are few classes based on TQIODevice, but which should I use. I am interested in following: http://jwhsmith.net/2015/02/manipulating-rfkill-using-devices-programmatical...
I am sure there is a good example somewhere and you know exactly where.
thanks in advance
regards
deloptes wrote:
I am sure there is a good example somewhere and you know exactly where.
It turned out to be very easy, indeed and here is the example.
struct rfkill_event event;
event.idx = 0; event.type = RFKILL_TYPE_BLUETOOTH; event.op = RFKILL_OP_CHANGE; if (state == false) event.soft = 1; else event.soft = 0;
TQFile file("/dev/rfkill"); if (!file.open(IO_WriteOnly)) return;
TQDataStream out(&file); out << event.idx << event.type << event.op << event.soft; file.close();
this will flip the power switch on the bluetooth device on index idx=0
if I am wrong please let me know
regards