本文整理匯總了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) {
}
}
示例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) {}
}
}
示例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();
}
}
示例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);
});
}
示例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());
}
示例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() + "'");
}
示例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;
}