| app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| app/src/main/java/com/hdl/photovoltaic/other/HdlBluetoothLogic.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| app/src/main/java/com/hdl/photovoltaic/other/HdlUniLogic.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/java/com/hdl/photovoltaic/internet/api/TopicApi.java
@@ -246,6 +246,8 @@ public static final String NATIVE_MODBUS_DOWN_SLAVE_REPLY = "/user/%s/custom/native/inverter/down_reply/slaveoid/%s"; public static final String DELETING_GATEWAY_password_verifiy = "/user/%s/custom/native/inverter/password_verifiy"; public static final String GATEWAY_Bluetooth_Get = "/user/%s/custom/bluetooth/get";//网关蓝牙获取 public static final String GATEWAY_Bluetooth_Set = "/user/%s/custom/bluetooth/set";//网关蓝牙设置 } app/src/main/java/com/hdl/photovoltaic/other/HdlBluetoothLogic.java
@@ -142,6 +142,7 @@ this.configurator.release(); } /** * 获取权限状态( 权限检查结果对比) * 检查是否拥有必要的运行时权限(Android 12+ 需动态申请新权限) @@ -167,4 +168,7 @@ } return true; } } 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 - app/src/main/java/com/hdl/photovoltaic/uni/HDLUniMP.java
@@ -167,6 +167,8 @@ public final static String UNI_EVENT_REPLY_BLUETOOTH_Send = "uni_send_data_to_device";//发送数据给设备 public final static String UNI_EVENT_REPLY_BLUETOOTH_status_check = "uni_check_bluetooth_status";//检查蓝牙连接状态 public final static String UNI_EVENT_REPLY_BLUETOOTH_Release = "uni_release_bluetooth_resource";//释放蓝牙资源 public final static String UNI_EVENT_REPLY_BLUETOOTH_Bms_Device_Bluetooth_Get = "device_bluetooth_get";//蓝牙状态获取(BMS设备) public final static String UNI_EVENT_REPLY_BLUETOOTH_Bms_Device_Bluetooth_Set = "device_bluetooth_set";//蓝牙设置开启/关闭(BMS设备) //endregioD //region --------【原生】主动发送到【小程序】--------