| | |
| | | |
| | | import com.hdl.sdk.common.config.TopicConstant; |
| | | import com.hdl.sdk.common.utils.SPUtils; |
| | | import com.hdl.sdk.connect.bean.GatewaySearchBean; |
| | | |
| | | |
| | | /** |
| | |
| | | private String gatewayId; |
| | | private String ipAddress; |
| | | private boolean isLocalEncrypt;//网关是否需要加密通讯 |
| | | private GatewaySearchBean currentGateway;//当前网关 |
| | | |
| | | /** |
| | | * instance |
| | |
| | | * @return |
| | | */ |
| | | public boolean checkIfCertified(){ |
| | | //localSecret不为空并且长度等于16 |
| | | return !TextUtils.isEmpty(localSecret) && localSecret.length() == 16; |
| | | //localSecret不为空并且长度等于16 网关id不能为空 |
| | | return !TextUtils.isEmpty(localSecret) |
| | | && localSecret.length() == 16 |
| | | && !TextUtils.isEmpty(gatewayId); |
| | | } |
| | | |
| | | public void setLocalSecret(String localSecret) { |
| | |
| | | isLocalEncrypt = localEncrypt; |
| | | } |
| | | |
| | | public GatewaySearchBean getCurrentGateway() { |
| | | return currentGateway; |
| | | } |
| | | |
| | | public void setCurrentGateway(GatewaySearchBean currentGateway) { |
| | | this.currentGateway = currentGateway; |
| | | } |
| | | |
| | | /** |
| | | * 判断当前主题数据是否需要加密 |
| | | * @param topicStr 当前主题 |
| | |
| | | ); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拼接网关ID获取完整的主题 |
| | | * @param topicStr |
| | | * @return |
| | | */ |
| | | public String getFullTopic(String topicStr){ |
| | | return String.format(topicStr, gatewayId); |
| | | } |
| | | |
| | | } |