/*! \file pican.h * \ingroup IO * \~\brief * \~english CAN device * \~russian Устройство CAN */ /* PIP - Platform Independent Primitives CAN Andrey Bychkov work.a.b@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef PICAN_H #define PICAN_H #include "piiodevice.h" class PIP_EXPORT PICAN: public PIIODevice { PIIODEVICE(PICAN, "can"); public: explicit PICAN(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite); virtual ~PICAN(); void setCANID(int id); int CANID() const; int readedCANID() const; void interrupt() override; protected: bool openDevice() override; bool closeDevice() override; ssize_t readDevice(void * read_to, ssize_t max_size) override; ssize_t writeDevice(const void * data, ssize_t max_size) override; PIString constructFullPathDevice() const override; void configureFromFullPathDevice(const PIString & full_path) override; PIPropertyStorage constructVariantDevice() const override; void configureFromVariantDevice(const PIPropertyStorage & d) override; DeviceInfoFlags deviceInfoFlags() const override { return PIIODevice::Reliable; } private: PRIVATE_DECLARATION(PIP_EXPORT) int sock; int can_id, readed_id; }; #endif // PICAN_H