• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2023-2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ConnectivityKit
19 */
20
21import type { AsyncCallback } from './@ohos.base';
22import type baseProfile from './@ohos.bluetooth.baseProfile';
23
24/**
25 * Provides methods to accessing bluetooth audio related capabilities.
26 *
27 * @namespace a2dp
28 * @syscap SystemCapability.Communication.Bluetooth.Core
29 * @since 10
30 */
31/**
32 * Provides methods to accessing bluetooth audio related capabilities.
33 *
34 * @namespace a2dp
35 * @syscap SystemCapability.Communication.Bluetooth.Core
36 * @crossplatform
37 * @since arkts {'1.1':'13','1.2':'20'}
38 * @arkts 1.1&1.2
39 */
40declare namespace a2dp {
41  /**
42   * Base interface of profile.
43   *
44   * @typedef { baseProfile.BaseProfile } BaseProfile
45   * @syscap SystemCapability.Communication.Bluetooth.Core
46   * @since arkts {'1.1':'10','1.2':'20'}
47   * @arkts 1.1&1.2
48   */
49  type BaseProfile = baseProfile.BaseProfile;
50
51  /**
52   * create the instance of a2dp profile.
53   *
54   * @returns { A2dpSourceProfile } Returns the instance of profile.
55   * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified.
56   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
57   * @throws { BusinessError } 801 - Capability not supported.
58   * @syscap SystemCapability.Communication.Bluetooth.Core
59   * @since 10
60   */
61  /**
62   * create the instance of a2dp profile.
63   *
64   * @returns { A2dpSourceProfile } Returns the instance of profile.
65   * @throws { BusinessError } 401 - Invalid parameter.Possible causes: 1. Mandatory parameters are left unspecified.
66   * <br>2. Incorrect parameter types. 3. Parameter verification failed.
67   * @throws { BusinessError } 801 - Capability not supported.
68   * @syscap SystemCapability.Communication.Bluetooth.Core
69   * @crossplatform
70   * @since arkts {'1.1':'13','1.2':'20'}
71   * @arkts 1.1&1.2
72   */
73  function createA2dpSrcProfile(): A2dpSourceProfile;
74
75  /**
76   * Manager a2dp source profile.
77   *
78   * @typedef A2dpSourceProfile
79   * @syscap SystemCapability.Communication.Bluetooth.Core
80   * @since 10
81   */
82  /**
83   * Manager a2dp source profile.
84   *
85   * @extends BaseProfile
86   * @typedef A2dpSourceProfile
87   * @syscap SystemCapability.Communication.Bluetooth.Core
88   * @crossplatform
89   * @since arkts {'1.1':'13','1.2':'20'}
90   * @arkts 1.1&1.2
91   */
92  interface A2dpSourceProfile extends BaseProfile {
93    /**
94     * Initiate an A2DP connection to a remote device.
95     *
96     * @permission ohos.permission.ACCESS_BLUETOOTH
97     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
98     * @throws { BusinessError } 201 - Permission denied.
99     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
100     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
101     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
102     * @throws { BusinessError } 801 - Capability not supported.
103     * @throws { BusinessError } 2900001 - Service stopped.
104     * @throws { BusinessError } 2900003 - Bluetooth disabled.
105     * @throws { BusinessError } 2900004 - Profile not supported.
106     * @throws { BusinessError } 2900099 - Operation failed.
107     * @syscap SystemCapability.Communication.Bluetooth.Core
108     * @systemapi
109     * @since 10
110     */
111    connect(deviceId: string): void;
112
113    /**
114     * Disconnect the A2DP connection with the remote device.
115     *
116     * @permission ohos.permission.ACCESS_BLUETOOTH
117     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
118     * @throws { BusinessError } 201 - Permission denied.
119     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
120     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
121     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
122     * @throws { BusinessError } 801 - Capability not supported.
123     * @throws { BusinessError } 2900001 - Service stopped.
124     * @throws { BusinessError } 2900003 - Bluetooth disabled.
125     * @throws { BusinessError } 2900004 - Profile not supported.
126     * @throws { BusinessError } 2900099 - Operation failed.
127     * @syscap SystemCapability.Communication.Bluetooth.Core
128     * @systemapi
129     * @since 10
130     */
131    disconnect(deviceId: string): void;
132
133    /**
134     * Obtains the playing state of device.
135     *
136     * @permission ohos.permission.ACCESS_BLUETOOTH
137     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
138     * @returns { PlayingState } Returns the playing state.
139     * @throws { BusinessError } 201 - Permission denied.
140     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
141     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
142     * @throws { BusinessError } 801 - Capability not supported.
143     * @throws { BusinessError } 2900001 - Service stopped.
144     * @throws { BusinessError } 2900003 - Bluetooth disabled.
145     * @throws { BusinessError } 2900004 - Profile not supported.
146     * @throws { BusinessError } 2900099 - Operation failed.
147     * @syscap SystemCapability.Communication.Bluetooth.Core
148     * @since 10
149     */
150    getPlayingState(deviceId: string): PlayingState;
151
152    /**
153     * Checks whether the device supports absolute volume.
154     *
155     * @permission ohos.permission.ACCESS_BLUETOOTH
156     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
157     * @returns { Promise<boolean> } Returns the promise object.
158     * @throws { BusinessError } 201 - Permission denied.
159     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
160     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
161     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
162     * @throws { BusinessError } 801 - Capability not supported.
163     * @throws { BusinessError } 2900001 - Service stopped.
164     * @throws { BusinessError } 2900003 - Bluetooth disabled.
165     * @throws { BusinessError } 2900099 - Operation failed.
166     * @syscap SystemCapability.Communication.Bluetooth.Core
167     * @systemapi
168     * @since 11
169     */
170    isAbsoluteVolumeSupported(deviceId: string): Promise<boolean>;
171
172    /**
173     * Checks whether the device supports absolute volume.
174     *
175     * @permission ohos.permission.ACCESS_BLUETOOTH
176     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
177     * @param { AsyncCallback<boolean> } callback - Callback used to listen for the pairing request event.
178     * @throws { BusinessError } 201 - Permission denied.
179     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
180     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
181     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
182     * @throws { BusinessError } 801 - Capability not supported.
183     * @throws { BusinessError } 2900001 - Service stopped.
184     * @throws { BusinessError } 2900003 - Bluetooth disabled.
185     * @throws { BusinessError } 2900099 - Operation failed.
186     * @syscap SystemCapability.Communication.Bluetooth.Core
187     * @systemapi
188     * @since 11
189     */
190    isAbsoluteVolumeSupported(deviceId: string, callback: AsyncCallback<boolean>): void;
191
192    /**
193     * Checks whether the absolute volume is enabled.
194     *
195     * @permission ohos.permission.ACCESS_BLUETOOTH
196     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
197     * @returns { Promise<boolean> } Returns the promise object.
198     * @throws { BusinessError } 201 - Permission denied.
199     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
200     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
201     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
202     * @throws { BusinessError } 801 - Capability not supported.
203     * @throws { BusinessError } 2900001 - Service stopped.
204     * @throws { BusinessError } 2900003 - Bluetooth disabled.
205     * @throws { BusinessError } 2900099 - Operation failed.
206     * @syscap SystemCapability.Communication.Bluetooth.Core
207     * @systemapi
208     * @since 11
209     */
210    isAbsoluteVolumeEnabled(deviceId: string): Promise<boolean>;
211
212    /**
213     * Checks whether the absolute volume is enabled.
214     *
215     * @permission ohos.permission.ACCESS_BLUETOOTH
216     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
217     * @param { AsyncCallback<boolean> } callback - the callback result.
218     * @throws { BusinessError } 201 - Permission denied.
219     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
220     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
221     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
222     * @throws { BusinessError } 801 - Capability not supported.
223     * @throws { BusinessError } 2900001 - Service stopped.
224     * @throws { BusinessError } 2900003 - Bluetooth disabled.
225     * @throws { BusinessError } 2900099 - Operation failed.
226     * @syscap SystemCapability.Communication.Bluetooth.Core
227     * @systemapi
228     * @since 11
229     */
230    isAbsoluteVolumeEnabled(deviceId: string, callback: AsyncCallback<boolean>): void;
231
232    /**
233     * Turn on the absolute volume switch.
234     *
235     * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
236     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
237     * @returns { Promise<void> } Returns the promise object.
238     * @throws { BusinessError } 201 - Permission denied.
239     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
240     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
241     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
242     * @throws { BusinessError } 801 - Capability not supported.
243     * @throws { BusinessError } 2900001 - Service stopped.
244     * @throws { BusinessError } 2900003 - Bluetooth disabled.
245     * @throws { BusinessError } 2900099 - Operation failed.
246     * @syscap SystemCapability.Communication.Bluetooth.Core
247     * @systemapi
248     * @since 11
249     */
250    enableAbsoluteVolume(deviceId: string): Promise<void>;
251
252    /**
253     * Turn on the absolute volume switch..
254     *
255     * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
256     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
257     * @param { AsyncCallback<void> } callback - the callback result.
258     * @throws { BusinessError } 201 - Permission denied.
259     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
260     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
261     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
262     * @throws { BusinessError } 801 - Capability not supported.
263     * @throws { BusinessError } 2900001 - Service stopped.
264     * @throws { BusinessError } 2900003 - Bluetooth disabled.
265     * @throws { BusinessError } 2900099 - Operation failed.
266     * @syscap SystemCapability.Communication.Bluetooth.Core
267     * @systemapi
268     * @since 11
269     */
270    enableAbsoluteVolume(deviceId: string, callback: AsyncCallback<void>): void;
271
272    /**
273     * Turn off the absolute volume switch.
274     *
275     * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
276     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
277     * @returns { Promise<void> } Returns the promise object.
278     * @throws { BusinessError } 201 - Permission denied.
279     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
280     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
281     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
282     * @throws { BusinessError } 801 - Capability not supported.
283     * @throws { BusinessError } 2900001 - Service stopped.
284     * @throws { BusinessError } 2900003 - Bluetooth disabled.
285     * @throws { BusinessError } 2900099 - Operation failed.
286     * @syscap SystemCapability.Communication.Bluetooth.Core
287     * @systemapi
288     * @since 11
289     */
290    disableAbsoluteVolume(deviceId: string): Promise<void>;
291
292    /**
293     * Turn off the absolute volume switch..
294     *
295     * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
296     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
297     * @param { AsyncCallback<void> } callback - the callback result.
298     * @throws { BusinessError } 201 - Permission denied.
299     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
300     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
301     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
302     * @throws { BusinessError } 801 - Capability not supported.
303     * @throws { BusinessError } 2900001 - Service stopped.
304     * @throws { BusinessError } 2900003 - Bluetooth disabled.
305     * @throws { BusinessError } 2900099 - Operation failed.
306     * @syscap SystemCapability.Communication.Bluetooth.Core
307     * @systemapi
308     * @since 11
309     */
310    disableAbsoluteVolume(deviceId: string, callback: AsyncCallback<void>): void;
311
312    /**
313     * Get the full codec capabilities negotiated between the active device and the local device.
314     *
315     * @permission ohos.permission.ACCESS_BLUETOOTH
316     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
317     * @returns { CodecInfoList[] } Returns the CodecInfoList.
318     * @throws { BusinessError } 201 - Permission denied.
319     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
320     * @throws { BusinessError } 801 - Capability not supported.
321     * @throws { BusinessError } 2900001 - Service stopped.
322     * @throws { BusinessError } 2900003 - Bluetooth disabled.
323     * @throws { BusinessError } 2900099 - Operation failed.
324     * @throws { BusinessError } 2902008 - Current device is not an active device.
325     * @syscap SystemCapability.Communication.Bluetooth.Core
326     * @systemapi
327     * @since 19
328     */
329    getCurrentFullCodecInfo(deviceId: string): CodecInfoList[];
330
331    /**
332     * Get codec information.
333     *
334     * @permission ohos.permission.ACCESS_BLUETOOTH
335     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
336     * @returns { CodecInfo } Returns the CodecInfo.
337     * @throws { BusinessError } 201 - Permission denied.
338     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
339     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
340     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
341     * @throws { BusinessError } 801 - Capability not supported.
342     * @throws { BusinessError } 2900001 - Service stopped.
343     * @throws { BusinessError } 2900003 - Bluetooth disabled.
344     * @throws { BusinessError } 2900099 - Operation failed.
345     * @syscap SystemCapability.Communication.Bluetooth.Core
346     * @systemapi
347     * @since 11
348     */
349    getCurrentCodecInfo(deviceId: string): CodecInfo;
350
351    /**
352     * Set codec information.
353     *
354     * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
355     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
356     * @param { CodecInfo } codecInfo - Indicates the CodecInfo.
357     * @throws { BusinessError } 201 - Permission denied.
358     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
359     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
360     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
361     * @throws { BusinessError } 801 - Capability not supported.
362     * @throws { BusinessError } 2900001 - Service stopped.
363     * @throws { BusinessError } 2900003 - Bluetooth disabled.
364     * @throws { BusinessError } 2900099 - Operation failed.
365     * @syscap SystemCapability.Communication.Bluetooth.Core
366     * @systemapi
367     * @since 11
368     */
369    setCurrentCodecInfo(deviceId: string, codecInfo: CodecInfo): void;
370
371    /**
372     * Restriction devices to play music within {@code duration} milliseconds of connection.
373     *
374     * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
375     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
376     * @param { number } duration - Restricted duration <milliseconds>. Valid range is from 3000ms to 20000ms.
377     * @returns { Promise<void> } Returns the promise object.
378     * @throws { BusinessError } 201 - Permission denied.
379     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
380     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
381     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
382     * @throws { BusinessError } 801 - Capability not supported.
383     * @throws { BusinessError } 2900001 - Service stopped.
384     * @throws { BusinessError } 2900003 - Bluetooth disabled.
385     * @throws { BusinessError } 2900099 - Operation failed.
386     * @syscap SystemCapability.Communication.Bluetooth.Core
387     * @systemapi
388     * @since 12
389     */
390    disableAutoPlay(deviceId: string, duration: number): Promise<void>;
391
392    /**
393     * Allow devices to automatically play music when connected.
394     *
395     * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
396     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
397     * @returns { Promise<void> } Returns the promise object.
398     * @throws { BusinessError } 201 - Permission denied.
399     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
400     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
401     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
402     * @throws { BusinessError } 801 - Capability not supported.
403     * @throws { BusinessError } 2900001 - Service stopped.
404     * @throws { BusinessError } 2900003 - Bluetooth disabled.
405     * @throws { BusinessError } 2900099 - Operation failed.
406     * @syscap SystemCapability.Communication.Bluetooth.Core
407     * @systemapi
408     * @since 12
409     */
410    enableAutoPlay(deviceId: string): Promise<void>;
411
412    /**
413     * Obtains the duration for which automatic playback is disabled.
414     *
415     * @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
416     * @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
417     * @returns { Promise<number> } Returns the duration <milliseconds>;
418     *                              If returns { @code -1 } means allow devices automatic play music when connected.
419     * @throws { BusinessError } 201 - Permission denied.
420     * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
421     * @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
422     * <br>2. Incorrect parameter types. 3. Parameter verification failed.
423     * @throws { BusinessError } 801 - Capability not supported.
424     * @throws { BusinessError } 2900001 - Service stopped.
425     * @throws { BusinessError } 2900003 - Bluetooth disabled.
426     * @throws { BusinessError } 2900099 - Operation failed.
427     * @syscap SystemCapability.Communication.Bluetooth.Core
428     * @systemapi
429     * @since 12
430     */
431    getAutoPlayDisabledDuration(deviceId: string): Promise<number>;
432  }
433
434  /**
435   * Describes the codec information.
436   *
437   * @typedef CodecInfo
438   * @syscap SystemCapability.Communication.Bluetooth.Core
439   * @since 11
440   */
441  interface CodecInfo {
442    /**
443     * codec type
444     *
445     * @type { CodecType }
446     * @syscap SystemCapability.Communication.Bluetooth.Core
447     * @since 11
448     */
449    codecType: CodecType;
450    /**
451     * codec bits per sample.
452     *
453     * @type { CodecBitsPerSample }
454     * @syscap SystemCapability.Communication.Bluetooth.Core
455     * @since 11
456     */
457    codecBitsPerSample: CodecBitsPerSample;
458    /**
459     * codec channel mode.
460     *
461     * @type { CodecChannelMode }
462     * @syscap SystemCapability.Communication.Bluetooth.Core
463     * @since 11
464     */
465    codecChannelMode: CodecChannelMode;
466    /**
467     * codec sample rate.
468     *
469     * @type { CodecSampleRate }
470     * @syscap SystemCapability.Communication.Bluetooth.Core
471     * @since 11
472     */
473    codecSampleRate: CodecSampleRate;
474    /**
475     * codec bit rate.
476     *
477     * @type { ?CodecBitRate }
478     * @syscap SystemCapability.Communication.Bluetooth.Core
479     * @since 19
480     */
481    codecBitRate?: CodecBitRate;
482    /**
483     * codec frame length.
484     *
485     * @type { ?CodecFrameLength }
486     * @syscap SystemCapability.Communication.Bluetooth.Core
487     * @since 19
488     */
489    codecFrameLength?: CodecFrameLength;
490  }
491
492  /**
493   * Describes the codec information.
494   *
495   * @typedef CodecInfoList
496   * @syscap SystemCapability.Communication.Bluetooth.Core
497   * @since 19
498   */
499  interface CodecInfoList {
500    /**
501     * codec type
502     *
503     * @type { CodecType }
504     * @syscap SystemCapability.Communication.Bluetooth.Core
505     * @since 19
506     */
507    codecType: CodecType;
508    /**
509     * codec bits per sample list.
510     *
511     * @type { CodecBitsPerSample[] }
512     * @syscap SystemCapability.Communication.Bluetooth.Core
513     * @since 19
514     */
515    codecBitsPerSampleArray: CodecBitsPerSample[];
516    /**
517     * codec channel mode list.
518     *
519     * @type { CodecChannelMode[] }
520     * @syscap SystemCapability.Communication.Bluetooth.Core
521     * @since 19
522     */
523    codecChannelModeArray: CodecChannelMode[];
524    /**
525     * codec sample rate list.
526     *
527     * @type { CodecSampleRate[] }
528     * @syscap SystemCapability.Communication.Bluetooth.Core
529     * @since 19
530     */
531    codecSampleRateArray: CodecSampleRate[];
532    /**
533     * codec bit rate list.
534     *
535     * @type { CodecBitRate[] }
536     * @syscap SystemCapability.Communication.Bluetooth.Core
537     * @since 19
538     */
539    codecBitRateArray: CodecBitRate[];
540    /**
541     * codec frame length list.
542     *
543     * @type { CodecFrameLength[] }
544     * @syscap SystemCapability.Communication.Bluetooth.Core
545     * @since 19
546     */
547    codecFrameLengthArray: CodecFrameLength[];
548  }
549
550  /**
551   * The enum of a2dp playing state.
552   *
553   * @enum { number }
554   * @syscap SystemCapability.Communication.Bluetooth.Core
555   * @since 10
556   */
557  enum PlayingState {
558    /**
559     * Not playing.
560     *
561     * @syscap SystemCapability.Communication.Bluetooth.Core
562     * @since 10
563     */
564    STATE_NOT_PLAYING,
565    /**
566     * Playing.
567     *
568     * @syscap SystemCapability.Communication.Bluetooth.Core
569     * @since 10
570     */
571    STATE_PLAYING
572  }
573
574  /**
575   * Describes the codec type.
576   *
577   * @enum { number }
578   * @syscap SystemCapability.Communication.Bluetooth.Core
579   * @since 11
580   */
581  enum CodecType {
582    /**
583     * invalid codec type.
584     *
585     * @syscap SystemCapability.Communication.Bluetooth.Core
586     * @since 11
587     */
588    CODEC_TYPE_INVALID = -1,
589    /**
590     * SBC - Sub-band coding.
591     *
592     * @syscap SystemCapability.Communication.Bluetooth.Core
593     * @since 11
594     */
595    CODEC_TYPE_SBC = 0,
596    /**
597     * AAC -Advanced Audio Coding.
598     *
599     * @syscap SystemCapability.Communication.Bluetooth.Core
600     * @since 11
601     */
602    CODEC_TYPE_AAC = 1,
603    /**
604     * L2HC.
605     *
606     * @syscap SystemCapability.Communication.Bluetooth.Core
607     * @since 11
608     */
609    CODEC_TYPE_L2HC = 2,
610    /**
611     * L2HCST.
612     *
613     * @syscap SystemCapability.Communication.Bluetooth.Core
614     * @since 13
615     */
616    CODEC_TYPE_L2HCST = 3,
617    /**
618     * LDAC.
619     *
620     * @syscap SystemCapability.Communication.Bluetooth.Core
621     * @since 13
622     */
623    CODEC_TYPE_LDAC = 4
624  }
625
626  /**
627   * Describes the codec channel mode.
628   *
629   * @enum { number }
630   * @syscap SystemCapability.Communication.Bluetooth.Core
631   * @since 11
632   */
633  enum CodecChannelMode {
634    /**
635     * Codec channel mode none.
636     *
637     * @syscap SystemCapability.Communication.Bluetooth.Core
638     * @since 11
639     */
640    CODEC_CHANNEL_MODE_NONE = 0,
641    /**
642     * Codec channel mode MONO.
643     *
644     * @syscap SystemCapability.Communication.Bluetooth.Core
645     * @since 11
646     */
647    CODEC_CHANNEL_MODE_MONO = 1,
648    /**
649     * Codec channel mode STEREO.
650     *
651     * @syscap SystemCapability.Communication.Bluetooth.Core
652     * @since 11
653     */
654    CODEC_CHANNEL_MODE_STEREO = 2
655  }
656
657  /**
658   * Describes the codec bits per sample.
659   *
660   * @enum { number }
661   * @syscap SystemCapability.Communication.Bluetooth.Core
662   * @since 11
663   */
664  enum CodecBitsPerSample {
665    /**
666     * Codec bits per sample none.
667     *
668     * @syscap SystemCapability.Communication.Bluetooth.Core
669     * @since 11
670     */
671    CODEC_BITS_PER_SAMPLE_NONE = 0,
672    /**
673     * Codec 16 bits per sample.
674     *
675     * @syscap SystemCapability.Communication.Bluetooth.Core
676     * @since 11
677     */
678    CODEC_BITS_PER_SAMPLE_16 = 1,
679    /**
680     * Codec 24 bits per sample.
681     *
682     * @syscap SystemCapability.Communication.Bluetooth.Core
683     * @since 11
684     */
685    CODEC_BITS_PER_SAMPLE_24 = 2,
686    /**
687     * Codec 32 bits per sample.
688     *
689     * @syscap SystemCapability.Communication.Bluetooth.Core
690     * @since 11
691     */
692    CODEC_BITS_PER_SAMPLE_32 = 3
693  }
694
695  /**
696   * Describes the codec sample rate.
697   *
698   * @enum { number }
699   * @syscap SystemCapability.Communication.Bluetooth.Core
700   * @since 11
701   */
702  enum CodecSampleRate {
703    /**
704     * Codec sample rate none.
705     *
706     * @syscap SystemCapability.Communication.Bluetooth.Core
707     * @since 11
708     */
709    CODEC_SAMPLE_RATE_NONE = 0,
710    /**
711     * Codec sample rate 44.1k.
712     *
713     * @syscap SystemCapability.Communication.Bluetooth.Core
714     * @since 11
715     */
716    CODEC_SAMPLE_RATE_44100 = 1,
717    /**
718     * Codec sample rate 48k.
719     *
720     * @syscap SystemCapability.Communication.Bluetooth.Core
721     * @since 11
722     */
723    CODEC_SAMPLE_RATE_48000 = 2,
724    /**
725     * Codec sample rate 88.2k.
726     *
727     * @syscap SystemCapability.Communication.Bluetooth.Core
728     * @since 11
729     */
730    CODEC_SAMPLE_RATE_88200 = 3,
731    /**
732     * Codec sample rate 96k.
733     *
734     * @syscap SystemCapability.Communication.Bluetooth.Core
735     * @since 11
736     */
737    CODEC_SAMPLE_RATE_96000 = 4,
738    /**
739     * Codec sample rate 176.4k.
740     *
741     * @syscap SystemCapability.Communication.Bluetooth.Core
742     * @since 11
743     */
744    CODEC_SAMPLE_RATE_176400 = 5,
745    /**
746     * Codec sample rate 192k.
747     *
748     * @syscap SystemCapability.Communication.Bluetooth.Core
749     * @since 11
750     */
751    CODEC_SAMPLE_RATE_192000 = 6
752  }
753  /**
754     * Describes the codec bit rate.
755     *
756     * @enum { number }
757     * @syscap SystemCapability.Communication.Bluetooth.Core
758     * @since 19
759     */
760  enum CodecBitRate {
761    /**
762     * Codec bit rate 96k.
763     *
764     * @syscap SystemCapability.Communication.Bluetooth.Core
765     * @since 19
766     */
767    CODEC_BIT_RATE_96000 = 0,
768    /**
769     * Codec bit rate 128k.
770     *
771     * @syscap SystemCapability.Communication.Bluetooth.Core
772     * @since 19
773     */
774    CODEC_BIT_RATE_128000 = 1,
775    /**
776     * Codec bit rate 192k.
777     *
778     * @syscap SystemCapability.Communication.Bluetooth.Core
779     * @since 19
780     */
781    CODEC_BIT_RATE_192000 = 2,
782    /**
783     * Codec bit rate 256k.
784     *
785     * @syscap SystemCapability.Communication.Bluetooth.Core
786     * @since 19
787     */
788    CODEC_BIT_RATE_256000 = 3,
789    /**
790     * Codec bit rate 320k.
791     *
792     * @syscap SystemCapability.Communication.Bluetooth.Core
793     * @since 19
794     */
795    CODEC_BIT_RATE_320000 = 4,
796    /**
797     * Codec bit rate 480k.
798     *
799     * @syscap SystemCapability.Communication.Bluetooth.Core
800     * @since 19
801     */
802    CODEC_BIT_RATE_480000 = 5,
803    /**
804     * Codec bit rate 640k.
805     *
806     * @syscap SystemCapability.Communication.Bluetooth.Core
807     * @since 19
808     */
809    CODEC_BIT_RATE_640000 = 6,
810    /**
811     * Codec bit rate 960k.
812     *
813     * @syscap SystemCapability.Communication.Bluetooth.Core
814     * @since 19
815     */
816    CODEC_BIT_RATE_960000 = 7,
817    /**
818     * Codec bit rate adaptive bitrate streaming.
819     *
820     * @syscap SystemCapability.Communication.Bluetooth.Core
821     * @since 19
822     */
823    CODEC_BIT_RATE_ABR = 8
824    }
825  /**
826   * Describes the codec frame length.
827   *
828   * @enum { number }
829   * @syscap SystemCapability.Communication.Bluetooth.Core
830   * @since 19
831   */
832  enum CodecFrameLength {
833    /**
834     * Codec frame length 5ms.
835     *
836     * @syscap SystemCapability.Communication.Bluetooth.Core
837     * @since 19
838     */
839    CODEC_FRAME_LENGTH_5MS = 0,
840    /**
841     * Codec frame length 10ms.
842     *
843     * @syscap SystemCapability.Communication.Bluetooth.Core
844     * @since 19
845     */
846    CODEC_FRAME_LENGTH_10MS = 1
847  }
848}
849
850export default a2dp;