123 return "Logging enabled (Server)";
127 return "Logging enabled";
131 return "Logging disabled";
142 len = sprintf(str,
"{ \"RunFlag\":%d, \"Status\":\"%s\" , \"RunNr\":%d , \"Events\":%d , \"Volume\":\"%f\", \"Duration\":%d, \"Logging\":\"%s\" ,\"Filename\":\"%s \" , \"OpenFlag\":%d , \"Name\":\"%s\" } "
182 int len = sprintf(str,
"{ \"%s\":%f }", key, value);
191 int len = sprintf(str,
"{ \"%s\":%d }", key, value);
200 int len = sprintf(str,
"{ \"%s\":\"%s\" }", key, value);
224 len = sprintf(str,
"{ \"Events\":%d , \"Volume\":\"%f\" , \"Status\":\"%s\" }"
232 mg_printf(nc,
"HTTP/1.0 200 OK\r\nContent-Length: %d\r\n"
233 "Content-Type: application/json\r\n\r\n%s",
245 out.replace(out.find(x.str()),x.str().length(),
"");
252 len = sprintf(str,
"{ \"Status\":\"%s\" }"
257 mg_printf(nc,
"HTTP/1.0 200 OK\r\nContent-Length: %d\r\n"
258 "Content-Type: application/json\r\n\r\n%s",
271 out.replace(out.find(x.str()),x.str().length(),
"");
278 mg_printf(nc,
"{ \"Status\":\"%s\" }", out.c_str());
288 mg_printf(nc,
"HTTP/1.0 200 OK\r\nContent-Length: 0\r\n"
289 "Content-Type: text/html\r\n\r\n");
304 std::ostringstream
out;
322 if (
mg_vcmp ( &msg,
"daq_begin") == 0)
342 else if (
mg_vcmp ( &msg,
"daq_end") == 0)
352 else if (
mg_vcmp ( &msg,
"daq_open") == 0)
359 else if (
mg_vcmp ( &msg,
"daq_close") == 0)
366 else if (
mg_vcmp ( &msg,
"initial_update") == 0)
380 if (
mg_vcmp ( &hm->
uri,
"/send_updates") == 0)
386 else if (
mg_vcmp ( &hm->
uri,
"/daq_begin") == 0)
400 else if (
mg_vcmp ( &hm->
uri,
"/daq_end") == 0)
415 else if (
mg_vcmp ( &hm->
uri,
"/daq_open") == 0)
423 else if (
mg_vcmp ( &hm->
uri,
"/daq_close") == 0)
461 update(nc,
"LINE", __LINE__);
504 int port = (int) *(
int *)arg;
505 stringstream portstring;
506 portstring << port <<
ends;
528 cerr << __FILE__ <<
" " << __LINE__ <<
" Error starting server on port " << port << endl;
539 time_t last_time =
time(0);
540 time_t last_time_for_speed = last_time;
549 last_time_for_speed =
time(0);
554 if (
time(0) - last_time > 1)