1 Star 0 Fork 3.9K

Feng Lin/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.multimedia.systemSoundManager.d.ts 38.75 KB
一键复制 编辑 原始数据 按行查看 历史
ancimoon 提交于 2024-09-04 16:25 +08:00 . add haptics management
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit AudioKit
*/
import type { AsyncCallback } from './@ohos.base';
import type Context from './application/Context';
import type BaseContext from './application/BaseContext';
import type { RingtonePlayer as _RingtonePlayer } from './multimedia/ringtonePlayer';
import type { RingtoneOptions as _RingtoneOptions } from './multimedia/ringtonePlayer';
import type { SystemTonePlayer as _SystemTonePlayer } from './multimedia/systemTonePlayer';
import type { SystemToneOptions as _SystemToneOptions } from './multimedia/systemTonePlayer';
/**
* Provides ringtone player interfaces.
*
* @namespace systemSoundManager
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
*/
declare namespace systemSoundManager {
/**
* Enum for ringtone type.
* @enum { number }
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
*/
enum RingtoneType {
/**
* Default type.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead systemSoundManager.RingtoneType#RINGTONE_TYPE_SIM_CARD_0
*/
RINGTONE_TYPE_DEFAULT = 0,
/**
* Ringtone type for sim card 0.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
RINGTONE_TYPE_SIM_CARD_0 = 0,
/**
* Multi-sim type.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead systemSoundManager.RingtoneType#RINGTONE_TYPE_SIM_CARD_1
*/
RINGTONE_TYPE_MULTISIM = 1,
/**
* Ringtone type for sim card 1.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
RINGTONE_TYPE_SIM_CARD_1 = 1,
}
/**
* Enum for system tone type.
* @enum { number }
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
enum SystemToneType {
/**
* System tone type for sim card 0.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
SYSTEM_TONE_TYPE_SIM_CARD_0 = 0,
/**
* System tone type for sim card 1.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
SYSTEM_TONE_TYPE_SIM_CARD_1 = 1,
/**
* System tone type notification.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
SYSTEM_TONE_TYPE_NOTIFICATION = 32,
}
/**
* Enum for tone customized type.
* @enum {number}
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
enum ToneCustomizedType {
/**
* Pre-installed tone type.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
PRE_INSTALLED = 0,
/**
* Customized tone type.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
CUSTOMIZED = 1,
}
/**
* Define the ringtone category.
* @constant
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
const TONE_CATEGORY_RINGTONE: number;
/**
* Define the text message tone category.
* @constant
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
const TONE_CATEGORY_TEXT_MESSAGE:number;
/**
* Define the notification tone category.
* @constant
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
const TONE_CATEGORY_NOTIFICATION:number;
/**
* Define the alarm tone category.
* @constant
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
const TONE_CATEGORY_ALARM:number;
/**
* Tone attributes.
* @typedef ToneAttrs
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
interface ToneAttrs {
/**
* Gets title of tone.
* @returns { string } title.
* @throws { BusinessError } 202 - Caller is not a system application.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getTitle(): string;
/**
* Sets title of tone.
* @param { string } title - Title of tone.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
setTitle(title: string): void;
/**
* Gets file name of tone.
* @returns { string } file name.
* @throws { BusinessError } 202 - Caller is not a system application.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getFileName(): string;
/**
* Sets file name of tone.
* @param { string } name - file name.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
setFileName(name: string): void;
/**
* Gets uri of tone.
* @returns { string } uri.
* @throws { BusinessError } 202 - Caller is not a system application.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getUri(): string;
/**
* Gets customized type of tone.
* @returns { ToneCustomizedType } Customized type of tone.
* @throws { BusinessError } 202 - Caller is not a system application.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getCustomizedType(): ToneCustomizedType;
/**
* Sets tone category.
* @param { number } category - tone category. This parameter can be one of {@link TONE_CATEGORY_RINGTONE},
* {@link TONE_CATEGORY_TEXT_MESSAGE}, {@link TONE_CATEGORY_NOTIFICATION}, {@link TONE_CATEGORY_ALARM}.
* In addition, this parameter can be result of OR logical operator of these constants.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
setCategory(category: number): void;
/**
* Gets tone category.
* @returns { number } Tone category. This value can be one of {@link TONE_CATEGORY_RINGTONE},
* {@link TONE_CATEGORY_TEXT_MESSAGE}, {@link TONE_CATEGORY_NOTIFICATION}, {@link TONE_CATEGORY_ALARM}.
* In addition, this value can be result of OR logical operator of these constants.
* @throws { BusinessError } 202 - Caller is not a system application.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getCategory(): number;
}
/**
* Array of tone attributes.
*
* @typedef {Array<ToneAttrs>} ToneAttrsArray
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
type ToneAttrsArray = Array<ToneAttrs>;
/**
* Create customized tone attributes.
* @returns { ToneAttrs } Tone attributes created.
* @throws { BusinessError } 202 - Caller is not a system application.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
function createCustomizedToneAttrs(): ToneAttrs;
/**
* Definition of haptics feature in tone scenario.
* @enum { number }
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
enum ToneHapticsFeature {
/**
* Standard haptics feature.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
STANDARD = 0,
/**
* Gentle haptics feature.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
GENTLE = 1,
}
/**
* Type definition of haptics in tone scenario.
*
* @typedef {RingtoneType | SystemToneType} ToneHapticsType
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
type ToneHapticsType = RingtoneType | SystemToneType;
/**
* Enum for haptics mode in tone scenario.
* @enum {number}
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
enum ToneHapticsMode {
/**
* None haptics mode.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
NONE = 0,
/**
* Haptics is synchronized with tone.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
SYNC = 1,
/**
* Haptics is out of synchronize with tone.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
NON_SYNC = 2,
}
/**
* Haptics settings in tone scenario.
* @typedef ToneHapticsSettings
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
interface ToneHapticsSettings {
/**
* Haptics mode.
* @type { ToneHapticsMode }
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
mode: ToneHapticsMode;
/**
* Haptics uri. Users can set/get this parameter when {@link ToneHapticsSettings#mode} is
* {@link ToneHapticsMode#NON_SYC}. In other cases, this uri is useless and should be ignored.
* @type { ?string }
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
hapticsUri?: string;
}
/**
* Haptics attributes in tone scenario.
* @typedef ToneHapticsAttrs
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
interface ToneHapticsAttrs {
/**
* Get haptics uri.
* @returns { string } Haptics uri.
* @throws { BusinessError } 202 - Caller is not a system application.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
getUri(): string;
/**
* Get title of haptics.
* @returns { string } Haptics title.
* @throws { BusinessError } 202 - Caller is not a system application.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
getTitle(): string;
/**
* Get file name of haptics.
* @returns { string } Haptics title.
* @throws { BusinessError } 202 - Caller is not a system application.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
getFileName(): string;
}
/**
* Type definition of tone haptics array.
*
* @typedef { Array<ToneHapticsAttrs> } ToneHapticsAttrsArray
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
type ToneHapticsAttrsArray = Array<ToneHapticsAttrs>;
/**
* Gets system sound manager for all type sound.
* @returns { SystemSoundManager } SystemSoundManager instance.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
*/
function getSystemSoundManager(): SystemSoundManager;
/**
* System sound manager object.
* @typedef SystemSoundManager
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
*/
interface SystemSoundManager {
/**
* Sets the ringtone uri to system.
* @param { Context } context - Current application context.
* @param { string } uri - Ringtone uri to set.
* @param { RingtoneType } type - Ringtone type to set.
* @param { AsyncCallback<void> } callback - Callback used to return the set uri result.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead systemSoundManager.SystemSoundManager#setRingtoneUri
*/
setSystemRingtoneUri(context: Context, uri: string, type: RingtoneType, callback: AsyncCallback<void>): void;
/**
* Sets the ringtone uri to system.
* @param { Context } context - Current application context.
* @param { string } uri - Ringtone uri to set.
* @param { RingtoneType } type - Ringtone type to set.
* @returns { Promise<void> } Promise used to return the set uri result.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead systemSoundManager.SystemSoundManager#setRingtoneUri
*/
setSystemRingtoneUri(context: Context, uri: string, type: RingtoneType): Promise<void>;
/**
* Sets the ringtone uri to system.
* @param { BaseContext } context - Current application context.
* @param { string } uri - Ringtone uri to set.
* @param { RingtoneType } type - Ringtone type to set.
* @returns { Promise<void> } Promise used to return the set uri result.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
setRingtoneUri(context: BaseContext, uri: string, type: RingtoneType): Promise<void>;
/**
* Gets the ringtone uri.
* @param { Context } context - Current application context.
* @param { RingtoneType } type - Ringtone type to get.
* @param { AsyncCallback<string> } callback - Callback used to return the ringtone uri maintained in system.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead systemSoundManager.SystemSoundManager#getRingtoneUri
*/
getSystemRingtoneUri(context: Context, type: RingtoneType, callback: AsyncCallback<string>): void;
/**
* Gets the ringtone uri.
* @param { Context } context - Current application context.
* @param { RingtoneType } type - Ringtone type to get.
* @returns { Promise<string> } Promise used to return the ringtone uri maintained in system.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead systemSoundManager.SystemSoundManager#getRingtoneUri
*/
getSystemRingtoneUri(context: Context, type: RingtoneType): Promise<string>;
/**
* Gets the ringtone uri.
* @param { BaseContext } context - Current application context.
* @param { RingtoneType } type - Ringtone type to get.
* @returns { Promise<string> } Promise used to return the ringtone uri maintained in system.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
getRingtoneUri(context: BaseContext, type: RingtoneType): Promise<string>;
/**
* Gets attributes of the default ringtone.
* @param { BaseContext } context - Current application context.
* @param { RingtoneType } type - Ringtone type to get.
* @returns { Promise<ToneAttrs> } Promise used to return attributes of the default ringtone.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getDefaultRingtoneAttrs(context: BaseContext, type: RingtoneType): Promise<ToneAttrs>;
/**
* Gets attribute list of ringtones.
* @param { BaseContext } context - Current application context.
* @param { RingtoneType } type - Ringtone type to get.
* @returns { Promise<ToneAttrsArray> } Promise used to return attribute list of ringtone.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getRingtoneAttrList(context: BaseContext, type: RingtoneType): Promise<ToneAttrsArray>;
/**
* Gets the ringtone player.
* @param { Context } context - Current application context.
* @param { RingtoneType } type - Ringtone type to get.
* @param { AsyncCallback<RingtonePlayer> } callback - Callback used to return a ringtone player instance.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead systemSoundManager.SystemSoundManager#getRingtonePlayer
*/
getSystemRingtonePlayer(context: Context, type: RingtoneType, callback: AsyncCallback<RingtonePlayer>): void;
/**
* Gets the ringtone player.
* @param { Context } context - Current application context.
* @param { RingtoneType } type - Ringtone type to get.
* @returns { Promise<RingtonePlayer> } Promise used to return a ringtone player instance.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
* @deprecated since 11
* @useinstead systemSoundManager.SystemSoundManager#getRingtonePlayer
*/
getSystemRingtonePlayer(context: Context, type: RingtoneType): Promise<RingtonePlayer>;
/**
* Gets the ringtone player.
* @param { BaseContext } context - Current application context.
* @param { RingtoneType } type - Ringtone type to get.
* @returns { Promise<RingtonePlayer> } Promise used to return a ringtone player instance.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
getRingtonePlayer(context: BaseContext, type: RingtoneType): Promise<RingtonePlayer>;
/**
* Sets the system tone uri to system.
* @param { BaseContext } context - Current application context.
* @param { string } uri - Ringtone uri to set.
* @param { SystemToneType } type - System tone type to set.
* @returns { Promise<void> } Promise used to return the result of set system tone uri.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
setSystemToneUri(context: BaseContext, uri: string, type: SystemToneType): Promise<void>;
/**
* Gets the system tone uri.
* @param { BaseContext } context - Current application context.
* @param { SystemToneType } type - System tone type to get.
* @returns { Promise<string> } Promise used to return the system tone maintained in system.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
getSystemToneUri(context: BaseContext, type: SystemToneType): Promise<string>;
/**
* Gets attributes of the default system tone.
*
* @param { BaseContext } context - Current application context.
* @param { SystemToneType } type - system tone type to get.
* @returns { Promise<ToneAttrs> } Promise used to return attributes of the default system tone.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getDefaultSystemToneAttrs(context: BaseContext, type: SystemToneType): Promise<ToneAttrs>;
/**
* Gets attribute list of alarm tones.
* @param { BaseContext } context - Current application context.
* @param { SystemToneType } type - System tone type to get.
* @returns { Promise<ToneAttrsArray> } Promise used to return attribute list of system tone.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getSystemToneAttrList(context: BaseContext, type: SystemToneType): Promise<ToneAttrsArray>;
/**
* Gets the system tone player.
* @param { BaseContext } context - Current application context.
* @param { SystemToneType } type - System tone type to get.
* @returns { Promise<SystemTonePlayer> } Promise used to return the SystemTonePlayer.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
getSystemTonePlayer(context: BaseContext, type: SystemToneType): Promise<SystemTonePlayer>;
/**
* Gets attributes of the default alarm tone.
*
* @param { BaseContext } context - Current application context.
* @returns { Promise<ToneAttrs> } Promise used to return attributes of the default alarm tone.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getDefaultAlarmToneAttrs(context: BaseContext): Promise<ToneAttrs>;
/**
* Sets uri of the current alarm tone.
*
* @param { BaseContext } context - Current application context.
* @param { string } uri - Alarm tone uri.
* @returns { Promise<void> } Promise used to return result of set alarm tone.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @throws { BusinessError } 20700001 - Tone type mismatch, e.g. tone of input uri is not an alarm tone.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
setAlarmToneUri(context: BaseContext, uri: string): Promise<void>;
/**
* Gets uri of the current alarm tone.
*
* @param { BaseContext } context - Current application context.
* @returns { Promise<string> } Promise used to return uri of current alarm tone.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getAlarmToneUri(context: BaseContext): Promise<string>;
/**
* Gets attribute list of alarm tones.
* @param { BaseContext } context - Current application context.
* @returns { Promise<ToneAttrsArray> } Promise used to return attribute list of system tone.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
getAlarmToneAttrList(context: BaseContext): Promise<ToneAttrsArray>;
/**
* Open alarm tone file.
* @param { BaseContext } context - Current application context.
* @param { string } uri - Uri of alarm tone to open.
* @returns { Promise<number> } Promise used to return fd.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @throws { BusinessError } 20700001 - Tone type mismatch, e.g. tone of uri is notification instead of alarm.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
openAlarmTone(context: BaseContext, uri: string): Promise<number>
/**
* Close fd.
* @param { number } fd - File descriptor to close.
* @returns { Promise<void> } Promise used to return the result of close fd.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
close(fd: number): Promise<void>;
/**
* Add customized tone into ringtone library.
* @permission ohos.permission.WRITE_RINGTONE
* @param { BaseContext } context - Current application context.
* @param { ToneAttrs } toneAttr - Tone attributes created by {@link createCustomizedToneAttrs}.
* @param { string } externalUri - Tone uri in external storage.
* @returns { Promise<string> } Tone uri after adding into ringtone library.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400102 - Operation is not allowed, e.g. ringtone to add is not customized.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
addCustomizedTone(context: BaseContext, toneAttr: ToneAttrs, externalUri: string): Promise<string>;
/**
* Add customized tone into ringtone library.
* @permission ohos.permission.WRITE_RINGTONE
* @param { BaseContext } context - Current application context.
* @param { ToneAttrs } toneAttr - Tone attributes created by {@link createCustomizedToneAttrs}.
* @param { number } fd - File descriptor.
* @param { number } [offset] - The offset in the file where the data to be read, in bytes. By default, the offset
* is zero.
* @param { number } [length] - The length in bytes of the data to be read. By default, the length is the rest of
* bytes in the file from the offset.
* @returns { Promise<string> } Tone uri after adding into ringtone library.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400102 - Operation is not allowed, e.g. ringtone to add is not customized.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
addCustomizedTone(context: BaseContext, toneAttr: ToneAttrs, fd: number, offset?: number, length?: number)
: Promise<string>;
/**
* Remove customized tone in ringtone library.
* @permission ohos.permission.WRITE_RINGTONE
* @param { BaseContext } context - Current application context.
* @param { string } uri - Tone uri.
* @returns { Promise<void> } Promise used to return removing result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400102 - Operation is not allowed, e.g. ringtone of this uri is not customized.
* @throws { BusinessError } 5400103 - I/O error.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 12
*/
removeCustomizedTone(context: BaseContext, uri:string): Promise<void>;
/**
* Get haptics settings.
* @param { BaseContext } context - Current application context.
* @param { ToneHapticsType } type - Tone haptics type.
* @returns { Promise<ToneHapticsSettings> } Promise used to return results of this call.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @throws { BusinessError } 20700003 - Unsupported operation.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
getToneHapticsSettings(context: BaseContext, type: ToneHapticsType): Promise<ToneHapticsSettings>;
/**
* Set haptics settings.
* @param { BaseContext } context - Current application context.
* @param { ToneHapticsType } type - Tone haptics type.
* @param { ToneHapticsSettings } settings - Tone haptics settings.
* @returns { Promise<void> } Promise used to return results of this call.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400102 - Operation not allowed. For example, the input URI is not valid.
* @throws { BusinessError } 5400103 - I/O error.
* @throws { BusinessError } 20700003 - Unsupported operation.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
setToneHapticsSettings(context: BaseContext, type: ToneHapticsType, settings: ToneHapticsSettings): Promise<void>;
/**
* Get haptics list.
* @param { BaseContext } context - Current application context.
* @param { boolean } isSynced - The queried haptics is synchronized with tone or not.
* @returns { Promise<ToneHapticsAttrsArray> } Promise used to return ToneHapticsAttrsArray.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400103 - I/O error.
* @throws { BusinessError } 20700003 - Unsupported operation.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
getToneHapticsList(context: BaseContext, isSynced: boolean): Promise<ToneHapticsAttrsArray>;
/**
* Get attributes of haptics which is synchronized with one tone. If no haptics is found, then the attributes in
* the returned ToneHapticsAttrs is empty.
* @param { BaseContext } context - Current application context.
* @param { string } toneUri - Uri of tone to query.
* @returns { Promise<ToneHapticsAttrs> } Promise used to return ToneHapticsAttrs.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400102 - Operation not allowed. For example, the input URI is not used for tones.
* @throws { BusinessError } 5400103 - I/O error.
* @throws { BusinessError } 20700003 - Unsupported operation.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
getHapticsAttrsSyncedWithTone(context: BaseContext, toneUri: string): Promise<ToneHapticsAttrs>;
/**
* Open haptics.
* @param { BaseContext } context - Current application context.
* @param { string } hapticsUri - Uri of haptics to open.
* @returns { Promise<number> } Promise used to return fd.
* @throws { BusinessError } 202 - Caller is not a system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* 1.Mandatory parameters are left unspecified;
* 2.Incorrect parameter types.
* @throws { BusinessError } 5400102 - Operation not allowed. For example, the input URI is not one for haptics.
* @throws { BusinessError } 5400103 - I/O error.
* @throws { BusinessError } 20700003 - Unsupported operation.
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 13
*/
openToneHaptics(context: BaseContext, hapticsUri: string): Promise<number>;
}
/**
* Ringtone player object.
* @typedef { _RingtonePlayer } RingtonePlayer
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
*/
type RingtonePlayer = _RingtonePlayer;
/**
* SystemTone player object.
* @typedef { _SystemTonePlayer } SystemTonePlayer
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
type SystemTonePlayer = _SystemTonePlayer;
/**
* Interface for ringtone options.
* @typedef { _RingtoneOptions } RingtoneOptions
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 10
*/
type RingtoneOptions = _RingtoneOptions;
/**
* System tone options.
* @typedef { _SystemToneOptions } SystemToneOptions
* @syscap SystemCapability.Multimedia.SystemSound.Core
* @systemapi
* @since 11
*/
type SystemToneOptions = _SystemToneOptions;
}
export default systemSoundManager;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lffl8796/interface_sdk-js.git
git@gitee.com:lffl8796/interface_sdk-js.git
lffl8796
interface_sdk-js
interface_sdk-js
master

搜索帮助