void respToRTSPRequest(RTSPClient *clientInfo, RTSPmsg msg) {
	printf("locking...\n");
	pthread_mutex_lock(&clientInfo->clientLock);
	printf("locked...\n");
	if (strcmp(msg.command, "SETUP") == 0)
	{
		processSetup(clientInfo, msg);
	}
	else if (verifySession(clientInfo->session_id, msg.session_id) == 0)
	{
		if (strcmp(msg.command, "PLAY") == 0)
		{
			processPlay(clientInfo, msg);
		}
		else if (strcmp(msg.command, "PAUSE") == 0)
		{
			processPause(clientInfo, msg);
		}
		else if (strcmp(msg.command, "TEARDOWN") == 0)
		{
			processTeardown(clientInfo, msg);
		}
		else
		{
			printf("%s is not implemented! \n", msg.command);
		}
	}
	else
	{
		sendFailureResponse(clientInfo->socket, 454, "Invalid command, no session set up.", msg.seq);
	}
	pthread_mutex_unlock(&clientInfo->clientLock);
	printf("unlocked...\n");
}
RealtimeController::RealtimeController(TrainSidebar *parent, DeviceConfiguration *dc) : parent(parent), dc(dc)
{
    if (dc != NULL)
    {
        // Save a copy of the dc
        devConf = *dc;
        this->dc = &devConf;
    } else {
        this->dc = NULL;
    }

    // setup algorithm
    processSetup();
}
void TomographyIfacePresenter::notify(
    ITomographyIfacePresenter::Notification notif) {

  switch (notif) {

  case ITomographyIfacePresenter::SetupResourcesAndTools:
    processSetup();
    break;

  case ITomographyIfacePresenter::CompResourceChanged:
    processCompResourceChange();
    break;

  case ITomographyIfacePresenter::ToolChanged:
    processToolChange();
    break;

  case ITomographyIfacePresenter::TomoPathsChanged:
    processTomoPathsChanged();
    break;

  case ITomographyIfacePresenter::LogInRequested:
    processLogin();
    break;

  case ITomographyIfacePresenter::LogOutRequested:
    processLogout();
    break;

  case ITomographyIfacePresenter::SetupReconTool:
    processSetupReconTool();
    break;

  case ITomographyIfacePresenter::RunReconstruct:
    processRunRecon();
    break;

  case ITomographyIfacePresenter::RefreshJobs:
    processRefreshJobs();
    break;

  case ITomographyIfacePresenter::CancelJobFromTable:
    processCancelJobs();
    break;

  case ITomographyIfacePresenter::VisualizeJobFromTable:
    processVisualizeJobs();
    break;

  case ITomographyIfacePresenter::ViewImg:
    processViewImg();
    break;

  case ITomographyIfacePresenter::LogMsg:
    processLogMsg();
    break;

  case ITomographyIfacePresenter::ShutDown:
    processShutDown();
    break;
  }
}