| | |
| | | import com.hdl.sdk.link.core.callback.GatewayCallBack; |
| | | import com.hdl.sdk.link.core.callback.ModbusCallBack; |
| | | import com.hdl.sdk.link.core.connect.HDLModBusConnect; |
| | | import com.hdl.sdk.link.gateway.HDLLinkLocalGateway; |
| | | |
| | | import org.greenrobot.eventbus.EventBus; |
| | | import org.json.JSONObject; |
| | |
| | | //设备模块 |
| | | switch (type) { |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_ADD: { |
| | | //添加 |
| | | //添加设备到云端 |
| | | String mac = getKeyValue("mac", getKeyValue("data", data)); |
| | | HdlDeviceLogic.getInstance().editGatewayParam(mac, new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | HdlDeviceLogic.getInstance().steGatewayParam(mac, new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(mac); |
| | | if (gatewayBean == null) { |
| | | uniCallbackData(null, -100, "本地找不到网关", callback); |
| | | return; |
| | | } |
| | | HdlDeviceLogic.getInstance().addInverterDevice(mac, |
| | | gatewayBean.getGateway_type(), |
| | | gatewayBean.getSid(), |
| | | gatewayBean.getOid(), |
| | | gatewayBean.getDevice_name(), |
| | | new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | uniCallbackData(null, callback); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(Exception exception) { |
| | | uniCallbackData(null, -100, exception.getMessage(), callback); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(Exception exception) { |
| | | uniCallbackData(null, -100, exception.getMessage(), callback); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(Exception exception) { |
| | | uniCallbackData(null, -100, exception.getMessage(), callback); |
| | | } |
| | | }); |
| | | |
| | | |
| | | } |
| | | break; |