[Development] New Module for Serial Buses

Marc Mutz marc.mutz at kdab.com
Sat May 30 01:35:14 CEST 2015


On Friday 29 May 2015 16:27:59 Denis Shienkov wrote:
> I don't know as how will look the CanDevice (derived from QIODevice),
> because QIODevice::read/write methods has not sense. Because, what is
> happens in case I want to write half (or part) of CAN message?
> 
> IMHO, this is non-trivial issue to try to unify all interfaces to
> QIODevice..  :)

QCanBusMessage msg = ...;
QIODevice *bus = ...;
{
    QDataStream s(bus);
    s << msg;
}

To write only part of a message (why would you ever want do that?), use 
QBuffer instead of *bus, then get only the first N bytes.

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list