Commit 8be16776 authored by Roberto Arturo Homs-Regojo's avatar Roberto Arturo Homs-Regojo Committed by Roberto Arturo Homs-Regojo

[wip] attribute test (testCmd)

parent f03c3500
......@@ -1187,8 +1187,8 @@ namespace lima
void getDebugInt(std::string &o_sn);
void setDebugInt(std::string &i_sn);
void setTest(int val);
void getTest(int &val);
void setTest(std::string &i_sn);
void getTest(std::string &o_sn);
void setTimestampMode(int mode);
void getTimestampMode(int &mode);
......@@ -1223,6 +1223,11 @@ void _pco_time2dwbase(double exp_time, DWORD &dwExp, WORD &wBase);
int __sprintfSExt(char *ptr, size_t nrMax, const char *format, ...);
char *str_trim_left(char *s);
char *str_trim_right(char *s);
char *str_trim(char *s);
char *str_toupper(char *s);
//================================================================
// LINUX
//================================================================
......
......@@ -94,8 +94,8 @@ namespace Pco
void getDebugInt(std::string &o_sn /Out/);
void setDebugInt(std::string &i_sn);
void setTest(int val) ;
void getTest(int &val /Out/) ;
void setTest(std::string &i_sn) ;
void getTest(std::string &o_sn /Out/) ;
void setTimestampMode(int mode);
void getTimestampMode(int &mode /Out/);
......
......@@ -65,11 +65,6 @@ const char *_timestamp_pcodetinfoctrlobj();
const char *_timestamp_pcocamerautils();
const char *_timestamp_pcoroictrlobj();
char *str_trim_left(char *s);
char *str_trim_right(char *s);
char *str_trim(char *s);
char *str_toupper(char *s);
char *_split_date(const char *s);
int __xlat_date(char *s1, char &ptrTo, int lenTo);
char *_xlat_date(char *s1, char *s2, char *s3);
......
......@@ -755,30 +755,6 @@ void Camera::getDebugIntTypes(std::string &o_sn)
o_sn = buff;
}
//====================================================================
// SIP - attrib
//====================================================================
void Camera::setTest(int val)
{
DEB_MEMBER_FUNCT();
int val0 = val;
val *= 2;
DEB_ALWAYS() << DEB_VAR2(val0, val);
}
void Camera::getTest(int &val)
{
DEB_MEMBER_FUNCT();
int valIn;
valIn = val;
val += 10;
DEB_ALWAYS() << DEB_VAR2(valIn, val);
}
//====================================================================
// SIP - attrib
//====================================================================
......@@ -1159,3 +1135,100 @@ void Camera::getParamsInfo(std::string &o_sn)
o_sn = buff;
}
//====================================================================
// SIP - attrib
//====================================================================
#define NRTOK 10
void Camera::setTest(std::string &i_sn)
{
DEB_MEMBER_FUNCT();
const char *cmd, *cmd0;
char msg[MSG1K];
int ikey = 0;
const char *tok[NRTOK];
int tokNr;
char *ptr = msg;
char *ptrMax = msg + sizeof(msg);
cmd0 = i_sn.c_str();
strncpy_s(buff, sizeof(buff), cmd0, sizeof(buff) - 1);
cmd = str_trim(buff);
tokNr = -1;
if (*cmd)
{
char *tokContext;
for (int i = 0; i < NRTOK; i++)
{
if ((tok[i] = strtok_s((char *)cmd, " ", &tokContext)) == NULL)
break;
cmd = NULL;
tokNr = i;
}
cmd = tok[0];
}
tokNr++;
// DEB_ALWAYS() << DEB_VAR2(cmd0, tokNr);
if (tokNr == 0)
return;
//------------------------------------------------
// syntax: mode 0x123
// mode 0x1234
//------------------------------------------------
if (_stricmp(cmd, "mode") == 0)
{
ptr += __sprintfSExt(ptr, ptrMax - ptr, "testCmdMode [0x%llx]",
m_pcoData->testCmdMode);
if (tokNr > 1)
{
int nr;
unsigned long long _testCmdMode;
nr = sscanf_s(tok[1], "0x%llx", &_testCmdMode);
if (nr == 1)
{
m_pcoData->testCmdMode = _testCmdMode;
ptr += __sprintfSExt(ptr, ptrMax - ptr, " changed OK> ");
}
else
{
ptr += __sprintfSExt(ptr, ptrMax - ptr,
" ERROR - NOT changed> ");
}
ptr += __sprintfSExt(ptr, ptrMax - ptr, "testCmdMode [0x%llx]",
m_pcoData->testCmdMode);
}
DEB_ALWAYS() << msg;
return;
}
//------------------------------------------------
//------------------------------------------------
//------------------------------------------------
// NOT FOUND
//------------------------------------------------
DEB_ALWAYS() << " command NOT FOUND " << cmd0;
}
void Camera::getTest(std::string &o_sn)
{
DEB_MEMBER_FUNCT();
char *ptr = buff;
char *ptrMax = buff + sizeof(buff);
ptr += __sprintfSExt(ptr, ptrMax - ptr, "valid commands:\n");
o_sn = buff;
}
//====================================================================
//====================================================================
......@@ -609,12 +609,12 @@ class PcoClass(PyTango.DeviceClass):
}],
'test':
[[PyTango.DevLong,
[[PyTango.DevString,
PyTango.SCALAR,
PyTango.READ_WRITE],
{
'unit': 'N/A',
'format': '%d',
'format': '%s',
'description': 'test'
}],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment