| | |
| | | import android.view.View; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.hdl.linkpm.sdk.core.exception.HDLException; |
| | | import com.hdl.photovoltaic.R; |
| | | import com.hdl.photovoltaic.base.CustomBaseActivity; |
| | | import com.hdl.photovoltaic.config.UserConfigManage; |
| | | import com.hdl.photovoltaic.databinding.ActivityTestMainBinding; |
| | | import com.hdl.photovoltaic.enums.ShowErrorMode; |
| | | import com.hdl.photovoltaic.listener.CloudCallBeak; |
| | | import com.hdl.photovoltaic.listener.LinkCallBack; |
| | | import com.hdl.photovoltaic.other.HdlDeviceLogic; |
| | | import com.hdl.photovoltaic.other.HdlThreadLogic; |
| | | import com.hdl.photovoltaic.ui.bean.CloudInverterChildDeviceBean; |
| | | import com.hdl.photovoltaic.ui.bean.OidBean; |
| | | import com.hdl.photovoltaic.widget.ConfirmationCancelDialog; |
| | | import com.hdl.photovoltaic.widget.ConfirmationExceptionDialog; |
| | |
| | | |
| | | private ActivityTestMainBinding viewBinding; |
| | | private TestTitleAdapter testTitleAdapter; |
| | | |
| | | private List<OidBean> mOidList; |
| | | |
| | | @Override |
| | | public Object getContentView() { |
| | |
| | | s.add("获取逆变器oid列表"); |
| | | s.add("读取逆变器详情"); |
| | | s.add("清除逆变器住宅Id"); |
| | | s.add("上传oid列表给云端"); |
| | | s.add("获取逆变器下挂设备列表"); |
| | | return s; |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | setError(e); |
| | | setError(e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | | } |
| | |
| | | HdlDeviceLogic.getInstance().getInverterOidList(gatewayBean.getDevice_mac(), new LinkCallBack<List<OidBean>>() { |
| | | @Override |
| | | public void onSuccess(List<OidBean> obj) { |
| | | mOidList = obj; |
| | | gsonConvertJsonStr(obj); |
| | | } |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | setError(e); |
| | | setError(e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | setError(e); |
| | | setError(e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void onError(HDLLinkException e) { |
| | | setError(e); |
| | | setError(e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | break; |
| | | case "上传oid列表给云端": { |
| | | if (this.mOidList == null || this.mOidList.size() == 0) { |
| | | hideLoading(); |
| | | HdlThreadLogic.toast(this, "没有oid列表数据,请先获取逆变器oid列表数据,再重新上传."); |
| | | return; |
| | | } |
| | | HdlDeviceLogic.getInstance().fullUpdateOid(this.mOidList, new CloudCallBeak<Boolean>() { |
| | | @Override |
| | | public void onSuccess(Boolean obj) { |
| | | gsonConvertJsonStr(obj); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | setError(e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | | } |
| | | break; |
| | | case "获取逆变器下挂设备列表": { |
| | | HdlDeviceLogic.getInstance().getInverterDeviceChildDeviceList(gatewayBean.getOid(), new CloudCallBeak<List<CloudInverterChildDeviceBean>>() { |
| | | @Override |
| | | public void onSuccess(List<CloudInverterChildDeviceBean> obj) { |
| | | gsonConvertJsonStr(obj); |
| | | } |
| | | |
| | | @Override |
| | | public void onFailure(HDLException e) { |
| | | setError(e.getMsg(), e.getCode()); |
| | | } |
| | | }); |
| | | } |
| | | break; |
| | | default: { |
| | | HdlThreadLogic.runMainThread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | hideLoading(); |
| | | } |
| | | }, this, ShowErrorMode.YES); |
| | | break; |
| | | } |
| | | |
| | | } |
| | | |
| | | private void setError(HDLLinkException hdlLinkException) { |
| | | String error = hdlLinkException.getMsg() + "(" + hdlLinkException.getCode() + ")"; |
| | | } |
| | | |
| | | private void setError(String msg, int code) { |
| | | String error = msg + "(" + code + ")"; |
| | | showText(error); |
| | | } |
| | | |