114 lines
2.5 KiB
C++
114 lines
2.5 KiB
C++
#pragma once
|
|
#include "Command.h"
|
|
#include <string>
|
|
|
|
union MitsubishiValue
|
|
{
|
|
unsigned char bvalue[4];
|
|
int ivalue;
|
|
};
|
|
|
|
union SanyoValue_Int64
|
|
{
|
|
unsigned char bvalue[8];
|
|
int64_t lvalue;
|
|
};
|
|
|
|
union SanyoValue_Short
|
|
{
|
|
unsigned char bvalue[2];
|
|
short svalue;
|
|
};
|
|
|
|
class MitsubishiCommand:public Command
|
|
{
|
|
public:
|
|
MitsubishiCommand(unsigned char addr);
|
|
~MitsubishiCommand();
|
|
int GetRequestSequence(unsigned char* bseq);
|
|
bool Verify(unsigned char* buffer, int len);
|
|
|
|
unsigned char GetAddr() { return m_addr; }
|
|
int GetPositionValue() { return m_value; }
|
|
|
|
protected:
|
|
unsigned char m_addr;
|
|
int m_value;
|
|
};
|
|
|
|
class SanyoCommand :public Command
|
|
{
|
|
public:
|
|
SanyoCommand(unsigned char addr, std::string ctrl, std::string code, std::string group, std::string param);
|
|
virtual ~SanyoCommand();
|
|
virtual int GetRequestSequence(unsigned char* bseq);
|
|
virtual bool Verify(unsigned char* buffer, int len) { return false; }
|
|
int ConstReturnSize();
|
|
unsigned char GetAddr() { return m_addr; }
|
|
protected:
|
|
unsigned char m_addr;
|
|
std::string m_ctrl;
|
|
std::string m_code;
|
|
std::string m_group;
|
|
std::string m_param;
|
|
int m_ResponseLength;
|
|
};
|
|
|
|
class SanyoReadEncoderPosCommand :public SanyoCommand
|
|
{
|
|
public:
|
|
SanyoReadEncoderPosCommand(unsigned char addr, std::string ctrl, std::string code,
|
|
std::string group, std::string param);
|
|
~SanyoReadEncoderPosCommand();
|
|
long GetPositionValue() { return m_value; }
|
|
bool Verify(unsigned char* buffer, int len);
|
|
|
|
private:
|
|
long m_value;
|
|
short m_cycles;
|
|
int m_singal;
|
|
public:
|
|
static const int ABS_CYCLE = 131072;
|
|
};
|
|
|
|
class SanyoReadLoadTorqueCommand:public SanyoCommand
|
|
{
|
|
public:
|
|
SanyoReadLoadTorqueCommand(unsigned char addr, std::string ctrl, std::string code, std::string group, std::string param);
|
|
~SanyoReadLoadTorqueCommand();
|
|
bool Verify(unsigned char* buffer, int len);
|
|
short GetValue() { return m_Value; }
|
|
private:
|
|
short m_Value;
|
|
};
|
|
|
|
class SanyoReadAlarmCommand :public SanyoCommand
|
|
{
|
|
public:
|
|
SanyoReadAlarmCommand(unsigned char addr, std::string ctrl, std::string code);
|
|
~SanyoReadAlarmCommand();
|
|
bool Verify(unsigned char* buffer, int len);
|
|
int GetValue() { return m_Value; }
|
|
int GetRequestSequence(unsigned char* bseq);
|
|
private:
|
|
int m_Value;
|
|
};
|
|
|
|
class SiemensCommand :public Command
|
|
{
|
|
public:
|
|
SiemensCommand(unsigned char addr);
|
|
~SiemensCommand();
|
|
int GetRequestSequence(unsigned char* bseq);
|
|
bool Verify(unsigned char* buffer, int len);
|
|
|
|
unsigned char GetAddr() { return m_addr; }
|
|
long GetPositionValue() { return m_value; }
|
|
protected:
|
|
unsigned char m_addr;
|
|
long m_value;
|
|
|
|
private:
|
|
|
|
};
|