Beispiel #1
0
State * TeleKarma::DoAction(Action * a, State * s)
{
	if (a == NULL) return s;
	State * result = s;
	// process "global" (turn-independent) actions independant of turn #
	switch (a->id) {
		case ACTION_QUIT:
			result = Quit(a, s);
			break;
		case ACTION_PLAY_SOUND:
			result = PlaySound(a, s);
			break;
		case ACTION_SEND_TONE:
			result = SendTone(a, s);
			break;
		default:
			// process turn-independent actions if applicable
			if (a->turn == s->turn) {
				switch (a->id) {
					case ACTION_INITIALIZE:
						result = Initialize(a, s);
						break;
					case ACTION_REGISTER:
						result = Register(a, s);
						break;
					case ACTION_DIAL:
						result = Dial(a, s);
						break;
					case ACTION_HOLD:
						result = Hold(a, s);
						break;
					case ACTION_AUTOHOLD:
						result = AutoHold(a, s);
						break;
					case ACTION_MUTE:
						result = MuteAutoHold(a, s);
						break;
					case ACTION_RETRIEVE:
						result = Retrieve(a, s);
						break;
					case ACTION_DISCONNECT:
						result = Disconnect(a, s);
						break;
					default:
						// simply ignore unknown actions
						// (and global actions)
						break;
				}
			} else {
				if (s != NULL) {
					result = SetState(new State(s->id, s->turn, STATUS_TURN_MISMATCH));
				}
			}
			break;
	}
	delete a;
	return result;
}
Beispiel #2
0
void Holder::TeleopPeriodic(){
	AutoHold();
}
Beispiel #3
0
void Holder::AutonomousPeriodic(){
	AutoHold();
}
Beispiel #4
0
void Holder::TestPeriodic(){
	AutoHold();
}