第一种:
@GetMapping("/DeviceState")
public String Inform(@RequestParam String name){
return esp32Service.GetState(name);
}
使用

第二种
@GetMapping("/setlimit/{name}/{val}")
public String Setlimit(@PathVariable("name")String name,@PathVariable("val") int val){
return esp32Service.SetLimit(name,val);
}
使用


这篇博客介绍了两种通过HTTP GET请求控制ESP32设备的方法。第一种是通过@RequestParam从URL查询参数获取设备状态,调用esp32Service.GetState方法;第二种是使用@PathVariable注解从路径中提取设备名称和限制值,调用esp32Service.SetLimit设置限制。
6816

被折叠的 条评论
为什么被折叠?



