iot交互大致框架修改

This commit is contained in:
zhangzhicheng 2024-07-26 18:08:17 +08:00
parent 496eb7c450
commit a7bf08efc6
2 changed files with 5 additions and 5 deletions

View File

@ -38,7 +38,7 @@ public class IotService {
*/ */
public String httpCtlPostSend(String deviceCode,String cmd){ public String httpCtlPostSend(String deviceCode,String cmd){
DeviceCtlDto dto = new DeviceCtlDto(); DeviceCtlDto dto = new DeviceCtlDto();
DeviceCtlDto.Params params = dto.getParams(); DeviceCtlDto.Params params = new DeviceCtlDto.Params();
params.setCommand(cmd); params.setCommand(cmd);
dto.setParams(params); dto.setParams(params);
Map<String, String> paramMap = new HashMap<>(); Map<String, String> paramMap = new HashMap<>();

View File

@ -69,10 +69,10 @@ public class IotHttpTest {
@Test @Test
public void testMethod(){ public void testMethod(){
String deviceCode = "4cd72020-2b11-11ef-890f-e7ba493dc999"; String deviceCode = "4cd72020-2b11-11ef-890f-e7ba493dc999";
String cmd = ""; String cmd = "{\"method\":\"zzctest\",\"params\":{\"switch\":\"on\"}}";
// String result = httpCtlPostSend(deviceCode,cmd); String result = httpCtlPostSend(deviceCode,cmd);
// System.out.println(result); System.out.println(result);
String result2 = httpTelemetryGetSend(deviceCode); String result2 = httpTelemetryGetSend(deviceCode);
System.out.println(result2); System.out.println(result2);
@ -93,7 +93,7 @@ public class IotHttpTest {
*/ */
public String httpCtlPostSend(String deviceCode,String cmd){ public String httpCtlPostSend(String deviceCode,String cmd){
DeviceCtlDto dto = new DeviceCtlDto(); DeviceCtlDto dto = new DeviceCtlDto();
DeviceCtlDto.Params params = dto.getParams(); DeviceCtlDto.Params params = new DeviceCtlDto.Params();
params.setCommand(cmd); params.setCommand(cmd);
dto.setParams(params); dto.setParams(params);
Map<String, String> paramMap = new HashMap<>(); Map<String, String> paramMap = new HashMap<>();