fp@922: /***************************************************************************** fp@922: * fp@922: * $Id$ fp@922: * fp@922: ****************************************************************************/ fp@922: fp@922: #ifndef __EC_MASTER_H__ fp@922: #define __EC_MASTER_H__ fp@922: fp@922: #include fp@956: #include fp@956: #include fp@922: using namespace std; fp@922: fp@935: #include "../master/ioctl.h" fp@935: fp@922: /****************************************************************************/ fp@922: fp@922: class MasterException: fp@922: public runtime_error fp@922: { fp@922: public: fp@922: /** Constructor with std::string parameter. */ fp@922: MasterException( fp@922: const string &s /**< Message. */ fp@922: ): runtime_error(s) {} fp@922: fp@922: /** Constructor with const char pointer parameter. */ fp@922: MasterException( fp@922: const char *s /**< Message. */ fp@922: ): runtime_error(s) {} fp@922: }; fp@922: fp@922: /****************************************************************************/ fp@922: fp@922: class Master fp@922: { fp@922: public: fp@922: Master(); fp@922: ~Master(); fp@922: fp@922: void open(unsigned int); fp@922: void close(); fp@922: fp@949: void outputData(int); fp@956: void setDebug(const vector &); fp@948: void showDomains(int); fp@922: void listSlaves(); fp@957: void showMaster(); fp@966: void listPdos(int, bool = false); fp@966: void listSdos(int, bool = false); fp@968: void sdoUpload(int, const string &, const vector &); fp@960: void requestStates(int, const vector &); fp@938: void generateXml(int); fp@922: fp@922: protected: fp@949: void outputDomainData(unsigned int); fp@948: void showDomain(unsigned int); fp@966: void listSlavePdos(uint16_t, bool = false, bool = false); fp@966: void listSlaveSdos(uint16_t, bool = false, bool = false); fp@938: void generateSlaveXml(uint16_t); fp@948: unsigned int domainCount(); fp@935: unsigned int slaveCount(); fp@957: void getMaster(ec_ioctl_master_t *); fp@935: void slaveSyncs(uint16_t); fp@948: void getDomain(ec_ioctl_domain_t *, unsigned int); fp@950: void getFmmu(ec_ioctl_domain_fmmu_t *, unsigned int, unsigned int); fp@950: void getData(ec_ioctl_data_t *, unsigned int, unsigned int, fp@950: unsigned char *); fp@935: void getSlave(ec_ioctl_slave_t *, uint16_t); fp@935: void getSync(ec_ioctl_sync_t *, uint16_t, uint8_t); fp@935: void getPdo(ec_ioctl_pdo_t *, uint16_t, uint8_t, uint8_t); fp@935: void getPdoEntry(ec_ioctl_pdo_entry_t *, uint16_t, uint8_t, uint8_t, fp@935: uint8_t); fp@965: void getSdo(ec_ioctl_sdo_t *, uint16_t, uint16_t); fp@968: void getSdoEntry(ec_ioctl_sdo_entry_t *, uint16_t, int, uint8_t); fp@960: void requestState(uint16_t, uint8_t); fp@935: fp@935: static string slaveState(uint8_t); fp@968: static void printRawData(const uint8_t *, unsigned int); fp@922: fp@922: private: fp@968: enum {DefaultTargetSize = 1024}; fp@968: fp@922: unsigned int index; fp@922: int fd; fp@922: }; fp@922: fp@922: /****************************************************************************/ fp@922: fp@922: #endif