Esempio n. 1
0
void Mobile::sendEBUTwo() {
	printf("EBU2\n");
	AnalogOut analogTwo;
	DigitalOut digitalTwo;	//Not really used for now
	DigitalIn digitaldummy;
	AnalogIn analogdummy;
	SimPack tempState; //Locking over methods in other objects might cause problem, this is safer.
	logVerbose("Mobile -> sendEBUTro: starting.");
	while(not pleased){
		m_State.lock();
		tempState = state;
		m_State.unlock();
		try{
			et.setEbuTwo(&tempState, &analogTwo, &digitalTwo);
			digitaldummy = em.recvDigitalEBUTwo();
			analogdummy = em.recvAnalogEBUTwo();
			em.sendDigitalCommand(digitalTwo.getChannel(), digitalTwo.getDestination());
			em.sendAnalogCommand(analogTwo.getChannel(), analogTwo.getDestination());
		}catch(int e){
			logError(strerror(errno));
			logError("Fatal: Mobile -> sendEBUTwo: could not send any data to EBU 2.");
			exit(1);
			//HERE if it fails somehow and cannot send to the EBUs it should tell the watchdog to stop all
			//operations
		}

	}
}
Esempio n. 2
0
/*	The method ebuSend locks the packetBuffer and takes out One packet, sends it to the ebu with
 * 	the ebuManager. This method is designed to be started as a thread.
 * 	The data it sends comes from a state which is set in socketReceive() if it is different than the existing one
 */
void Mobile::sendEBUOne() {
	printf("EBU1\n");
	AnalogOut analogOne;
	DigitalOut digitalOne;
	DigitalIn digitaldummy;
	AnalogIn analogdummy;
	SimPack tempState; //Locking over methods in other objects might cause problem, this is safer.
	while(not pleased){
		m_State.lock();
		tempState = state;
		m_State.unlock();
		try{
			et.setEbuOne(&tempState, &analogOne, &digitalOne);	//Use EBUTranslator (et) to translate simdata
			digitaldummy = em.recvDigitalEBUOne();
			analogdummy = em.recvAnalogEBUOne();
			em.sendDigitalCommand(digitalOne.getChannel(), digitalOne.getDestination());
			em.sendAnalogCommand(analogOne.getChannel(), analogOne.getDestination());
		}catch(int e){
			perror("sendEBUOne error");
			logError(strerror(errno));
			throw e;
			//HERE if it fails somehow and cannot send to the EBUs it should tell the watchdog to stop all
			//operations
		}

	}
}