Exemple #1
0
void MainObject::outputCrosspointChangedData(int id,int output,int input)
{
  if(lp_devices->inputSwitcher()==lp_devices->outputSwitcher()) {
    syslog(LOG_DEBUG,"input/output switcher output %d changed to input %d",
	   output+1,input+1);
  }
  else {
    syslog(LOG_DEBUG,"output switcher output %d changed to input %d",
	   output+1,input+1);
  }

  int codec_num=lp_codecs->codecBySwitcherInput(input);
  int room_num=lp_rooms->roomBySwitcherOutput(output);
  int port_num=lp_rooms->portBySwitcherOutput(output);

  //
  // Process Crosspoint Change
  //
  if((codec_num<0)&&(room_num<0)&&(port_num<0)) {
    return;   // Crosspoint unused, ignore
  }
  if((codec_num<0)||(room_num<0)||(port_num<0)) {
    syslog(LOG_DEBUG,"unrecognized output crosspoint change received: output: %d  input: %d  codec: %d  room: %d  port: %d",
	   output,input,codec_num,room_num,port_num);
    return;
  }
  lp_rooms->setCodec(room_num,port_num,codec_num);
  lp_codecs->setConnectedToRoom(codec_num,room_num);

  //
  // Notify Clients
  //
  UpdateClients();
}
Exemple #2
0
void MainForm::on_but_vnesti_dolg_clicked()
{
    QSqlQuery sql;
    sql.prepare("SELECT MAX(OPLATI_CLIENTS) AS number "
                "FROM OPLATI_CLIENTS");
    sql.exec();
    QSqlRecord record = sql.record();
    sql.next();

    int Number = sql.value(record.indexOf("number")).toInt();

    Number++;

    double summ = ui->dolg_client->text().toDouble();
    double summa_Oplati = QInputDialog::getDouble(this,"Введите сумму ","Сумма:",summ,0,99999999,2,0,0);

    sql.prepare("INSERT INTO OPLATI_CLIENTS(NUMBER,DATE,TYPE_OPERACII,ID_CLIENT,SUMMA_K_OPL,SUMMA_OPL) "
                "VALUES(:NUMBER,:DATE,:TYPE_OPERACII,:ID_CLIENT,:SUMMA_K_OPL,:SUMMA_OPL) ");
    sql.bindValue(":NUMBER",Number);
    sql.bindValue(":DATE",QDate::currentDate().toString("dd.MM.yyyy"));
    sql.bindValue(":TYPE_OPERACII",n_PL_DOLG);
    sql.bindValue(":ID_CLIENT",ID_Client);
    sql.bindValue(":SUMMA_K_OPL",0);
    sql.bindValue(":SUMMA_OPL",summa_Oplati);

    sql.exec();

    UpdateClients(ID_Client);
}
Exemple #3
0
void DisplayTimer::HandleAdd(LTFLOAT fTime)
{
	// Start the timer if it isn't going (and the timer is positive)...

	if (m_Timer.GetCountdownTime() <= 0.0f)
	{
		if (fTime > 0.0f)
		{
			HandleStart(fTime);
		}

		return;
	}


	// Add/subtract the time from the timer...

	m_Timer.Add(fTime);


	// Send message to clients telling them to update DisplayTimer...

	UpdateClients();


}
Exemple #4
0
void DisplayTimer::HandleStart(LTFLOAT fTime)
{
	if (fTime <= 0.0f) return;

	if (m_hstrStartCmd)
	{
        const char* pCmd = g_pLTServer->GetStringData(m_hstrStartCmd);

		if (pCmd && g_pCmdMgr->IsValidCmd(pCmd))
		{
			g_pCmdMgr->Process(pCmd, m_hObject, m_hObject);
		}
	}

	m_Timer.Start(fTime);


	// Send message to clients telling them about the DisplayTimer...

	UpdateClients();


	// Update the DisplayTimer...

    SetNextUpdate(UPDATE_NEXT_FRAME);
}
Exemple #5
0
bool TextureFX::OnTrigger(HOBJECT hSender, const CParsedMsg &cMsg)
{
	static CParsedMsg::CToken s_cTok_SetVar("SETVAR");

	bool bUpdate = false;

	if ((cMsg.GetArg(0) == s_cTok_SetVar) && (cMsg.GetArgCount() >= 4))
	{
		uint32 nStage	= (uint32)atoi(cMsg.GetArg(1)) - 1;
		uint32 nVar		= (uint32)atoi(cMsg.GetArg(2)) - 1;
		float  fVal		= (float)atof(cMsg.GetArg(3));

		if((nStage < NUM_STAGES) && (nVar < NUM_VARS))
		{
			//save the variable
			m_Stages[nStage].m_fVars[nVar] = fVal;

			//mark it as changes
			m_Stages[nStage].m_nChanged |= (1 << nVar);

			//we need to update the clients
			bUpdate = true;
		}
	}
	else
		return GameBase::OnTrigger(hSender, cMsg);

	// Tell the clients about the change
	if(bUpdate)
		UpdateClients();

	return true;
}
Exemple #6
0
uint32 LightGroup::EngineMessageFn(uint32 messageID, void *pData, LTFLOAT fData)
{
	switch(messageID)
	{
		case MID_PRECREATE:
		{
			ObjectCreateStruct *pOCS = (ObjectCreateStruct*)pData;
			if (!pOCS)
				break;

			if( fData == PRECREATE_WORLDFILE )
			{
				ReadProp(pOCS);
			}

			PostReadProp(pOCS);
		}
		break;

		case MID_INITIALUPDATE:
		{
			if( fData != INITIALUPDATE_SAVEGAME )
			{
				InitialUpdate();
			}
		}
		break;

		case MID_SAVEOBJECT:
		{
            Save((ILTMessage_Write*)pData, (uint32)fData);
		}
		break;

		case MID_LOADOBJECT:
		{
            Load((ILTMessage_Read*)pData, (uint32)fData);
		}
		break;

		case MID_UPDATE:
		{
			// Send a new update if we were waiting for the client to do something
			if (m_bClientNeedsUpdate)
			{
				UpdateClients();
				// Turn back off
				SetNextUpdate(m_hObject, UPDATE_NEVER);
			}
		}
		break;

		default : break;
	}

	return Engine_LightGroup::EngineMessageFn(messageID, pData, fData);
}
Exemple #7
0
void DisplayMeter::HandleEnd()
{
	m_nValue = 0;

	if (m_bRemoveWhenEmpty)
	{
        g_pLTServer->RemoveObject(m_hObject);
	}
	UpdateClients();
}
uint32 DisplayTimer::EngineMessageFn(uint32 messageID, void *pData, LTFLOAT fData)
{
    switch(messageID)
    {
    case MID_UPDATE:
    {
        Update();
    }
    break;

    case MID_PRECREATE:
    {
        if (fData == PRECREATE_WORLDFILE || fData == PRECREATE_STRINGPROP)
        {
            ReadProp((ObjectCreateStruct*)pData);
        }
    }
    break;

    case MID_INITIALUPDATE:
    {
        if (fData != INITIALUPDATE_SAVEGAME)
        {
            InitialUpdate();
        }
    }
    break;

    case MID_SAVEOBJECT:
    {
        Save((ILTMessage_Write*)pData);
    }
    break;

    case MID_LOADOBJECT:
    {
        Load((ILTMessage_Read*)pData);

        uint32 dwRet = BaseClass::EngineMessageFn(messageID, pData, fData);

        // We need to reset our sfx message since values
        // could have changed across save versions.

        UpdateClients( );

        return dwRet;
    }
    break;

    default :
        break;
    }

    return BaseClass::EngineMessageFn(messageID, pData, fData);
}
Exemple #9
0
MainForm::MainForm(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainForm)
{
    ui->setupUi(this);

    db = ConnectDB(g_hostname,g_dataBase,g_login,g_password,g_driverName,g_connect_port);
//    CreateDb(db);
    UpdateClients(0);

}
Exemple #10
0
void DisplayTimer::HandlePause()
{
	m_Timer.Pause();

	// Send message to clients telling them about the DisplayTimer...

	UpdateClients();

	// Update the DisplayTimer...

    SetNextUpdate(UPDATE_NEXT_FRAME);
}
void StepManiaLanServer::ServerUpdate()
{
	if (!stop)
	{
		NewClientCheck(); /* See if there is another client wanting to play */
		UpdateClients();
		if (time(NULL) > statsTime)
		{
			SendStatsToClients();
			statsTime = time(NULL);
		}
	}
}
Exemple #12
0
void DisplayMeter::HandleMinus(uint8 val)
{
	if (val == 0) return;
	if (val > 100) val = 100;

	int newValue = m_nValue - val;
	if (newValue < 0) newValue = 0;
	int newPhase = -1;
	int testPhase = 0;
	//see if we've entered a new phase
	while (testPhase < DM_MAX_NUMBER_OF_PHASES)
	{
		//if our new value is less than the phase, but our old value is greater than it, we're in a new phase
		if ((int)newValue <= m_PhaseData[testPhase].nValue && (int)m_nValue > m_PhaseData[testPhase].nValue)
		{
			//if we find more than one possible phase use the lowest valued one
			if (newPhase < 0 || m_PhaseData[testPhase].nValue < m_PhaseData[newPhase].nValue)
				newPhase = testPhase;

		}
		testPhase++;
	}

	//if we have entered a new phase, see if it has a command
	if (newPhase >= 0)
	{
		if (m_PhaseData[newPhase].hstrCmd)
		{
			char* pCmd = g_pLTServer->GetStringData(m_PhaseData[newPhase].hstrCmd);
			if (pCmd && g_pCmdMgr->IsValidCmd(pCmd))
			{
				g_pCmdMgr->Process(pCmd);
			}
		}
	}


	if (newValue == 0)
	{
		HandleEnd();
		return;
	}

	m_nValue = newValue;

	// Send message to clients telling them about the DisplayMeter...
	UpdateClients();

	// Update the DisplayMeter...
//    g_pLTServer->SetNextUpdate(m_hObject, 0.001f);
}
Exemple #13
0
void DisplayTimer::HandleAbort()
{
	// Tell the client to stop the timer...
	m_Timer.Stop( );

	UpdateClients( );

    SetNextUpdate(UPDATE_NEVER);

	if (m_bRemoveWhenDone)
	{
        g_pLTServer->RemoveObject(m_hObject);
	}
}
Exemple #14
0
void DisplayMeter::HandleShow(uint8 initVal)
{
	if (initVal == 0) return;
	if (initVal > 100) initVal = 100;

	m_nValue = initVal;

	// Send message to clients telling them about the DisplayMeter...
	UpdateClients();


	// Update the DisplayMeter...
//    g_pLTServer->SetNextUpdate(m_hObject, 0.001f);
}
Exemple #15
0
void LightGroup::HandleTrigger( HOBJECT hSender, ILTMessage_Read *pMsg )
{
	// MW-TODO Previously Readuint32
	const char* szMsg = (const char*)pMsg->Readuintptr();

	ConParse	cParse;
	cParse.Init(szMsg);
	while (g_pCommonLT->Parse(&cParse) == LT_OK)
	{
		if (_stricmp(cParse.m_Args[0], "TOGGLE") == 0)
		{
			// Toggle the flag
			m_bOn = !m_bOn;
		}
		else if (_stricmp(cParse.m_Args[0], "ON") == 0)
		{
			m_bOn = true;
		}
		else if (_stricmp(cParse.m_Args[0], "OFF") == 0)
		{
			m_bOn = false;
		}
		else if ((_stricmp(cParse.m_Args[0], "COLOR") == 0) && ((cParse.m_nArgs == 2) || (cParse.m_nArgs == 4)))
		{
			if (cParse.m_nArgs == 2)
			{
				float fValue = (float)atof(cParse.m_Args[1]) / 255.0f;
				m_vColor.Init(fValue, fValue, fValue);
			}
			else if (cParse.m_nArgs == 4)
			{
				float fValueR = (float)atof(cParse.m_Args[1]) / 255.0f;
				float fValueG = (float)atof(cParse.m_Args[2]) / 255.0f;
				float fValueB = (float)atof(cParse.m_Args[3]) / 255.0f;
				if (fValueR < 0.0f)
					fValueR = m_vColor.x;
				if (fValueG < 0.0f)
					fValueG = m_vColor.y;
				if (fValueB < 0.0f)
					fValueB = m_vColor.z;
				m_vColor.Init(fValueR, fValueG, fValueB);
			}
		}
	}

	// Tell the clients about the change
	UpdateClients();
}
Exemple #16
0
//*************** Услуги Маникюрного мастера
void MainForm::on_butMonMaster_clicked()
{
    UpdateClients(0);
    frm_okazanie_uslug *frm_uslugi = new frm_okazanie_uslug;
    frm_uslugi->InitForm(n_USL_MAN,w_ID);
    frm_uslugi->setParent(ui->frame);
    frm_uslugi->frm = this;
    frm_uslugi->show();
    w_ID = frm_uslugi->winId();
    ui->butClients->setEnabled(true);
    ui->butMonMaster->setEnabled(false);
    ui->butKosmitolog->setEnabled(true);
    ui->butUhodzaTelom->setEnabled(true);
    ui->butStilist->setEnabled(true);
    ui->butMagazin->setEnabled(true);
}
Exemple #17
0
void DisplayMeter::Load(HMESSAGEREAD hRead)
{
	if (!hRead) return;

	LOAD_BOOL(m_bRemoveWhenEmpty);
	LOAD_BYTE(m_nValue);

	for (int i=0; i < DM_MAX_NUMBER_OF_PHASES; i++)
	{
		m_PhaseData[i].Load(hRead);
	}

	if (m_nValue > 0)
	{
		UpdateClients();
	}
}
Exemple #18
0
void DisplayTimer::Load(ILTMessage_Read *pMsg)
{
	if (!pMsg) return;

	LOAD_HSTRING(m_hstrStartCmd);
	LOAD_HSTRING(m_hstrEndCmd);
	LOAD_BOOL(m_bRemoveWhenDone);

	m_Timer.Load(pMsg);

	if( g_pVersionMgr->GetCurrentSaveVersion( ) > CVersionMgr::kSaveVersion__1_2 )
	{
		LOAD_BYTE( m_nTeamId );
	}

	if (m_Timer.GetDuration() > 0.0f)
	{
		UpdateClients();
	}
}
Exemple #19
0
void DisplayMeter::HandlePlus(uint8 val)
{
	if (val == 0) return;
	if (val > 100) val = 100;

	if (m_nValue == 0)
	{
		HandleShow(val);
		return;
	}

	m_nValue += val;
	if (m_nValue > 100) m_nValue = 100;

	// Send message to clients telling them about the DisplayMeter...
	UpdateClients();

	// Update the DisplayMeter...
//    g_pLTServer->SetNextUpdate(m_hObject, 0.001f);
}
bool Update(float elapsed)
{

	//let's update our network
	char IP[16];
	long newID = bb_serverUpdate(elapsed,UPDATE_SEND_RECV,IP);
	
	if(newID > 0) //new client
	{
		AddClient(newID,IP);
		printf("Client with ID %li ; IP : %s has connected\n",newID,IP);
	}
	else if(newID == BBNET_ERROR) //error
	{
		perror("bb_serverUpdate");
		return false;
	}
	else if(newID < 0)	//client has closed the connection
	{
		printf(" > Client with ID %li disconnected\n",newID * -1);
		RemoveClient(newID *-1);
	}

	//retreive newly available data
	RetreiveNetData();

	//update Clients queries
	UpdateClients(elapsed);

	//check if we need to get latest version
	LastVersionCheck+=elapsed;
	if(LastVersionCheck >= 60)
	{
		GetLatestVersion();
		LastVersionCheck = 0;
	}

	return true;
}
Exemple #21
0
void TextureFX::InitialUpdate()
{
	UpdateClients();
}
Exemple #22
0
bool DisplayTimer::OnTrigger(HOBJECT hSender, const CParsedMsg &cMsg)
{
	static CParsedMsg::CToken s_cTok_Start("START");
	static CParsedMsg::CToken s_cTok_On("ON");
	static CParsedMsg::CToken s_cTok_Add("ADD");
	static CParsedMsg::CToken s_cTok_End("END");
	static CParsedMsg::CToken s_cTok_Off("OFF");
	static CParsedMsg::CToken s_cTok_Kill("KILL");
	static CParsedMsg::CToken s_cTok_Pause("PAUSE");
	static CParsedMsg::CToken s_cTok_Resume("RESUME");
	static CParsedMsg::CToken s_cTok_Team("TEAM");

	if ((cMsg.GetArg(0) == s_cTok_Start) ||
		(cMsg.GetArg(0) == s_cTok_On))
	{
		if (cMsg.GetArgCount() > 1)
		{
            HandleStart((LTFLOAT)atof(cMsg.GetArg(1)));
		}
	}
	else if (cMsg.GetArg(0) == s_cTok_Add)
	{
		if (cMsg.GetArgCount() > 1)
		{
            HandleAdd((LTFLOAT)atof(cMsg.GetArg(1)));
		}
	}
	else if ((cMsg.GetArg(0) == s_cTok_End) ||
			 (cMsg.GetArg(0) == s_cTok_Off))
	{
		HandleEnd();
	}
	else if (cMsg.GetArg(0) == s_cTok_Kill)
	{
		HandleAbort();
	}
	else if (cMsg.GetArg(0) == s_cTok_Pause)
	{
		HandlePause();
	}
	else if (cMsg.GetArg(0) == s_cTok_Resume)
	{
		HandleResume();
	}
	else if (cMsg.GetArg(0) == s_cTok_Team)
	{
		if( cMsg.GetArgCount( ) > 1 )
		{
			uint32 nTeamId = atoi( cMsg.GetArg( 1 ));
			if( nTeamId < MAX_TEAMS )
			{
				m_nTeamId = nTeamId;
			}
			else
			{
				m_nTeamId = INVALID_TEAM;
			}

			UpdateClients( );
		}
	}
	else
		return GameBase::OnTrigger(hSender, cMsg);

	return true;
}
Exemple #23
0
void MainObject::commandReceivedData(int id,int cmd,const QStringList &args)
{
  QStringList oargs;
  unsigned codec_num;
  unsigned port_num;
  bool ok=false;
  int room_num=lp_server->source(id);

  switch((MainObject::PanelCommand)cmd) {
  case MainObject::DC:
    lp_server->closeConnection(id);
    break;
  case MainObject::GC:
    oargs.push_back("S");
    oargs.push_back(QString().sprintf("%u",lp_codecs->codecQuantity()));
    oargs.push_back(QString().sprintf("%u",lp_rooms->portQuantity(room_num)));
    oargs.push_back(lp_rooms->name(room_num));
    lp_server->sendCommand(id,(int)MainObject::GC,oargs);

    for(unsigned i=0;i<lp_codecs->codecQuantity();i++) {
      oargs.clear();
      oargs.push_back("O");
      oargs.push_back(QString().sprintf("%u",i+1));
      oargs.push_back(lp_codecs->name(i));
      lp_server->sendCommand(id,(int)MainObject::GC,oargs);

      oargs.clear();
      oargs.push_back("C");
      oargs.push_back(QString().sprintf("%u",i+1));
      oargs.push_back(lp_codecs->configurationCommand(i));
      lp_server->sendCommand(id,(int)MainObject::GC,oargs);

      oargs.clear();
      oargs.push_back("B");
      oargs.push_back(QString().sprintf("%u",i+1));
      oargs.push_back(QString().sprintf("%u",lp_codecs->isBusy(i)));
      lp_server->sendCommand(id,(int)MainObject::GC,oargs);
    }

    for(unsigned i=0;i<lp_rooms->portQuantity(room_num);i++) {
      oargs.clear();
      oargs.push_back("I");
      oargs.push_back(QString().sprintf("%u",i+1));
      oargs.push_back(lp_rooms->portName(room_num,i));
      lp_server->sendCommand(id,(int)MainObject::GC,oargs);
    }

    oargs.clear();
    lp_server->sendCommand(id,(int)MainObject::GC,oargs);

    UpdateClient(id);
    break;

  case MainObject::SX:
    codec_num=args[0].toUInt(&ok)-1;
    if(ok&&(codec_num<lp_codecs->codecQuantity())) {
      if(lp_codecs->isBusy(codec_num)) {
	oargs.clear();
	oargs.push_back(tr("Codec"));
	oargs.push_back(lp_codecs->name(codec_num));
	if((room_num=lp_codecs->connectedToRoom(codec_num))<0) {
	  oargs.push_back(tr("is currently in use elsewhere."));
	}
	else {
	  oargs.push_back(tr("is currently in use in"));
	  oargs.push_back(lp_rooms->name(room_num)+".");
	}
	lp_server->sendCommand(id,(int)MainObject::MB,oargs);
	return;
      }
      port_num=args[1].toUInt(&ok)-1;
      if(ok&&(port_num<lp_rooms->portQuantity(room_num))) {
	lp_devices->inputSwitcher()->
	  setCrosspoint(lp_codecs->switcherOutput(codec_num),
			lp_rooms->switcherInput(room_num,port_num));
	lp_devices->outputSwitcher()->
	  setCrosspoint(lp_rooms->switcherOutput(room_num,port_num),
			lp_codecs->switcherInput(codec_num));
	lp_rooms->setCodec(room_num,port_num,codec_num);
	lp_codecs->setConnectedToRoom(codec_num,room_num);
	UpdateClients();
      }
    }
    break;

  case MainObject::MB:
    break;
  }
}
Exemple #24
0
void SMOnlineRoom::Update() {
    UpdateClients();
}
Exemple #25
0
void LightGroup::InitialUpdate()
{
	SetNextUpdate(m_hObject, UPDATE_NEVER);
	UpdateClients();
}