562935844@qq.com
2023-08-31 b77dc026ffd21dba8652d28409c51e27d3e5a76c
HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/config/HDLLinkConfig.java
@@ -24,28 +24,35 @@
    private String gatewayId;
    private String ipAddress;
    private GatewaySearchBean currentGateway;//当前网关
    private String networkName;
    private AuthenticateRequest.AuthenticateDeviceInfoBean deviceInfoBean;//当前设备基本信息
    private AuthenticateRequest.RequestBean requestBean;//当前设备基本信息
    private AuthenticateRequest.AuthBean authBean;//当前设备认证信息
    /**
     * instance
     */
    private volatile static HDLLinkConfig instance;
    private  static final HDLLinkConfig instance=new HDLLinkConfig();
    private HDLLinkConfig()
    {
        loadConfig();
    }
    /**
     * getInstance
     *
     * @return AuthenticateConfig
     */
    public static synchronized HDLLinkConfig getInstance() {
        if (instance == null) {
            synchronized (HDLLinkConfig.class) {
                if (instance == null) {
                    instance = new HDLLinkConfig();
                    instance.loadConfig();
                }
            }
        }
    public static  HDLLinkConfig getInstance() {
//        if (instance == null) {
//            synchronized (HDLLinkConfig.class) {
//                if (instance == null) {
//                    instance = new HDLLinkConfig();
//                    instance.loadConfig();
//                }
//            }
//        }
        return instance;
    }
@@ -101,9 +108,10 @@
     */
    public boolean checkIfCertified() {
        //localSecret不为空并且长度等于16 网关id不能为空
        return !TextUtils.isEmpty(localSecret)
                && localSecret.length() == 16
                && !TextUtils.isEmpty(gatewayId);
        return !TextUtils.isEmpty(gatewayId);
//        return !TextUtils.isEmpty(localSecret)
//                && localSecret.length() == 16
//                && !TextUtils.isEmpty(gatewayId);
    }
    public void setLocalSecret(String localSecret) {
@@ -127,6 +135,14 @@
    }
    public void setIpAddress(String ipAddress){
        this.ipAddress = ipAddress;
    }
    public String getNetworkName() {
        return networkName;
    }
    public void setNetworkName(String networkName) {
        this.networkName = networkName;
    }
    public GatewaySearchBean getCurrentGateway() {
@@ -177,4 +193,20 @@
    public void setDeviceInfoBean(AuthenticateRequest.AuthenticateDeviceInfoBean deviceInfoBean) {
        this.deviceInfoBean = deviceInfoBean;
    }
    public AuthenticateRequest.RequestBean getRequestBean() {
        return requestBean;
    }
    public void setRequestBean(AuthenticateRequest.RequestBean requestBean) {
        this.requestBean = requestBean;
    }
    public AuthenticateRequest.AuthBean getAuthBean() {
        return authBean;
    }
    public void setAuthBean(AuthenticateRequest.AuthBean authBean) {
        this.authBean = authBean;
    }
}