35 lines
891 B
C++
35 lines
891 B
C++
#ifndef PICAN_H
|
|
#define PICAN_H
|
|
|
|
#include "piiodevice.h"
|
|
|
|
|
|
class PIP_EXPORT PICAN: public PIIODevice
|
|
{
|
|
PIIODEVICE(PICAN)
|
|
public:
|
|
explicit PICAN(const PIString & path = PIString(), PIIODevice::DeviceMode mode = PIIODevice::ReadWrite);
|
|
~PICAN() {}
|
|
|
|
void setCANID(int id);
|
|
int CANID() const;
|
|
|
|
protected:
|
|
bool openDevice();
|
|
bool closeDevice();
|
|
int readDevice(void * read_to, int max_size);
|
|
int writeDevice(const void * data, int max_size);
|
|
PIString fullPathPrefix() const {return PIStringAscii("can");}
|
|
PIString constructFullPathDevice() const;
|
|
void configureFromFullPathDevice(const PIString & full_path);
|
|
PIPropertyStorage constructVariantDevice() const;
|
|
void configureFromVariantDevice(const PIPropertyStorage & d);
|
|
DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;}
|
|
|
|
private:
|
|
int sock;
|
|
int can_id;
|
|
};
|
|
|
|
#endif // PICAN_H
|