Пример #1
0
	virtual void Execute(SActivationInfo *pActInfo)
	{
		bool bResult = false;
		if (udpListener->IsWorking()) {
			if (udpListener->ReceiveLine() != -1) {
				string chaine = udpListener->GetRecMessage();
				string token0 = udpListener->GetToken(0);
				Quat gyro = udpListener->TokenToQuat(token0);
				string token1 = udpListener->GetToken(1);
				Vec3 accel = udpListener->TokenToVec3(token1);
				string token2 = udpListener->GetToken(2);
				float compass = udpListener->TokenToFloat(token2);
				
				//if(!gyro.IsValid()) CryLogAlways("NOT VALID");

				ActivateOutput(pActInfo, EOP_Gyro_xyz, Vec3(gyro.v.x,gyro.v.y,gyro.v.z));
				ActivateOutput(pActInfo, EOP_Gyro_w, gyro.w);
				
				ActivateOutput(pActInfo, EOP_Accel, accel);
				ActivateOutput(pActInfo, EOP_Compass, compass);
				
				bResult = true;
			}
		}
		return;
	}
Пример #2
0
	virtual void Execute(SActivationInfo *pActInfo)
	{
		bool bResult = false;
		if (udpListener->IsWorking()) {
			if (udpListener->ReceiveLine() != -1) {
				
				int analogs = udpListener->GetTokenCount();
				CryLogAlways("Nombre d'event %i",analogs);
				for(int i=0;i<analogs;i++){
					string token = udpListener->GetToken(i);
					float value = udpListener->TokenToFloat(token);
					
					int id = udpListener->GetId(token);
					if(id >= 10) {
						CryLogAlways("Error index out of bounds : token %s ",token);
						return;
					}

					if(current_values[id]!=value){
						current_values[id] = value;
						ActivateOutput(pActInfo,id+1,value);
					}
				}
				bResult = true;
			}
		}
		return;
	}
Пример #3
0
	virtual void Execute(SActivationInfo *pActInfo)
	{
		bool bResult = false;
		if (udpListener->IsWorking()) {
			if (udpListener->ReceiveLine() != -1) {
				
				int buttons = udpListener->GetTokenCount();
				
				for (int i=0;i<buttons;i++){
					string token = udpListener->GetToken(i);
					//CryLogAlways("%s",token);
					int id = udpListener->GetId(token);
					bool state = udpListener->TokenToBool(token);
					if(id>=12) {
						CryLogAlways("Index array out of bounds");
						break;
					}
					if(tab_state[id] != state){
						tab_state[id] = state;
						ActivateOutput(pActInfo,(id+1),state);
					}
				}
				
				bResult = true;
			}
		}
	
		//if (bResult) ActivateOutput(pActInfo, EOP_Received, true);
		return;
	}