| | |
| | | import com.google.gson.JsonObject; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.photovoltaic.bean.InverterBean; |
| | | import com.hdl.photovoltaic.bean.LocalResponse; |
| | | import com.hdl.photovoltaic.bean.PageNumberObject; |
| | | import com.hdl.photovoltaic.config.AppConfigManage; |
| | |
| | | * @param mac 网关mac |
| | | * @param linkCallBack 回调 |
| | | */ |
| | | public void getGatewayInfo(String mac, LinkCallBack<GatewayBean> linkCallBack) { |
| | | public void getGatewayInfo(String mac, LinkCallBack<InverterBean> linkCallBack) { |
| | | String requestUrl = TopicApi.GET_GATEWAY_INFO; |
| | | JsonObject json = new JsonObject(); |
| | | json.addProperty("device_mac", mac); |
| | |
| | | } |
| | | |
| | | Gson gson = new Gson(); |
| | | Type typeOfT = new TypeToken<BaseLocalResponse<GatewayBean>>() { |
| | | Type typeOfT = new TypeToken<BaseLocalResponse<InverterBean>>() { |
| | | }.getType(); |
| | | BaseLocalResponse<GatewayBean> baseLocalResponse = gson.fromJson(json, typeOfT); |
| | | BaseLocalResponse<InverterBean> baseLocalResponse = gson.fromJson(json, typeOfT); |
| | | if (baseLocalResponse == null || baseLocalResponse.getObjects() == null) { |
| | | linkCallBack.onSuccess(new GatewayBean()); |
| | | linkCallBack.onSuccess(new InverterBean()); |
| | | } else { |
| | | linkCallBack.onSuccess(baseLocalResponse.getObjects()); |
| | | } |