| | |
| | | import com.hdl.photovoltaic.ui.bean.HouseIdBean; |
| | | import com.hdl.photovoltaic.ui.bean.LinkBean; |
| | | import com.hdl.photovoltaic.ui.bean.MemberBean; |
| | | import com.hdl.photovoltaic.ui.bean.MessageBean; |
| | | import com.hdl.photovoltaic.ui.bean.NotRunBean; |
| | | import com.hdl.photovoltaic.ui.bean.OidBean; |
| | | import com.hdl.photovoltaic.ui.bean.QrcodeUrlBean; |
| | |
| | | import com.hdl.photovoltaic.ui.bean.UserRightTypeBean; |
| | | import com.hdl.photovoltaic.ui.me.AsRegardsActivity; |
| | | import com.hdl.photovoltaic.ui.me.CPersonalDataActivity; |
| | | import com.hdl.photovoltaic.ui.me.HelpWebActivity; |
| | | import com.hdl.photovoltaic.ui.me.SetActivity; |
| | | import com.hdl.photovoltaic.ui.message.MessageInfoActivity; |
| | | import com.hdl.photovoltaic.ui.newC.MessageCenterListActivity; |
| | | import com.hdl.photovoltaic.ui.newC.PowerStationsListActivity; |
| | | import com.hdl.photovoltaic.uni.HDLUniMP; |
| | |
| | | |
| | | } |
| | | break; |
| | | //打开消息详情 |
| | | case HDLUniMP.UNI_EVENT_REPLY_Message_Center_Detail: { |
| | | try { |
| | | String msgId = getKeyValue("msgId", getKeyValue("data", data));//唯一标识 |
| | | MessageBean messageBean = new MessageBean(); |
| | | messageBean.setMsgId(Long.parseLong(msgId)); |
| | | Intent intent = new Intent(); |
| | | intent.putExtra("messageBean", new Gson().toJson(messageBean)); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | intent.setClass(HDLApp.getInstance(), MessageInfoActivity.class); |
| | | HDLApp.getInstance().startActivity(intent); |
| | | } catch (Exception e) { |
| | | } |
| | | } |
| | | break; |
| | | //打开C端帮助页面 |
| | | case HDLUniMP.UNI_EVENT_REPLY_help_Detail: { |
| | | Intent intent = new Intent(); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | intent.setClass(HDLApp.getInstance(), HelpWebActivity.class); |
| | | HDLApp.getInstance().startActivity(intent); |
| | | } |
| | | break; |
| | | |
| | | |
| | | } |
| | |
| | | break; |
| | | //设备定位 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_GET_DEVICE_LOCATION: { |
| | | this.uniGetDeviceFind(mode_type, data, TopicApi.DELETING_GATEWAY_FIND, callback);; |
| | | this.uniGetDeviceFind(mode_type, data, TopicApi.DELETING_GATEWAY_FIND, callback); |
| | | ; |
| | | } |
| | | break; |
| | | } |
| | |
| | | */ |
| | | public void sendUni(String topic, HDLUniMP.UniCallBackBaseBean callBackBaseBean) { |
| | | try { |
| | | // HdlLogLogic.print("uni---原生主动向小程序发送通知事件---" +topic, false); |
| | | HDLUniMPSDKManager.getInstance().sendUniMPEvent(HDLUniMP.UNI_APP_ID, topic, getJSONObject(callBackBaseBean)); |
| | | } catch (Exception e) { |
| | | HdlLogLogic.print("uni---原生主动向小程序发送通知事件---" + e.getMessage(), false); |
| | |
| | | */ |
| | | private void uniGetDeviceFind(String type, Object data, String TopicApi, DCUniMPJSCallback callback) { |
| | | String mac = getKeyValue("mac", getKeyValue("data", data)); |
| | | JsonArray jsonArray = new JsonArray(); |
| | | JsonObject jObject = null; |
| | | JsonObject jObject = new JsonObject(); |
| | | String attribute_data = getKeyValue("attribute_data", getKeyValue("data", data)); |
| | | if (!TextUtils.isEmpty(attribute_data)) { |
| | | try { |
| | |
| | | jObject = new JsonObject(); |
| | | } |
| | | } |
| | | jsonArray.add(jObject); |
| | | TcpClient.getInstance().sendDataToLinkGateway(mac, false, TopicApi, jsonArray, "", new HDLLinkCallBack() { |
| | | TcpClient.getInstance().sendDataToLinkGateway(mac, false, TopicApi, jObject, "", new HDLLinkCallBack() { |
| | | @Override |
| | | public void onSuccess(String s) { |
| | | if (callback != null) { |
| | |
| | | uniCallbackData(type, null, 6, HDLApp.getInstance().getAppLocaleContext().getString(R.string.ota_binding_cloud_upgrade_fails), callback); |
| | | return; |
| | | } |
| | | if (cloudInverterDeviceBean.getDeviceStatus() != 3) { |
| | | if (cloudInverterDeviceBean.getDeviceStatus() == 1 || cloudInverterDeviceBean.getDeviceStatus() == 4) { |
| | | uniCallbackData(type, null, cloudInverterDeviceBean.getDeviceStatus(), HDLApp.getInstance().getAppLocaleContext().getString(R.string.ota_not_cloud_upgrade_fails), callback); |
| | | return; |
| | | } |
| | |
| | | uniCallbackData(type, null, 6, HDLApp.getInstance().getAppLocaleContext().getString(R.string.ota_binding_cloud_upgrade_fails), callback); |
| | | return; |
| | | } |
| | | if (cloudInverterDeviceBean.getDeviceStatus() != 3) { |
| | | if (cloudInverterDeviceBean.getDeviceStatus() == 1 || cloudInverterDeviceBean.getDeviceStatus() == 4) { |
| | | uniCallbackData(type, null, cloudInverterDeviceBean.getDeviceStatus(), HDLApp.getInstance().getAppLocaleContext().getString(R.string.ota_not_cloud_upgrade_fails), callback); |
| | | return; |
| | | } |
| | |
| | | private void uniGetLocalDrivers(String type, Object data, DCUniMPJSCallback callback) { |
| | | try { |
| | | String driveCode = getKeyValue("driveCode", getKeyValue("data", data));//驱动编号或驱动名称 |
| | | // String osImageId = getKeyValue("osImageId", getKeyValue("data", data));//驱动类型id |
| | | String imageId = getKeyValue("imageId", getKeyValue("data", data));//驱动镜像Id |
| | | // String driverVersionId = getKeyValue("driverVersionId", getKeyValue("data", data));//驱动类型id |
| | | List<GatewayDriverBean> list = new ArrayList<>(); |
| | | String driverFileList = HdlFileLogic.getInstance().getDriveRootPath(); |
| | |
| | | if (file.list() != null) { |
| | | for (int i = 0; i < Objects.requireNonNull(file.list()).length; i++) { |
| | | String fileName = Objects.requireNonNull(file.list())[i]; |
| | | if (!fileName.contains(driveCode)) { |
| | | if (!fileName.contains(driveCode + "_" + imageId)) { |
| | | continue; |
| | | } |
| | | String[] driverInfoAry = fileName.split("_"); |
| | | GatewayDriverBean gatewayDriverBean = new GatewayDriverBean(); |
| | | gatewayDriverBean.setDriverCode(driverInfoAry[0]); |
| | | gatewayDriverBean.setVersion(driverInfoAry[1].replace(".zip", "")); |
| | | gatewayDriverBean.setLocalUrl(HdlFileLogic.getInstance().getDrivePathFileName(gatewayDriverBean.getDriverCode(), gatewayDriverBean.getVersion())); |
| | | gatewayDriverBean.setImageId(driverInfoAry[1]); |
| | | gatewayDriverBean.setVersion(driverInfoAry[2].replace(".zip", "")); |
| | | gatewayDriverBean.setLocalUrl(HdlFileLogic.getInstance().getDrivePathFileName(gatewayDriverBean.getDriverCode(),gatewayDriverBean.getImageId(), gatewayDriverBean.getVersion())); |
| | | list.add(gatewayDriverBean); |
| | | } |
| | | } |
| | |
| | | |
| | | // String deviceOid = getKeyValue("oid", getKeyValue("data", data));//逆变器设备oid |
| | | String driverCode = getKeyValue("driverCode", getKeyValue("data", data));//驱动编码 |
| | | // String imageId = getKeyValue("imageId", getKeyValue("data", data));//驱动镜像id |
| | | String imageId = getKeyValue("imageId", getKeyValue("data", data));//驱动镜像id |
| | | String version = getKeyValue("version", getKeyValue("data", data));//驱动版本 |
| | | // String driverVersionId = getKeyValue("driverVersionId", getKeyValue("data", data));//驱动版本id |
| | | String localUrl = getKeyValue("localUrl", getKeyValue("data", data));//储存在本地驱动文件路径 |
| | |
| | | @Override |
| | | public void run() { |
| | | |
| | | String drivePathFileName = HdlFileLogic.getInstance().getDrivePathFileName(driverCode, version); |
| | | String drivePathFileName = HdlFileLogic.getInstance().getDrivePathFileName(driverCode,imageId, version); |
| | | //不在子线程读流会卡死主线程 |
| | | boolean isBoolean = HdlOtaLogic.getInstance().disposeDownLoadFile(drivePathFileName, responseBody, md5, HdlOtaLogic.driver_type); |
| | | if (isBoolean) { |
| | |
| | | @Override |
| | | public void onServiceConnected(ComponentName name, IBinder service) { |
| | | //本地升级驱动文件路径 |
| | | String drivePathFileName = HdlFileLogic.getInstance().getDrivePathFileName(driverCode, version); |
| | | String drivePathFileName = HdlFileLogic.getInstance().getDrivePathFileName(driverCode,imageId, version); |
| | | byte[] data = HdlFileLogic.getInstance().readFileByte(drivePathFileName); |
| | | if (data == null || data.length == 0) { |
| | | uniCallbackData(type, null, -2, HDLApp.getInstance().getAppLocaleContext().getString(R.string.found_locally_drive_file), callback); |
| | |
| | | uniCallbackData(type, null, 6, HDLApp.getInstance().getAppLocaleContext().getString(R.string.ota_binding_cloud_upgrade_fails), callback); |
| | | return; |
| | | } |
| | | if (cloudInverterDeviceBean.getDeviceStatus() != 3) { |
| | | if (cloudInverterDeviceBean.getDeviceStatus() == 1 || cloudInverterDeviceBean.getDeviceStatus() == 4) { |
| | | uniCallbackData(type, null, cloudInverterDeviceBean.getDeviceStatus(), HDLApp.getInstance().getAppLocaleContext().getString(R.string.ota_not_cloud_upgrade_fails), callback); |
| | | return; |
| | | } |
| | |
| | | uniCallbackData(type, null, 6, HDLApp.getInstance().getAppLocaleContext().getString(R.string.ota_binding_cloud_upgrade_fails), callback); |
| | | return; |
| | | } |
| | | if (cloudInverterDeviceBean.getDeviceStatus() != 3) { |
| | | if (cloudInverterDeviceBean.getDeviceStatus() == 1 || cloudInverterDeviceBean.getDeviceStatus() == 4) { |
| | | uniCallbackData(type, null, cloudInverterDeviceBean.getDeviceStatus(), HDLApp.getInstance().getAppLocaleContext().getString(R.string.ota_not_cloud_upgrade_fails), callback); |
| | | return; |
| | | } |