• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.bluetooth.opp (Bluetooth OPP Module) (System API)
2
3The OPP module provides the Bluetooth-based file transfer functions, including sending files, receiving files, and obtaining the file transfer progress.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 16. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8>
9> This topic describes only the system APIs provided by the module.
10
11## Modules to Import
12
13```js
14import { opp } from '@kit.ConnectivityKit';
15```
16
17## createOppServerProfile
18
19createOppServerProfile(): OppServerProfile
20
21Creates an **OppServerProfile** instance.
22
23**System API**: This is a system API.
24
25**System capability**: SystemCapability.Communication.Bluetooth.Core
26
27**Return value**
28
29| Type                           | Description        |
30| ----------------------------- | ---------- |
31| OppServerProfile | **OppServerProfile** instance.|
32
33**Error codes**
34
35For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
36
37| ID| Error Message|
38| -------- | ---------------------------- |
39|202 | Non-system applications are not allowed to use system APIs.          |
40|801 | Capability not supported.          |
41
42**Example**
43
44```js
45import { AsyncCallback, BusinessError } from '@kit.BasicServicesKit';
46try {
47    let oppProfile = opp.createOppServerProfile();
48    console.info('oppServer success');
49} catch (err) {
50    console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
51}
52```
53
54## OppServerProfile
55
56Represents the **OppServerProfile** class. Before using APIs of this class, you need to create an **OppServerProfile** instance by using the [createOppServerProfile ()](#createoppserverprofile).
57
58### sendFile
59
60sendFile(deviceId: string, fileHolds: Array<FileHolder<): Promise<void>
61
62Send files over Bluetooth.
63
64**System API**: This is a system API.
65
66**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
67
68**System capability**: SystemCapability.Communication.Bluetooth.Core
69
70**Parameters**
71
72| Name    | Type                         | Mandatory  | Description                      |
73| ------- | --------------------------- | ---- | ------------------------ |
74| deviceId | string | Yes   | Bluetooth MAC address of the receiver.|
75| fileHolds | Array<[FileHolder](#fileholder)>| Yes   | File data to transfer. Data is sent according to the sequence it is inserted into the array.|
76
77**Error codes**
78
79For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md).
80
81| ID| Error Message|
82| -------- | ---------------------------- |
83|201 | Permission denied.                 |
84|202 | Permission denied. Non-system applications are not allowed to use system APIs.                 |
85|203 | This function is prohibited by enterprise management policies.                 |
86|401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed.                 |
87|801 | Capability not supported.          |
88|2900001 | Service stopped.                         |
89|2900003 | Bluetooth disabled.                 |
90|2900004 | Profile is not supported.                 |
91|2900099 | Failed to send file.                        |
92|2903001 | The file type is not supported.                 |
93|2903002 | Current Transfer Information is busy.                 |
94|2903003 | The file is not accessible.                        |
95
96**Example**
97
98```js
99import { BusinessError } from '@kit.BasicServicesKit';
100import { fileIo } from '@kit.CoreFileKit';
101import { opp } from '@kit.ConnectivityKit';
102// Create fileHolders.
103try {
104    let oppProfile = opp.createOppServerProfile();
105    let fileHolders : Array<opp.FileHolder> = [];
106    // Valid URIs
107    let uris: Array<string> = ['test1.jpg', 'test2.jpg'];
108    for (let i = 0; i < uris.length; i++) {
109        let filePath = uris[i];
110        console.info('opp deal filePath is :' + filePath);
111        let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
112        let stat: fs.Stat = fs.statSync(file.fd);
113        let fileHolder: opp.FileHolder = {
114        filePath:filePath,
115        fileSize:stat.size,
116        fileFd:file.fd
117        };
118        fileHolders.push(fileHolder);
119    }
120    oppProfile.sendFile("11:22:33:44:55:66", fileHolders);
121    // After the file transfer is complete, call fs.close(file.fd) to close the file descriptor.
122} catch (err) {
123      console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
124}
125```
126
127### setIncomingFileConfirmation
128
129setIncomingFileConfirmation(accept: boolean, fileFd: number): Promise&lt;void&gt;
130
131Receives files over Bluetooth.
132
133**System API**: This is a system API.
134
135**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
136
137**System capability**: SystemCapability.Communication.Bluetooth.Core
138
139**Parameters**
140
141| Name    | Type                         | Mandatory  | Description                      |
142| ------- | --------------------------- | ---- | ------------------------ |
143| accept | boolean | Yes   | Whether to accept the file transfer request. The value **true** means to accept the file transfer request, and the value **false** means the opposite.|
144| fileFd | number| Yes   | File descriptor, which must be enabled during file receiving.|
145
146**Error codes**
147
148For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md).
149
150| ID| Error Message|
151| -------- | ---------------------------- |
152|201 | Permission denied.                 |
153|202 | Permission denied. Non-system applications are not allowed to use system APIs.                 |
154|203 | This function is prohibited by enterprise management policies.                 |
155|401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed.                 |
156|801 | Capability not supported.          |
157|2900001 | Service stopped.                         |
158|2900003 | Bluetooth disabled.                 |
159|2900004 | Profile is not supported.                 |
160|2900099 | Failed to confirm the received file information.                        |
161|2903002 | Current Transfer Information is busy.                 |
162|2903003 | The file is not accessible.                        |
163
164**Example**
165
166```js
167import { BusinessError } from '@kit.BasicServicesKit';
168import { fileIo } from '@kit.CoreFileKit';
169import { opp } from '@kit.ConnectivityKit';
170// Create fileHolders.
171try {
172    let oppProfile = opp.createOppServerProfile();
173    let pathDir = this.context.filesDir + "/test.jpg";
174    let file = fs.openSync(pathDir, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE);
175    oppProfile.setIncomingFileConfirmation(true, file.fd);
176    // Close the file descriptor after file receiving is complete.
177    fs.close(file.fd);
178} catch (err) {
179      console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
180}
181```
182
183### on('transferStateChange')
184
185on(type: 'transferStateChange', callback: Callback&lt;OppTransferInformation&gt;): void
186
187Subscribes to the progress and status changes of Bluetooth file transfer.
188
189**System API**: This is a system API.
190
191**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
192
193**System capability**: SystemCapability.Communication.Bluetooth.Core
194
195**Parameters**
196
197| Name     | Type                                      | Mandatory  | Description                                      |
198| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
199| type     | string                                   | Yes   | Event type. The field has a fixed value of **transferStateChange**. After **on('transferStateChange')** is called, the file transfer progress and status change events will be returned.|
200| callback | Callback&lt;[OppTransferInformation](#opptransferinformation)&gt; | Yes   | Callback used to return the file transfer progress and status change events.                 |
201
202**Error codes**
203
204For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md).
205
206| ID| Error Message|
207| -------- | ---------------------------- |
208|201 | Permission denied.                 |
209|202 | Permission denied. Non-system applications are not allowed to use system APIs.                 |
210|203 | This function is prohibited by enterprise management policies.                 |
211|401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed.                 |
212|801 | Capability not supported.          |
213|2900001 | Service stopped.                         |
214|2900003 | Bluetooth disabled.                 |
215|2900004 | Profile is not supported.                 |
216|2903001 | The file type is not supported.                 |
217|2903002 | Current Transfer Information is busy.                 |
218|2903003 | The file is not accessible.                        |
219
220**Example**
221
222```js
223import { BusinessError } from '@kit.BasicServicesKit';
224import { fileIo } from '@kit.CoreFileKit';
225import { opp } from '@kit.ConnectivityKit';
226// Create fileHolders.
227try {
228    let oppProfile = opp.createOppServerProfile();
229    oppProfile.on("transferStateChange", (data: opp.OppTransferInformation) => {
230        if (data.status == opp.TransferStatus.PENDING) {
231          console.info("[opp_js] waiting to transfer : " + data.remoteDeviceName);
232        } else if (data.status == opp.TransferStatus.RUNNING){
233          console.info("[opp_js] running data.currentBytes " + data.currentBytes + " data.totalBytes" + data.totalBytes);
234        } else if (data.status == opp.TransferStatus.FINISH){
235          console.info("[opp_js] transfer finished, result is " + data.result);
236        }
237      });
238} catch (err) {
239      console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
240}
241```
242
243### off('transferStateChange')
244
245off(type: 'transferStateChange', callback?: Callback&lt;OppTransferInformation&gt;): void
246
247Unsubscribes from the progress and status changes of Bluetooth file transfer.
248
249**System API**: This is a system API.
250
251**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
252
253**System capability**: SystemCapability.Communication.Bluetooth.Core
254
255**Parameters**
256
257| Name     | Type                                      | Mandatory  | Description                                      |
258| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
259| type     | string                                   | Yes   | Event type. The field has a fixed value of **transferStateChange**. After **off('transferStateChange')** is called, the file transfer progress and status change events will not be returned.|
260
261**Error codes**
262
263For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md).
264
265| ID| Error Message|
266| -------- | ---------------------------- |
267|201 | Permission denied.                 |
268|202 | Permission denied. Non-system applications are not allowed to use system APIs.          |
269|203 | This function is prohibited by enterprise management policies.          |
270|801 | Capability not supported.          |
271|2900001 | Service stopped.                         |
272|2900003 | Bluetooth disabled.                 |
273|2900004 | Profile is not supported.                 |
274|2903001 | The file type is not supported.                 |
275|2903002 | Current Transfer Information is busy.                 |
276|2903003 | The file is not accessible.                        |
277
278**Example**
279
280```js
281import { BusinessError } from '@kit.BasicServicesKit';
282import { fileIo } from '@kit.CoreFileKit';
283import { opp } from '@kit.ConnectivityKit';
284// Create fileHolders.
285try {
286    let oppProfile = opp.createOppServerProfile();
287    oppProfile.off("transferStateChange");
288} catch (err) {
289      console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
290}
291```
292
293### on('receiveIncomingFile')
294
295on(type: 'receiveIncomingFile', callback: Callback&lt;OppTransferInformation&gt;): void
296
297Subscribes to Bluetooth file transfer start events.
298
299**System API**: This is a system API.
300
301**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
302
303**System capability**: SystemCapability.Communication.Bluetooth.Core
304
305**Parameters**
306
307| Name     | Type                                      | Mandatory  | Description                                      |
308| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
309| type     | string                                   | Yes   | Event type. The field has a fixed value of **receiveIncomingFile**. After **on('receiveIncomingFile')** is called, an event will be returned when file transfer begins.|
310| callback | Callback&lt;[OppTransferInformation](#opptransferinformation)&gt; | Yes   | Callback used to return the file transfer progress and status change events.                 |
311
312**Error codes**
313
314For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md).
315
316| ID| Error Message|
317| -------- | ---------------------------- |
318|201 | Permission denied.                 |
319|202 | Permission denied. Non-system applications are not allowed to use system APIs.          |
320|203 | This function is prohibited by enterprise management policies.          |
321|801 | Capability not supported.          |
322|2900001 | Service stopped.                         |
323|2900003 | Bluetooth disabled.                 |
324|2900004 | Profile is not supported.                 |
325|2903001 | The file type is not supported.                 |
326|2903002 | Current Transfer Information is busy.                 |
327|2903003 | The file is not accessible.                        |
328
329**Example**
330
331```js
332import { BusinessError } from '@kit.BasicServicesKit';
333import { fileIo } from '@kit.CoreFileKit';
334import { opp } from '@kit.ConnectivityKit';
335// Create fileHolders.
336try {
337    let oppProfile = opp.createOppServerProfile();
338    oppProfile.on("receiveIncomingFile", (data: opp.OppTransferInformation) => {
339        if (data.status == opp.TransferStatus.PENDING) {
340          console.info("[opp_js] received file waiting to confirm : " + data.remoteDeviceName);
341        } else if (data.status == opp.TransferStatus.RUNNING){
342          console.info("[opp_js] running data.currentBytes " + data.currentBytes + " data.totalBytes" + data.totalBytes);
343        } else if (data.status == opp.TransferStatus.FINISH){
344          console.info("[opp_js] transfer finished, result is " + data.result);
345        }
346      });
347} catch (err) {
348      console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
349}
350```
351
352### off('receiveIncomingFile')
353
354off(type: 'receiveIncomingFile', callback?: Callback&lt;OppTransferInformation&gt;): void
355
356Unsubscribes from Bluetooth file transfer completion events.
357
358**System API**: This is a system API.
359
360**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
361
362**System capability**: SystemCapability.Communication.Bluetooth.Core
363
364**Parameters**
365
366| Name     | Type                                      | Mandatory  | Description                                      |
367| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
368| type     | string                                   | Yes   | Event type. The field has a fixed value of **receiveIncomingFile**. After **off('receiveIncomingFile')** is called, an event will be returned when file transfer is complete.|
369
370**Error codes**
371
372For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md).
373
374| ID| Error Message|
375| -------- | ---------------------------- |
376|201 | Permission denied.                 |
377|202 | Permission denied. Non-system applications are not allowed to use system APIs.          |
378|203 | This function is prohibited by enterprise management policies.          |
379|801 | Capability not supported.          |
380|2900001 | Service stopped.                         |
381|2900003 | Bluetooth disabled.                 |
382|2900004 | Profile is not supported.                 |
383|2903001 | The file type is not supported.                 |
384|2903002 | Current Transfer Information is busy.                 |
385|2903003 | The file is not accessible.                        |
386
387**Example**
388
389```js
390import { BusinessError } from '@kit.BasicServicesKit';
391import { fileIo } from '@kit.CoreFileKit';
392import { opp } from '@kit.ConnectivityKit';
393// Create fileHolders.
394try {
395    let oppProfile = opp.createOppServerProfile();
396    oppProfile.off("receiveIncomingFile");
397} catch (err) {
398      console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
399}
400```
401
402### cancelTransfer
403
404cancelTransfer(): Promise&lt;void&gt;
405
406Cancels Bluetooth file transfer.
407
408**System API**: This is a system API.
409
410**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
411
412**System capability**: SystemCapability.Communication.Bluetooth.Core
413
414**Error codes**
415
416For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md).
417
418| ID| Error Message|
419| -------- | ---------------------------- |
420|201 | Permission denied.                 |
421|202 | Permission denied. Non-system applications are not allowed to use system APIs.          |
422|203 | This function is prohibited by enterprise management policies.          |
423|801 | Capability not supported.          |
424|2900001 | Service stopped.                         |
425|2900003 | Bluetooth disabled.                 |
426|2900004 | Profile is not supported.                 |
427|2900099 | Failed to cancel the current transfer.                        |
428|2903002 | Current Transfer Information is busy.                 |
429
430**Example**
431
432```js
433import { BusinessError } from '@kit.BasicServicesKit';
434import { fileIo } from '@kit.CoreFileKit';
435import { opp } from '@kit.ConnectivityKit';
436// Create fileHolders.
437try {
438    let oppProfile = opp.createOppServerProfile();
439    oppProfile.cancelTransfer();
440} catch (err) {
441      console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
442}
443```
444
445### getCurrentTransferInformation
446
447getCurrentTransferInformation(): Promise&lt;[OppTransferInformation](#opptransferinformation)&gt;
448
449Obtains the information about the file that is being transferred.
450
451**System API**: This is a system API.
452
453**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
454
455**System capability**: SystemCapability.Communication.Bluetooth.Core
456
457**Error codes**
458
459For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md).
460
461| ID| Error Message|
462| -------- | ---------------------------- |
463|201 | Permission denied.                 |
464|202 | Permission denied. Non-system applications are not allowed to use system APIs.          |
465|203 | This function is prohibited by enterprise management policies.          |
466|801 | Capability not supported.          |
467|2900001 | Service stopped.                         |
468|2900003 | Bluetooth disabled.                 |
469|2900004 | Profile is not supported.                 |
470|2900099 | Failed to obtain the current transmission information.                        |
471|2903004 | Current Transfer Information is empty.                 |
472
473**Example**
474
475```js
476import { BusinessError } from '@kit.BasicServicesKit';
477import { fileIo } from '@kit.CoreFileKit';
478import { opp } from '@kit.ConnectivityKit';
479// Create fileHolders.
480try {
481    let oppProfile = opp.createOppServerProfile();
482    let data = oppProfile.getCurrentTransferInformation();
483    console.info('[opp_js] data ', data.status);
484} catch (err) {
485      console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
486}
487```
488
489### setLastReceivedFileUri
490
491setLastReceivedFileUri(uri: string): Promise&lt;void&gt;
492
493Sets the URI of the last received file.
494
495**System API**: This is a system API.
496
497**Required permissions**: ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
498
499**System capability**: SystemCapability.Communication.Bluetooth.Core
500
501**Parameters**
502
503| Name    | Type                         | Mandatory  | Description                      |
504| ------- | --------------------------- | ---- | ------------------------ |
505| uri | string | Yes   | URI of the last received file.|
506
507**Error codes**
508
509For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bluetooth Error Codes](errorcode-bluetoothManager.md).
510
511| ID| Error Message|
512| -------- | ---------------------------- |
513|201 | Permission denied.                 |
514|202 | Permission denied. Non-system applications are not allowed to use system APIs.          |
515|203 | This function is prohibited by enterprise management policies.          |
516|401 | Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3. Parameter verification failed.                 |
517|801 | Capability not supported.          |
518|2900001 | Service stopped.                         |
519|2900003 | Bluetooth disabled.                 |
520|2900004 | Profile is not supported.                 |
521|2900099 | Failed to set the URI of the last file.                        |
522
523**Example**
524
525```js
526import { BusinessError } from '@kit.BasicServicesKit';
527import { fileIo } from '@kit.CoreFileKit';
528import { opp } from '@kit.ConnectivityKit';
529// Create fileHolders.
530try {
531    let oppProfile = opp.createOppServerProfile();
532    oppProfile.setLastReceivedFileUri("file://media/Photo/1/IMG_1739266559_000/screenshot_20250211_173419.jpg ");
533} catch (err) {
534      console.error('errCode: ' + (err as BusinessError).code + ', errMessage: ' + (err as BusinessError).message);
535}
536```
537
538## FileHolder
539
540Describes the information about the file to be sent.
541
542**System API**: This is a system API.
543
544**System capability**: SystemCapability.Communication.Bluetooth.Core
545
546| Name             | Type                                    | Read-Only  | Optional  | Description                                      |
547| --------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
548| filePath     | string                                   | No   | No   | URI of the file to be sent, for example, **file://media/Photo/1/IMG_1739266559_000/test.jpg**.|
549| fileSize       | number                                  | No   | No   | Size of the file to be sent, in bytes.         |
550| fileFd | number | No   | No   | Opened file descriptor of the file to be sent. The file descriptor must be kept open until the file transfer is complete.                                   |
551
552## OppTransferInformation
553
554Describes the file transfer information.
555
556**System API**: This is a system API.
557
558**System capability**: SystemCapability.Communication.Bluetooth.Core
559
560| Name             | Type                                    | Read-Only  | Optional  | Description                                      |
561| --------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- |
562| filePath     | string                                   | No   | No   | URI of the file to be sent, for example, **file://media/Photo/1/IMG_1739266559_000/test.jpg**.|
563| remoteDeviceName       | string                                  | No   | No   | Name of the peer device.               |
564| remoteDeviceId | string | No   | No   | MAC address of the peer device.               |
565| direction | [DirectionType](#directiontype) | No   | No   | Transfer direction.               |
566| status | [TransferStatus](#transferstatus) | No   | No   | Transfer status.               |
567| result | [TransferResult](#transferresult) | No   | No   | Transfer result.               |
568| currentBytes | number | No   | No   | Number of transferred bytes.               |
569| totalBytes | number | No   | No   | Total number of bytes to be transferred.               |
570| currentCount | number | No   | No   | Sequence number of the file to be transferred.               |
571| totalCount | number | No   | No   | Total number of transferred files.               |
572
573## DirectionType
574
575Enumerates file transfer directions.
576
577**System API**: This is a system API.
578
579**System capability**: SystemCapability.Communication.Bluetooth.Core
580
581| Name                   | Value | Description          |
582| --------------------- | ---- | ------------ |
583| OUTBOUND   | 0    | File sending.|
584| INBOUND    | 1    | File receiving.     |
585
586## TransferStatus
587
588Enumerates the file transfer states.
589
590**System API**: This is a system API.
591
592**System capability**: SystemCapability.Communication.Bluetooth.Core
593
594| Name                   | Value | Description          |
595| --------------------- | ---- | ------------ |
596| PENDING   | 0    | Waiting for transfer.|
597| RUNNING    | 1    | File transfer in progress.     |
598| FINISH | 2    | File transfer completed.    |
599
600## TransferResult
601
602Enumerates file transfer results.
603
604**System API**: This is a system API.
605
606**System capability**: SystemCapability.Communication.Bluetooth.Core
607
608| Name                   | Value | Description          |
609| --------------------- | ---- | ------------ |
610| SUCCESS   | 0    | File transfer is successful.|
611| ERROR_UNSUPPORTED_TYPE    | 1    | The type of files to be transferred is not supported.     |
612| ERROR_BAD_REQUEST | 2    | The peer device cannot process the file transfer request.    |
613| ERROR_NOT_ACCEPTABLE   | 3    | The peer device rejects the file transfer request.|
614| ERROR_CANCELED    | 4    | The peer device cancels the file transfer.     |
615| ERROR_CONNECTION_FAILED | 5    | The peer device is disconnected.    |
616| ERROR_TRANSFER   | 6    | An error occurs during file transfer.|
617| ERROR_UNKNOWN    | 7    | An unknown error occurs.     |
618