[Interest] QCanBusDevice inheritance

Denis Shienkov denis.shienkov at gmail.com
Wed Sep 9 14:46:42 CEST 2015


Benjamin,

I forwarded your message to the mailing list back (you likely forgot to do
it?). Now it could available to comments and for other developers (if you
don't object).

BR,
Denis

2015-09-09 15:46 GMT+03:00 Denis Shienkov <denis.shienkov at gmail.com>:

> Benjamin,
>
> I forwarded your message to the mailing list back (you likely forgot to do
> it?). Now it could available to comments and for other developers (if you
> don't object).
>
> 2015-09-09 11:10 GMT+03:00 Benjamin TERRIER <b.terrier at gmail.com>:
>
>> 2015-09-08 19:37 GMT+02:00 Denis Shienkov <denis.shienkov at gmail.com>:
>> > Hi.
>> >
>> > Because QIODevice is inconsistent with the CAN frames. The CAN uses a
>> > minimal entity - frame, which can not be divided to bytes. Besides,
>> > QIODevice's read/write/bytesAvailable methods has not sense, you can not
>> > read/write a half of frame and so on. You can not know a size of frame
>> > to serialize it, because its size is various. And others, others, others
>> > CAN specific reasons. Please, read comments in codereview commits on
>> > gerrit for acquaintance.
>> >
>> > BR,
>> > Denis
>> >
>> > 08.09.2015 18:50, Benjamin TERRIER пишет:
>> >> Hi,
>> >>
>> >> Following the announce of Qt 5.6 Alpha, I checked the brand new
>> >> QCanBusDevice and I've been wondering why the developers did not want
>> >> to use QIODevice (the git logs show that all dependencies have been
>> >> purposely removed).
>> >>
>> >> Cheers,
>> >>
>> >> Benjamin
>> >> _______________________________________________
>> >> Interest mailing list
>> >> Interest at qt-project.org
>> >> http://lists.qt-project.org/mailman/listinfo/interest
>> >
>> > _______________________________________________
>> > Interest mailing list
>> > Interest at qt-project.org
>> > http://lists.qt-project.org/mailman/listinfo/interest
>>
>> Hi,
>>
>> Thanks for your response but I still don't get why QIODevice has been
>> discarded for CAN while it is used for QUdpSocket.
>>
>> First, frames can always be divided into bytes, there length is an
>> integer multiple of byte. If you are talking about the fact that
>> fields within a frame are not 8 bits longs (identifier can be 11),
>> this should be handled by the underlying CAN library.
>>
>> I also don't get why not knowing the size of a frame can be a problem,
>> UDP datagrams size can vary yet QUdpSocket inherits QIODevice.
>>
>> Finally, QIODevice read/write/bytesAvailable can be given a sense, for
>> instance bytesAvailable could return the sum of the size of all
>> received CAN frames (I do agree it has a limited use but it does not
>> mean it doesn't make sense).
>>
>> My point is a QCanBusDevice is an I/O device and therefore should be a
>> QIODevice as, I quote, "The QIODevice class is the base interface
>> class of all I/O devices in Qt". And the fact that some QIODevice
>> functions are not a perfect fit for CAN should not be a reason not to
>> use it as such cases seems to have been taken into account in the
>> design of the QIODevice class (look at QIODevice::pos(), it is
>> explicitly stated that this function might not make sense).
>>
>> BR,
>>
>> Benjamin
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150909/88c87400/attachment.html>


More information about the Interest mailing list