28 lines
450 B
C++
28 lines
450 B
C++
|
#include "UpsComand.h"
|
|||
|
|
|||
|
|
|||
|
UpsComand::UpsComand(string command)
|
|||
|
{
|
|||
|
m_command=command;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
UpsComand::~UpsComand(void)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
int UpsComand::GetRequestSequence(unsigned char* bseq)
|
|||
|
{
|
|||
|
for(size_t i=0;i<m_command.length();++i){
|
|||
|
bseq[i]=m_command[i];
|
|||
|
}
|
|||
|
return (int)m_command.length();
|
|||
|
}
|
|||
|
|
|||
|
bool UpsComand::Verify(unsigned char* rseq,int dlength)
|
|||
|
{
|
|||
|
if (dlength != 47)return false;
|
|||
|
if(rseq[0]!='(' || rseq[dlength-1]!='\r')return false;
|
|||
|
return true;
|
|||
|
}
|