wjc
2026-03-27 ce83a2fb54a9526fd76aa3ef8ba79c33940921fc
app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java
@@ -1110,6 +1110,16 @@
                    }
                    break;
                    case HDLUniMP.UNI_EVENT_REPLY_BLUETOOTH_Bms_Device_Bluetooth_Get: {
                        //获取蓝牙状态(BMS设备)
                        this.uniGetOrSetDeviceBluetooth(mode_type, data, TopicApi.GATEWAY_Bluetooth_Get, callback);
                    }
                    break;
                    case HDLUniMP.UNI_EVENT_REPLY_BLUETOOTH_Bms_Device_Bluetooth_Set: {
                        //蓝牙设置开启/关闭(BMS设备)
                        this.uniGetOrSetDeviceBluetooth(mode_type, data, TopicApi.GATEWAY_Bluetooth_Set, callback);
                    }
                    break;
                }
            }
@@ -1121,6 +1131,51 @@
    }
    /**
     * 获取设备蓝牙状态,设置蓝牙开开启或者关闭
     *
     * @param callback -
     */
    private void uniGetOrSetDeviceBluetooth(String type, Object data, String TopicApi, DCUniMPJSCallback callback) {
        String mac = getKeyValue("mac", getKeyValue("data", data));
        JsonArray jsonArray = new JsonArray();
        JsonObject jObject = null;
        String attribute_data = getKeyValue("attribute_data", getKeyValue("data", data));
        if (!TextUtils.isEmpty(attribute_data)) {
            try {
                jObject = new Gson().fromJson(attribute_data, JsonObject.class);
            } catch (Exception ignored) {
                jObject = new JsonObject();
            }
        }
        jsonArray.add(jObject);
        TcpClient.getInstance().sendDataToLinkGateway(mac, true, TopicApi, jsonArray, "", new HDLLinkCallBack() {
            @Override
            public void onSuccess(String s) {
                if (callback != null) {
                    try {
                        if (s.startsWith("{")) {
                            uniSuccessCallback(type, new Gson().fromJson(s, JsonObject.class), callback);
                        } else if (s.startsWith("[")) {
                            uniSuccessCallback(type, new Gson().fromJson(s, JsonArray.class), callback);
                        } else {
                            uniSuccessCallback(type, s, callback);
                        }
                    } catch (Exception e) {
                        uniSuccessCallback(type, s, callback);
                    }
                }
            }
            @Override
            public void onError(HDLLinkException e) {
                if (callback != null) {
                    uniCallbackData(type, null, e.getCode(), e.getMsg(), callback);
                }
            }
        });
    }
    /**
     * Uni(取消/暂停)AI聊天对话
     *
     * @param callback -