| | |
| | | this.uniGetCurrentHomeLocalAndCloudGatewayList(callback); |
| | | } |
| | | break; |
| | | //modBus协议专用 |
| | | case HDLUniMP.UNI_EVENT_REPLY_DEVICE_MODBUS_SEND: { |
| | | sendModBus(data, callback); |
| | | } |
| | |
| | | break; |
| | | |
| | | } |
| | | } else if (HDLUniMP.UNI_EVENT_REPLY_OTHER_MODEL.equals(event)) { |
| | | //其它模块 |
| | | switch (type) { |
| | | //获取温度单位 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_UNIT: { |
| | | uniCallbackData(UserConfigManage.getInstance().getTemperature_unit(), callback); |
| | | } |
| | | break; |
| | | //获取当前app语言 |
| | | case HDLUniMP.UNI_EVENT_REPLY_OTHER_APP_LANGUAGE: { |
| | | uniCallbackData(UserConfigManage.getInstance().getCurrentAppLanguage(), callback); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | HdlLogLogic.print("uni===原生接收uni发来的数据===" + event + "\r\n" + data, false); |
| | | } catch (Exception e) { |
| | |
| | | |
| | | |
| | | /** |
| | | * 原生打开uni指定页面 |
| | | * 原生【打开】uni指定页面 |
| | | * |
| | | * @param path 打开路径 |
| | | * @param jsonObject 附件数据(没有数据填null) |
| | |
| | | String hardwareModel = getKeyValue("hardwareModel", getKeyValue("data", data));//硬件型号 |
| | | String osImageId = getKeyValue("osImageId", getKeyValue("data", data));//系统镜像id |
| | | String firmwareVersionId = getKeyValue("firmwareVersionId", getKeyValue("data", data));//固件版本id |
| | | // String oid = getKeyValue("oid", getKeyValue("data", data));//固件oid |
| | | List<DeviceFirmwareBean> list = new ArrayList<>(); |
| | | String driverFileList = HdlFileLogic.getInstance().getFirmwareRootPath(); |
| | | File file = new File(driverFileList); |
| | | if (file.list() != null) { |
| | | for (int i = 0; i < Objects.requireNonNull(file.list()).length; i++) { |
| | | String path = Objects.requireNonNull(file.list())[i]; |
| | | // if (!path.contains(oid)) { |
| | | // continue; |
| | | // } |
| | | String[] ary = path.split("/"); |
| | | String[] driverInfoAry = ary[ary.length - 1].split("_"); |
| | | DeviceFirmwareBean deviceFirmwareBean = new DeviceFirmwareBean(); |
| | |
| | | */ |
| | | private void uniDeviceFirmwareDownload(Object data, DCUniMPJSCallback callback) { |
| | | String deviceOidId = getKeyValue("deviceOidId", getKeyValue("data", data));//云端上设备id |
| | | String oid = getKeyValue("oid", getKeyValue("data", data));//设备oid |
| | | String oid = getKeyValue("oid", getKeyValue("data", data));//该固件的oid |
| | | String imageId = getKeyValue("imageId", getKeyValue("data", data));//固件镜像id |
| | | String version = getKeyValue("version", getKeyValue("data", data));//固件版本 |
| | | String localUrl = getKeyValue("localUrl", getKeyValue("data", data));//储存在本地固件文件路径 |
| | |
| | | * 向云端发起【设备固件】升级OTA指令 |
| | | */ |
| | | private void uniUpgradeDeviceFirmware(Object data, DCUniMPJSCallback callback) { |
| | | String deviceMac = getKeyValue("mac", getKeyValue("data", data));//网关设备mac(查找socket) |
| | | String deviceMac = getKeyValue("mac", getKeyValue("data", data));//逆变器设备mac(查找socket) |
| | | String deviceOidId = getKeyValue("deviceOidId", getKeyValue("data", data));//云端上设备id |
| | | String oid = getKeyValue("oid", getKeyValue("data", data));//设备id |
| | | String oid = getKeyValue("oid", getKeyValue("data", data));//升级固件的oid |
| | | String firmwareVersionId = getKeyValue("firmwareVersionId", getKeyValue("data", data));//固件版本id |
| | | String version = getKeyValue("version", getKeyValue("data", data));//固件版本 |
| | | String hardwareModel = getKeyValue("hardwareModel", getKeyValue("data", data));//云端上文件MD5 |
| | |
| | | * 向云端发起【设备驱动下载】指令 |
| | | */ |
| | | private void uniGatewayDriverDownload(Object data, DCUniMPJSCallback callback) { |
| | | String deviceOid = getKeyValue("oid", getKeyValue("data", data));//网关设备oid |
| | | String deviceOid = getKeyValue("oid", getKeyValue("data", data));//逆变器设备oid |
| | | String driverCode = getKeyValue("driverCode", getKeyValue("data", data));//驱动编码 |
| | | String imageId = getKeyValue("imageId", getKeyValue("data", data));//驱动镜像id |
| | | String version = getKeyValue("version", getKeyValue("data", data));//驱动版本 |
| | |
| | | */ |
| | | private void uniUpgradeGatewayDriver(Object data, DCUniMPJSCallback callback) { |
| | | |
| | | String deviceMac = getKeyValue("mac", getKeyValue("data", data));//网关设备mac(查找socket) |
| | | String deviceOid = getKeyValue("oid", getKeyValue("data", data));//网关设备oid |
| | | String deviceMac = getKeyValue("mac", getKeyValue("data", data));//逆变器设备mac(查找socket) |
| | | String deviceOid = getKeyValue("oid", getKeyValue("data", data));//逆变器设备oid |
| | | String driverVersionId = getKeyValue("driverVersionId", getKeyValue("data", data));//驱动版本id |
| | | String module = getKeyValue("module", getKeyValue("data", data));//模块信息 |
| | | String version = getKeyValue("version", getKeyValue("data", data));//驱动版本号 |
| | |
| | | public void onSuccess(List<GatewayBean> list) { |
| | | if (callback != null) { |
| | | uniCallbackData(list, callback); |
| | | //EventBus事件分发 |
| | | //EventBus事件分发,进入住宅开始订阅主题 |
| | | BaseEventBus baseEventBus = new BaseEventBus(); |
| | | baseEventBus.setType(HDLUniMP.UNI_EVENT_REPLY_DEVICE_LIST); |
| | | baseEventBus.setData(list); |
| | | EventBus.getDefault().post(baseEventBus); |
| | | GatewayBean gatewayBean = HdlDeviceLogic.getInstance().queryCurrentHomeMainGateway(list); |
| | | if (gatewayBean != null) { |
| | | //进来住宅详情都要上传一次oid列表到云端; |
| | | HdlDeviceLogic.getInstance().uploadDataToCloud(gatewayBean.getDevice_mac(), null); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | |