當前位置: 首頁>>代碼示例>>Java>>正文


Java Command類代碼示例

本文整理匯總了Java中com.ibm.iotf.client.device.Command的典型用法代碼示例。如果您正苦於以下問題:Java Command類的具體用法?Java Command怎麽用?Java Command使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Command類屬於com.ibm.iotf.client.device包,在下文中一共展示了Command類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processCommand

import com.ibm.iotf.client.device.Command; //導入依賴的package包/類
/**
 * This method is invoked by the library whenever there is command matching the subscription criteria
 */
@Override
public void processCommand(Command cmd) {
	try {
		queue.put(cmd);
		} catch (InterruptedException e) {
	}			
}
 
開發者ID:ibm-watson-iot,項目名稱:iot-device-samples,代碼行數:11,代碼來源:RegisteredDeviceCommandSubscribe.java

示例2: run

import com.ibm.iotf.client.device.Command; //導入依賴的package包/類
@Override
public void run() {
	while(true) {
		Command cmd = null;
		try {
			//In this sample, we just display the command
			cmd = queue.take();
			System.out.println("COMMAND RECEIVED = '" + cmd.getCommand() + "'\twith Payload = '" + cmd.getPayload() + "'");
		} catch (InterruptedException e) {}
	}
}
 
開發者ID:ibm-watson-iot,項目名稱:iot-device-samples,代碼行數:12,代碼來源:RegisteredDeviceCommandSubscribe.java

示例3: accept

import com.ibm.iotf.client.device.Command; //導入依賴的package包/類
@Override
public void accept(Consumer<Command> commandSubmitter) {
    
    try {
        connector.subscribeCommands(commandSubmitter);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
 
開發者ID:quarks-edge,項目名稱:quarks,代碼行數:11,代碼來源:IotfDeviceCommands.java

示例4: subscribeCommands

import com.ibm.iotf.client.device.Command; //導入依賴的package包/類
synchronized void subscribeCommands(Consumer<Command> tupleSubmitter) throws Exception {
    DeviceClient client = getClient();
    
    client.setCommandCallback(cmd -> {
        tupleSubmitter.accept(cmd);
    });
}
 
開發者ID:quarks-edge,項目名稱:quarks,代碼行數:8,代碼來源:IotfConnector.java

示例5: processCommand

import com.ibm.iotf.client.device.Command; //導入依賴的package包/類
/**
 * This method is invoked by the library whenever there is command matching the subscription criteria
 */
@Override
public void processCommand(Command cmd) {
	commandReceived = true;
	System.out.println("Received command, name = "+cmd.getCommand() +
			", format = " + cmd.getFormat() + ", Payload = "+cmd.getPayload() + ", time = "+cmd.getTimestamp());
}
 
開發者ID:ibm-watson-iot,項目名稱:iot-java,代碼行數:10,代碼來源:DeviceCommandSubscriptionTest.java

示例6: processCommand

import com.ibm.iotf.client.device.Command; //導入依賴的package包/類
@Override
public void processCommand(Command command) {
	System.out.println("COMMAND RECEIVED = '" + command.getCommand() + 
			"'\twith Payload = '" + command.getPayload() + "'");		
}
 
開發者ID:ibm-watson-iot,項目名稱:iot-device-samples,代碼行數:6,代碼來源:SampleRasPiManagedDevice.java

示例7: allCommands

import com.ibm.iotf.client.device.Command; //導入依賴的package包/類
private TStream<Command> allCommands() {
    if (commandStream == null)
        commandStream = topology.events(new IotfDeviceCommands(connector));
    return commandStream;
}
 
開發者ID:quarks-edge,項目名稱:quarks,代碼行數:6,代碼來源:IotfDevice.java


注:本文中的com.ibm.iotf.client.device.Command類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。