| | |
| | | import com.hdl.photovoltaic.uni.HDLUniMP; |
| | | import com.hdl.photovoltaic.uni.HDLUniMPSDKManager; |
| | | import com.hdl.photovoltaic.utils.WifiUtils; |
| | | import com.hdl.sdk.link.HDLLinkLocalSdk; |
| | | import com.hdl.sdk.link.common.exception.HDLLinkException; |
| | | import com.hdl.sdk.link.core.bean.gateway.GatewayBean; |
| | | import com.hdl.sdk.link.core.callback.GatewayCallBack; |
| | | import com.hdl.sdk.link.core.callback.HDLLinkCallBack; |
| | | import com.hdl.sdk.link.core.config.HDLLinkConfig; |
| | | import com.hdl.sdk.link.gateway.HDLLinkLocalGateway; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.json.JSONObject; |
| | |
| | | } |
| | | org.json.JSONObject jsonObject = getJSONObject(data); |
| | | String type_value = ""; |
| | | String oid=""; |
| | | if (jsonObject.has("type")) { |
| | | type_value = jsonObject.getString("type"); |
| | | } |
| | | if (jsonObject.has("oid")) { |
| | | oid = jsonObject.getString("oid"); |
| | | } |
| | | |
| | | if (HDLUniMP.UNI_EVENT_REPLY_HOME_MODEL.equals(event)) { |
| | |
| | | } |
| | | break; |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST: { |
| | | //获取设备列表 |
| | | //网关搜索 |
| | | HdlDeviceLogic.getInstance().searchGateway(new GatewayCallBack() { |
| | | @Override |
| | | public void onSuccess(List<GatewayBean> gatewayBeanList) { |
| | | HDLUniMP.UniCallBackBaseBean callBackBaseBean = new HDLUniMP.UniCallBackBaseBean(); |
| | | callBackBaseBean.setTopic(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_MODEL); |
| | | callBackBaseBean.setType(HDLUniMP.UNI_EVENT_NOTIFICATION_DEVICE_LIST); |
| | | callBackBaseBean.setData(gatewayBeanList); |
| | | sendUni(callBackBaseBean); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | //发送失败 |
| | | } |
| | | }); |
| | | } |
| | | break; |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_MODBUS_SEND:{ |
| | | //发送modbus协议 |
| | | |
| | | } |
| | | } |
| | | |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_WIFI_MODEL.equals(event)) { |
| | |
| | | return new JSONObject(); |
| | | } |
| | | String json = new Gson().toJson(obj); |
| | | |
| | | return new JSONObject(json); |
| | | } catch (Exception e) { |
| | | return new JSONObject(); |