All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vikingbrain.nmt.operations.system.SendKeyOperation Maven / Gradle / Ivy

Go to download

A Java HTTP client for consuming TheDavidBox Service API of Networked Media Tank devices

There is a newer version: 1.2.1
Show newest version
package com.vikingbrain.nmt.operations.system;

import java.util.LinkedHashMap;

import com.vikingbrain.nmt.operations.ModuleType;
import com.vikingbrain.nmt.operations.OperationType;
import com.vikingbrain.nmt.operations.TheDavidboxOperationFactory;
import com.vikingbrain.nmt.responses.ResponseSimple;

/**
 * Operation send remote control key to command server.
 * It execute the keys remote infrared command on NMT.
 * Execution example: http://popcorn:8008/system?arg0=send_key&arg1=play
 * 
 * @author vikingBrain
 *
 */
public class SendKeyOperation extends AbstractSystemOperation {

	/** Operation type. */
	private static final OperationType operationType = ModuleType.SYSTEM.send_key;

	/** Response target class. */
	private static final Class responseTargetClass = ResponseSimple.class;

	/** Required attributes. */
	private String keyName;
	
	/**
	 * Constructor.
	 * @param operationFactory the operation factory
	 * @param keyName the key name
	 */
	public SendKeyOperation(TheDavidboxOperationFactory operationFactory, String keyName) {
		super(operationFactory, operationType, responseTargetClass);
		
		this.keyName = keyName;		
	}

	@Override
	/** {@inheritDoc} */
	public LinkedHashMap buildHttpArguments(){
		//Get http arguments from superclass
		LinkedHashMap httpArguments = super.buildHttpArguments();

		httpArguments.put("arg1", keyName);
		
		return httpArguments;		
	}

	public final String getKeyName() {
		return keyName;
	}

	public final void setKeyName(String keyName) {
		this.keyName = keyName;
	}

	@Override
	public String toString() {
		return "SendKeyOperation [keyName=" + keyName + ", getOperationType()="
				+ getOperationType() + "]";
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy