补全发送硬件控制信息到服务器Thread的代码: * 调用mDeviceSelectViewModel的sendRequest方法向服务器发送信息,参数为控制操作标识(mHardwareControlViewModel中的actionType) * 发送信息后延迟1s调用hardwareControlHandler来更新界面(使用mHardwareControlViewModel的startHardwareControlHandler方法), * runnable为hardwareControlRunnable * 做好异常处理,发生异常时通过sendEmptyMessage调用resetDeviceHandler来提示错误并重置界面状态 Thread hardwareRequestThread =
时间: 2024-04-23 19:27:14 浏览: 91
C++Http上传文件到web服务器,解决中文参数乱码
new Thread(new Runnable() {
@Override
public void run() {
try {
mDeviceSelectViewModel.sendRequest(mHardwareControlViewModel.getActionType());
Thread.sleep(1000);
mHardwareControlViewModel.startHardwareControlHandler(hardwareControlRunnable);
} catch (Exception e) {
resetDeviceHandler.sendEmptyMessage(0);
}
}
});
hardwareRequestThread.start();
阅读全文