Exemplo n.º 1
0
void HasherThread::run()
{
	while(!files.isEmpty())
	{
		switch(adbapi->ed2khash(files.first()))
		{
		case 1:
			files.pop_front();
			emit sendHash(adbapi->ed2khashstr);
			break;
		case 2:
			break;
		case 3:
			files.clear();
			break;
		default:
			break;
		}
	}
}
Exemplo n.º 2
0
void CRemoteControlFrame::onTimer(wxTimerEvent&)
{
	RC_TYPE type = m_handler->readType();

	switch (type) {
		case RCT_NONE:
			m_handler->retry();
			break;

		case RCT_ACK:
			if (m_state == RCFS_HASH) {
				m_handler->setLoggedIn(true);
				m_handler->getCallsigns();
				m_state = RCFS_NORMAL;
			}
			break;

		case RCT_NAK: {
				if (m_state == RCFS_HASH || m_state == RCFS_LOGIN)
					m_handler->setLoggedIn(false);

				wxString text = m_handler->readNAK();
				m_state = RCFS_NORMAL;
				::wxMessageBox(text);
			}
			break;

		case RCT_RANDOM: {
				unsigned int rnd = m_handler->readRandom();
				sendHash(rnd);
				m_state = RCFS_HASH;
			}
			break;

		case RCT_CALLSIGNS: {
				m_noteBook->DeleteAllPages();

				CRemoteControlCallsignData* data = m_handler->readCallsigns();
				for (unsigned int i = 0U; i < data->getRepeaterCount(); i++)
					addRepeater(data->getRepeater(i));
				for (unsigned int i = 0U; i < data->getStarNetCount(); i++)
					addStarNet(data->getStarNet(i));
				delete data;

				m_state = RCFS_GET_REPEATERS;
				m_it1   = m_repeaters.begin();
				m_it2   = m_starNets.begin();
				getNextRepeater();
			}
			break;

		case RCT_REPEATER: {
				CRemoteControlRepeaterData* data = m_handler->readRepeater();
				wxString callsign = data->getCallsign();
				m_repeaters[callsign]->add(*data);
				delete data;

				if (m_state == RCFS_GET_REPEATERS || m_state == RCFS_GET_STARNETS)
					getNextRepeater();
			}
			break;

		case RCT_STARNET: {
				CRemoteControlStarNetGroup* data = m_handler->readStarNetGroup();
				wxString callsign = data->getCallsign();
				m_starNets[callsign]->add(*data);
				delete data;

				if (m_state == RCFS_GET_REPEATERS || m_state == RCFS_GET_STARNETS)
					getNextStarNet();
			}
			break;
	}
}