| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.sandu.ximon.admin.localMQTT.controller; |
| | | |
| | | import com.sandu.ximon.admin.localMQTT.util.MqttClientUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import static com.sandu.ximon.admin.localMQTT.callback.StatusMqttCallBack.localMqttConnectStatusMap; |
| | | import static java.lang.Thread.sleep; |
| | | |
| | | /** |
| | | * @author van |
| | | * @version 1.0 |
| | | * msgï¼ |
| | | * @date 2022/11/11 14:18 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/localMQTT") |
| | | @Slf4j |
| | | public class localMQTTTestController { |
| | | |
| | | |
| | | @RequestMapping("/test") |
| | | public String localMQTT() throws InterruptedException { |
| | | |
| | | for (int i = 0; i < 100; i++) { |
| | | |
| | | /* |
| | | * å¼ç¯100 |
| | | * FEA501000BFE010003FFFF0045971477B6D8C2CA |
| | | * 10 |
| | | * FEA501000BFE010003FFFF0AA542FD69D4E6194E |
| | | * å
³ç¯ |
| | | * FEA501000BFE0100030001007130ECA9150640E6 |
| | | * æ¥è¯¢å¿è·³æ¶é´ |
| | | * FEA501000AFE110002FFFF26008FBE3DAC7C0D |
| | | * 设置å¿è·³30ç§ |
| | | * FEA501000CFE210004FFFF001E9BB444E9C75BDB49 |
| | | * 5åé |
| | | * FEA501000CFE210004FFFF012C4A7824285825CB53 |
| | | * */ |
| | | // å¼10 |
| | | String result1 = MqttClientUtil.sendMqttMsg("363832544e5008ff3a32ffff", |
| | | "FEA501000BFE010003FFFF0AA542FD69D4E6194E"); |
| | | log.info("å¼ç¯è¿åç»æ:"+result1); |
| | | sleep(3000); |
| | | // å
³ |
| | | String result2 = MqttClientUtil.sendMqttMsg("363832544e5008ff3a32ffff", |
| | | "FEA501000BFE0100030001007130ECA9150640E6"); |
| | | log.info("å
³ç¯è¿åç»æ:"+result2); |
| | | sleep(3000); |
| | | //// å¿è·³æ¥è¯¢ |
| | | // String result3 = MqttClientUtil.sendMqttMsg("363832544e5008ff3a32ffff", |
| | | // "FEA501000AFE110002FFFF26008FBE3DAC7C0D"); |
| | | // log.info("å¿è·³æ¥è¯¢è¿åç»æ:"+result3); |
| | | // sleep(3000); |
| | | // String result4 = MqttClientUtil.sendMqttMsg("363832544e5008ff3a32ffff", |
| | | // "FEA501001AFE230012FE23000A00017F1019647F111E005428F600EC64EC194EA28A7C"); |
| | | // log.info("宿¶ä»»å¡è¿åç»æ:"+result4); |
| | | // sleep(3000); |
| | | |
| | | // System.out.println("龿¥ç¶æï¼---"+i+"---:"); |
| | | // System.out.println(localMqttConnectStatusMap.get("363832544e5008ff3a32ffff")); |
| | | // sleep(10000); |
| | | |
| | | } |
| | | |
| | | |
| | | return "OK"; |
| | | } |
| | | } |