trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: June 2018

Re: read device with TQt

From: deloptes <deloptes@...>
Date: Sun, 10 Jun 2018 03:05:52 +0200
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