| | |
| | | |
| | | import android.text.TextUtils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.google.gson.Gson; |
| | | import com.hdl.photovoltaic.HDLApp; |
| | | import com.hdl.photovoltaic.bean.BaseEventBus; |
| | |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_ADD: { |
| | | //添加设备到云端 |
| | | String mac = getKeyValue("mac", getKeyValue("data", data)); |
| | | |
| | | HdlDeviceLogic.getInstance().steGatewayParam(mac, new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | |
| | | |
| | | } |
| | | break; |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST: { |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_NET_LIST: { |
| | | //网关搜索 |
| | | HdlDeviceLogic.getInstance().searchGateway(new GatewayCallBack() { |
| | | @Override |
| | |
| | | }); |
| | | } |
| | | break; |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST: { |
| | | //获取网关设备列表 |
| | | HdlDeviceLogic.getInstance().getLocalGatewayList(new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | if (callback != null) { |
| | | uniCallbackData(HDLLinkLocalGateway.getInstance().getGatewayList(), callback); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(Exception exception) { |
| | | if (callback != null) { |
| | | uniCallbackData(null, -2, exception.getMessage(), callback); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | break; |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_MODBUS_SEND: { |
| | | sendModBus(data, callback); |
| | | |