|
|
|
@ -44,6 +44,7 @@ Server::Server() {
|
|
|
|
|
thread = 0;
|
|
|
|
|
thread_running = 0;
|
|
|
|
|
railways.SetSize(200, 200);
|
|
|
|
|
status_text = "init server";
|
|
|
|
|
Load ();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -66,13 +67,11 @@ void Server::ThreadProcess() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Server::LockThread() {
|
|
|
|
|
debug(DEBUG_INFO, "%s:%d Server::LockThread", __FILE__, __LINE__);
|
|
|
|
|
pthread_mutex_lock (&mtx);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Server::UnLockThread() {
|
|
|
|
|
debug (DEBUG_INFO, "%s:%d Server::UnLockThreads", __FILE__, __LINE__);
|
|
|
|
|
pthread_mutex_unlock (&mtx);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -101,4 +100,42 @@ bool Server::IsChanged() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Set Mode Auto
|
|
|
|
|
void Server::ModeAuto() {
|
|
|
|
|
debug (0, "%s:%d * Mode Auto", __FILE__, __LINE__);
|
|
|
|
|
status_text = "Mode Auto";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Set Mode Manual
|
|
|
|
|
void Server::ModeManual() {
|
|
|
|
|
debug (0, "%s:%d * Mode Manual", __FILE__, __LINE__);
|
|
|
|
|
status_text = "Mode Manual";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Set Mode Error
|
|
|
|
|
// FIXME: maybe adding error text as parameter?
|
|
|
|
|
void Server::ModeError(string text) {
|
|
|
|
|
debug (0, "%s:%d * Mode Error :'%s'", __FILE__, __LINE__, text.c_str());
|
|
|
|
|
status_text = "Error:'" + text + "'";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Set Mode Reset
|
|
|
|
|
void Server::ModeReset() {
|
|
|
|
|
debug (0, "%s:%d * Reset Data", __FILE__, __LINE__);
|
|
|
|
|
status_text = "Mode Reset";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string Server::GetStatus(void) {
|
|
|
|
|
string retval;
|
|
|
|
|
|
|
|
|
|
LockThread();
|
|
|
|
|
retval = status_text;
|
|
|
|
|
UnLockThread();
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
};
|
|
|
|
|