Skip to content
Snippets Groups Projects
Commit 40337e0a authored by Lucio Zambon's avatar Lucio Zambon
Browse files

current_exception

parent df593801
No related branches found
No related tags found
No related merge requests found
......@@ -127,6 +127,22 @@ void Fug::delete_device() {
delete mutex;
}
/*
* timestamp()
* send a timestamp to standard output
*/
void Fug::msg2err(const char *msg)
{
struct tm *mytime;
char timeLong[80];
time_t myTime_t;
myTime_t = time(NULL);
mytime = localtime(&myTime_t);
// memset(mytime, 0, sizeof(tmTemp));
strftime(timeLong, 79, "%Y-%m-%d %H:%M:%S ", mytime);
// strftime(timeShort, 79, "%H:%M:%S ", mytime);
cerr << timeLong << msg << endl;
}
//+----------------------------------------------------------------------------
//
......@@ -829,6 +845,11 @@ void Fug::write_Fug(string input) {
e, static_cast<const char *>(rsn), out_stream.str(),
static_cast<const char *>("SerialDeviceServer error"), Tango::ERR);
}
catch (...) {
std::exception_ptr p = std::current_exception();
std::cerr <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
msg2err("DevSerWriteString write_Fug");
}
/*printf("write %s: %s\n",device_name.c_str(),input.c_str());*/
......@@ -879,6 +900,11 @@ string Fug::read_Fug() {
e, static_cast<const char *>(rsn), out_stream.str(),
static_cast<const char *>("SerialDeviceServer error"), Tango::ERR);
}
catch (...) {
std::exception_ptr p = std::current_exception();
std::cerr <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
msg2err("read_Fug DevSerWriteString");
}
omni_thread::sleep(
0, sleeptime * 1000000); // convert millisecond to microsecond
......@@ -894,6 +920,11 @@ string Fug::read_Fug() {
e, static_cast<const char *>(rsn), out_stream.str(),
static_cast<const char *>("SerialDeviceServer error"), Tango::ERR);
}
catch (...) {
std::exception_ptr p = std::current_exception();
std::cerr <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
msg2err("read_Fug DevSerReadRaw");
}
Dout >> strout;
if (strout.length() == 0) {
......@@ -910,13 +941,20 @@ string Fug::read_Fug() {
omni_thread::sleep(0, FUG_SER_SLEEP * 1000000);
i = 0;
while (strout[i] == 'E') {
if (strout[i+3] == '\n' || strout[i+3] == '\r' || strout[i+3] == '\0') i++;
i += 3;
try {
i = 0;
while (strout[i] == 'E') {
if (strout[i+3] == '\n' || strout[i+3] == '\r' || strout[i+3] == '\0') i++;
i += 3;
}
strout_filt.resize(strout.length() - i);
strncpy((char *)strout_filt.c_str(), (char *)strout.c_str() + i, strout.length() - i);
}
catch (...) {
std::exception_ptr p = std::current_exception();
std::cerr <<(p ? p.__cxa_exception_type()->name() : "null") << std::endl;
msg2err("read_Fug misc");
}
strout_filt.resize(strout.length() - i);
strncpy((char *)strout_filt.c_str(), (char *)strout.c_str() + i, strout.length() - i);
/*printf("read %s: %s\n",device_name.c_str(),strout_filt.c_str());*/
......
......@@ -321,6 +321,7 @@ public :
friend class fugthread;
private :
void msg2err(const char *msg);
Tango::DeviceProxy *devserial;
int abortflag; // flag used to abort loops (On,Off,Standby)
bool FugStat[5];
......
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