本文整理汇总了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;
}