| | |
| | | import android.text.TextUtils; |
| | | |
| | | import com.hdl.sdk.common.config.TopicConstant; |
| | | import com.hdl.sdk.common.utils.LogUtils; |
| | | import com.hdl.sdk.common.utils.SPUtils; |
| | | import com.hdl.sdk.connect.bean.request.AuthenticateRequest; |
| | | import com.hdl.sdk.connect.bean.response.GatewaySearchBean; |
| | | |
| | | |
| | |
| | | private String ipAddress; |
| | | private boolean isLocalEncrypt;//网关是否需要加密通讯 |
| | | private GatewaySearchBean currentGateway;//当前网关 |
| | | |
| | | private AuthenticateRequest.AuthenticateDeviceInfoBean deviceInfoBean;//当前设备基本信息 |
| | | |
| | | /** |
| | | * instance |
| | |
| | | } |
| | | |
| | | /** |
| | | * 重新保存 |
| | | */ |
| | | public void reSaveConfig() { |
| | | this.saveConfig(this.localSecret, this.gatewayId, this.ipAddress); |
| | | } |
| | | |
| | | /** |
| | | * 检测是否已经认证过 |
| | | * |
| | | * @return |
| | |
| | | } |
| | | |
| | | public String getLocalSecret() { |
| | | LogUtils.i("HDLLinkConfig","密钥是:"+localSecret); |
| | | return localSecret; |
| | | } |
| | | |
| | | public String getGatewayId() { |
| | | return gatewayId; |
| | | } |
| | | public void setGatewayId(String gatewayId) { |
| | | this.gatewayId=gatewayId; |
| | | } |
| | | |
| | | public String getIpAddress() { |
| | | return ipAddress; |
| | | } |
| | | public void setIpAddress(String ipAddress){ |
| | | this.ipAddress = ipAddress; |
| | | } |
| | | |
| | | public boolean isLocalEncrypt() { |
| | |
| | | return (!topicStr.contains(TopicConstant.GATEWAY_AUTH_BROADCAST) //网关广播入网指令 |
| | | && !topicStr.contains(TopicConstant.DEIVCE_AUTH_REQUEST) //入网认证 |
| | | && !topicStr.contains(TopicConstant.GATEWAY_SEARCH) //搜索网关主题 |
| | | && !topicStr.contains(TopicConstant.BROADCAST) |
| | | && isLocalEncrypt//启用加密标志 |
| | | ); |
| | | } |
| | |
| | | return String.format(topicStr, gatewayId); |
| | | } |
| | | |
| | | public AuthenticateRequest.AuthenticateDeviceInfoBean getDeviceInfoBean() { |
| | | return deviceInfoBean; |
| | | } |
| | | |
| | | public void setDeviceInfoBean(AuthenticateRequest.AuthenticateDeviceInfoBean deviceInfoBean) { |
| | | this.deviceInfoBean = deviceInfoBean; |
| | | } |
| | | } |