|
虚拟设备发送给APP的数据能收到,但是APP发送的数据虚拟设备接收不到private void btnPowerAction() {
sendCommand("Power_Switch", !isPowerOn);
isPowerOn =!isPowerOn;
if (!isPowerOn == true) {
btnPower.setSelected(true);
} else {
btnPower.setSelected(false);
}
}
protected void sendCommand(String key, Object value) {
if (device.getNetStatus() != GizWifiDeviceNetStatus.GizDeviceControlled) {
myToast(R.string.device_no_ready);
return;
}
int sn = 5; // 如果App不使用sn,此处可写成 int sn = 0;
//int sn = 0;
ConcurrentHashMap<String, Object> command = new ConcurrentHashMap<String, Object>();
command.put(key, value);
device.write(command, sn);
}
|
|