---
name: "postBLEBigDataChannelWithProgress"
mode: "kit"
versionRequirements:
  - { name: "DeviceKit", version: "3.0.0" }
  - { name: "@ray-js/ray", version: "0.6.23" }
platform:
  - "iOS"
  - "Android"
async: true
title: "postBLEBigDataChannelWithProgress - 大数据通道操作，支持进度反馈。不同的反馈通过以下事件返回给前端"
---

## postBLEBigDataChannelWithProgress

> [VERSION] DeviceKit >= 3.0.0 | @ray-js/ray >= 0.6.23

> [PLATFORM] iOS, Android

> ⚡ **支持 Promise 调用** — 不传 success / fail / complete 回调时，该方法返回 Promise。

### 描述

大数据通道操作，支持进度反馈。不同的反馈通过以下事件返回给前端 1. 大数据从设备传输到App成功通过【onBLEBigDataChannelDeviceToAppSuccess】事件获取 2. 大数据上传到云端进度通过【onBLEBigDataChannelUploadCloudProgress】事件获取 3. BLE数据通道传输进度通过【onBLEBigDataChannelProgressEvent】事件获取

### 参数

| 属性 | 类型 | 必填 | 默认值 | 最低版本 | 描述 |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | 是 | - | `3.0.0` | deviceId 设备 id |
| `requestParams` | `Record<string, Record<string, any>>` | 是 | - | `3.0.0` | 建立数据传输所需相关参数 command：通道操作的具体指令；start/stop：开启/关闭大数据通道；type：要上传的数据类型 requestParams 通道指令集 {   "command": "start",   "type": "1" } |
| `complete` | `() => void` | 否 | - | - | 接口调用结束的回调函数（调用成功、失败都会执行） |
| `success` | `(params: Object) => void` ↓见下方 | 否 | - | - | 接口调用成功的回调函数 |
| `fail` | `(params: Object) => void` ↓见下方 | 否 | - | - | 接口调用失败的回调函数 |

#### success 回调参数

| 属性 | 类型 | 最低版本 | 描述 |
| --- | --- | --- | --- |
| `deviceId` | `string` | `3.3.0` | deviceId 设备 id |
| `resultParams` | `Record<string, Record<string, any>>` | `3.3.0` | 数据传输完毕相关参数（type dps fileUrl） resultParams 数据传输完毕相关参数 |

#### fail 回调参数

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `errorMsg` | `string` | 错误信息 |
| `errorCode` | `string \| number` | 错误码 |
| `innerError` | `Object` | 错误扩展 |

##### fail(params).innerError 的属性

| 属性 | 类型 | 描述 |
| --- | --- | --- |
| `errorCode` | `string \| number` | 错误扩展码 |
| `errorMsg` | `string` | 错误扩展信息 |


### 示例代码

#### 基础调用

```tsx
import { device } from '@ray-js/ray'

const { postBLEBigDataChannelWithProgress } = device;

postBLEBigDataChannelWithProgress({
  deviceId: 'device_001',
  requestParams: {},
  success: (result) => {
    console.log('postBLEBigDataChannelWithProgress success', result);
  },
  fail: (error) => {
    console.log('postBLEBigDataChannelWithProgress fail', error.errorMsg);
  },
});
```
