Files
pip/libs/main/io_devices/pican.h
Бычков Андрей d13e68c206 threadedRead now const uchar *
pipacketextractor Header mode now more flexible
fix splitTime mode
more refactoring
add virtual override to functions
remove piforeach
replace 0 to nullptr
iterate over pimap via iterators
replace CONNECTU to CONNECT# with compile time check
2022-07-26 17:18:08 +03:00

60 lines
1.8 KiB
C++

/*! \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 <http://www.gnu.org/licenses/>.
*/
#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;
protected:
virtual bool openDevice() override;
virtual bool closeDevice() override;
virtual int readDevice(void * read_to, int max_size) override;
virtual int writeDevice(const void * data, int max_size) override;
virtual PIString constructFullPathDevice() const override;
virtual void configureFromFullPathDevice(const PIString & full_path) override;
virtual PIPropertyStorage constructVariantDevice() const override;
virtual void configureFromVariantDevice(const PIPropertyStorage & d) override;
virtual DeviceInfoFlags deviceInfoFlags() const override {return PIIODevice::Reliable;}
private:
int sock;
int can_id, readed_id;
};
#endif // PICAN_H