public void setMode(int mode) throws NFCIPException {
		this.mode = mode;
		logMessage(1, "Setting mode: " + NFCIPUtils.modeToString(mode));
		switch (mode) {
		case INITIATOR:
			setInitiatorMode();
			transmissionMode = SEND;
			break;
		case TARGET:
			setTargetMode();
			transmissionMode = RECEIVE;
			break;
		case FAKE_INITIATOR:
			setTargetMode();
			byte[] recv = receiveCommand();
			if (!NFCIPUtils.isDummyBlock(recv))
				throw new NFCIPException("no dummy block received");
			transmissionMode = SEND;
			break;
		case FAKE_TARGET:
			setInitiatorMode();
			sendCommand(DUMMY_BLOCK);
			transmissionMode = RECEIVE;
			break;
		default:
			throw new NFCIPException("wrong mode specified");
		}
	}