浏览代码

IOT调用测试

master
林万龙 3 年前
父节点
当前提交
ac4bd27ca6
共有 2 个文件被更改,包括 2 次插入31 次删除
  1. +2
    -1
      src/main/java/com/telpo/iotgateway/IotGatewayApplication.java
  2. +0
    -30
      src/main/java/com/telpo/iotgateway/server/IotCommunication.java

+ 2
- 1
src/main/java/com/telpo/iotgateway/IotGatewayApplication.java 查看文件

@@ -26,11 +26,12 @@ import org.springframework.scheduling.annotation.EnableScheduling;
public class IotGatewayApplication {

public static void main(String[] args) {
log.info("推送服务开始启动!");
ConfigurableApplicationContext applicationContext = SpringApplication.run(IotGatewayApplication.class, args);

ConfigurableEnvironment environment = applicationContext.getEnvironment();
IotCommunication iotCommunication = new IotCommunication(environment);
iotCommunication.start();
log.info("推送服务启动!");
log.info("推送服务启动成功!");
}
}

+ 0
- 30
src/main/java/com/telpo/iotgateway/server/IotCommunication.java 查看文件

@@ -118,34 +118,4 @@ public class IotCommunication {
log.error("InterruptedException:{}", e.getMessage());
}
}


/*
* userInfo组装
*/
private String getUserInfo() {
//userInfo组装
String userInfo = clientId + "|authMode=aksign"
+ ",signMethod=" + signMethod
+ ",timestamp=" + timeStamp
+ ",authId=" + accessKey
+ ",iotInstanceId=" + iotInstanceId
+ ",consumerGroupId=" + consumerGroupId
+ "|";
//计算签名,password组装方法,请参见AMQP客户端接入说明文档。
return userInfo;
}

/**
* 计算签名,password组装方法,请参见AMQP客户端接入说明文档。
*/
private static String doSign(String toSignString, String secret, String signMethod) throws Exception {
SecretKeySpec signingKey = new SecretKeySpec(secret.getBytes(), signMethod);
Mac mac = Mac.getInstance(signMethod);
mac.init(signingKey);
byte[] rawHmac = mac.doFinal(toSignString.getBytes());
return Base64.encodeBase64String(rawHmac);
}


}

正在加载...
取消
保存