161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit AudioKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type { AsyncCallback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport type Context from './application/Context'; 2361847f8eSopenharmony_ciimport type BaseContext from './application/BaseContext'; 2461847f8eSopenharmony_ciimport type { RingtonePlayer as _RingtonePlayer } from './multimedia/ringtonePlayer'; 2561847f8eSopenharmony_ciimport type { RingtoneOptions as _RingtoneOptions } from './multimedia/ringtonePlayer'; 2661847f8eSopenharmony_ciimport type { SystemTonePlayer as _SystemTonePlayer } from './multimedia/systemTonePlayer'; 2761847f8eSopenharmony_ciimport type { SystemToneOptions as _SystemToneOptions } from './multimedia/systemTonePlayer'; 2861847f8eSopenharmony_ci 2961847f8eSopenharmony_ci/** 3061847f8eSopenharmony_ci * Provides ringtone player interfaces. 3161847f8eSopenharmony_ci * 3261847f8eSopenharmony_ci * @namespace systemSoundManager 3361847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 3461847f8eSopenharmony_ci * @systemapi 3561847f8eSopenharmony_ci * @since 10 3661847f8eSopenharmony_ci */ 3761847f8eSopenharmony_cideclare namespace systemSoundManager { 3861847f8eSopenharmony_ci /** 3961847f8eSopenharmony_ci * Enum for ringtone type. 4061847f8eSopenharmony_ci * @enum { number } 4161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 4261847f8eSopenharmony_ci * @systemapi 4361847f8eSopenharmony_ci * @since 10 4461847f8eSopenharmony_ci */ 4561847f8eSopenharmony_ci enum RingtoneType { 4661847f8eSopenharmony_ci /** 4761847f8eSopenharmony_ci * Default type. 4861847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 4961847f8eSopenharmony_ci * @systemapi 5061847f8eSopenharmony_ci * @since 10 5161847f8eSopenharmony_ci * @deprecated since 11 5261847f8eSopenharmony_ci * @useinstead systemSoundManager.RingtoneType#RINGTONE_TYPE_SIM_CARD_0 5361847f8eSopenharmony_ci */ 5461847f8eSopenharmony_ci RINGTONE_TYPE_DEFAULT = 0, 5561847f8eSopenharmony_ci 5661847f8eSopenharmony_ci /** 5761847f8eSopenharmony_ci * Ringtone type for sim card 0. 5861847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 5961847f8eSopenharmony_ci * @systemapi 6061847f8eSopenharmony_ci * @since 11 6161847f8eSopenharmony_ci */ 6261847f8eSopenharmony_ci RINGTONE_TYPE_SIM_CARD_0 = 0, 6361847f8eSopenharmony_ci 6461847f8eSopenharmony_ci /** 6561847f8eSopenharmony_ci * Multi-sim type. 6661847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 6761847f8eSopenharmony_ci * @systemapi 6861847f8eSopenharmony_ci * @since 10 6961847f8eSopenharmony_ci * @deprecated since 11 7061847f8eSopenharmony_ci * @useinstead systemSoundManager.RingtoneType#RINGTONE_TYPE_SIM_CARD_1 7161847f8eSopenharmony_ci */ 7261847f8eSopenharmony_ci RINGTONE_TYPE_MULTISIM = 1, 7361847f8eSopenharmony_ci 7461847f8eSopenharmony_ci /** 7561847f8eSopenharmony_ci * Ringtone type for sim card 1. 7661847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 7761847f8eSopenharmony_ci * @systemapi 7861847f8eSopenharmony_ci * @since 11 7961847f8eSopenharmony_ci */ 8061847f8eSopenharmony_ci RINGTONE_TYPE_SIM_CARD_1 = 1, 8161847f8eSopenharmony_ci } 8261847f8eSopenharmony_ci 8361847f8eSopenharmony_ci /** 8461847f8eSopenharmony_ci * Enum for system tone type. 8561847f8eSopenharmony_ci * @enum { number } 8661847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 8761847f8eSopenharmony_ci * @systemapi 8861847f8eSopenharmony_ci * @since 11 8961847f8eSopenharmony_ci */ 9061847f8eSopenharmony_ci enum SystemToneType { 9161847f8eSopenharmony_ci /** 9261847f8eSopenharmony_ci * System tone type for sim card 0. 9361847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 9461847f8eSopenharmony_ci * @systemapi 9561847f8eSopenharmony_ci * @since 11 9661847f8eSopenharmony_ci */ 9761847f8eSopenharmony_ci SYSTEM_TONE_TYPE_SIM_CARD_0 = 0, 9861847f8eSopenharmony_ci 9961847f8eSopenharmony_ci /** 10061847f8eSopenharmony_ci * System tone type for sim card 1. 10161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 10261847f8eSopenharmony_ci * @systemapi 10361847f8eSopenharmony_ci * @since 11 10461847f8eSopenharmony_ci */ 10561847f8eSopenharmony_ci SYSTEM_TONE_TYPE_SIM_CARD_1 = 1, 10661847f8eSopenharmony_ci 10761847f8eSopenharmony_ci /** 10861847f8eSopenharmony_ci * System tone type notification. 10961847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 11061847f8eSopenharmony_ci * @systemapi 11161847f8eSopenharmony_ci * @since 11 11261847f8eSopenharmony_ci */ 11361847f8eSopenharmony_ci SYSTEM_TONE_TYPE_NOTIFICATION = 32, 11461847f8eSopenharmony_ci } 11561847f8eSopenharmony_ci 11661847f8eSopenharmony_ci /** 11761847f8eSopenharmony_ci * Enum for tone customized type. 11861847f8eSopenharmony_ci * @enum {number} 11961847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 12061847f8eSopenharmony_ci * @systemapi 12161847f8eSopenharmony_ci * @since 12 12261847f8eSopenharmony_ci */ 12361847f8eSopenharmony_ci enum ToneCustomizedType { 12461847f8eSopenharmony_ci /** 12561847f8eSopenharmony_ci * Pre-installed tone type. 12661847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 12761847f8eSopenharmony_ci * @systemapi 12861847f8eSopenharmony_ci * @since 12 12961847f8eSopenharmony_ci */ 13061847f8eSopenharmony_ci PRE_INSTALLED = 0, 13161847f8eSopenharmony_ci /** 13261847f8eSopenharmony_ci * Customized tone type. 13361847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 13461847f8eSopenharmony_ci * @systemapi 13561847f8eSopenharmony_ci * @since 12 13661847f8eSopenharmony_ci */ 13761847f8eSopenharmony_ci CUSTOMIZED = 1, 13861847f8eSopenharmony_ci } 13961847f8eSopenharmony_ci 14061847f8eSopenharmony_ci /** 14161847f8eSopenharmony_ci * Define the ringtone category. 14261847f8eSopenharmony_ci * @constant 14361847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 14461847f8eSopenharmony_ci * @systemapi 14561847f8eSopenharmony_ci * @since 12 14661847f8eSopenharmony_ci */ 14761847f8eSopenharmony_ci const TONE_CATEGORY_RINGTONE: number; 14861847f8eSopenharmony_ci 14961847f8eSopenharmony_ci /** 15061847f8eSopenharmony_ci * Define the text message tone category. 15161847f8eSopenharmony_ci * @constant 15261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 15361847f8eSopenharmony_ci * @systemapi 15461847f8eSopenharmony_ci * @since 12 15561847f8eSopenharmony_ci */ 15661847f8eSopenharmony_ci const TONE_CATEGORY_TEXT_MESSAGE:number; 15761847f8eSopenharmony_ci 15861847f8eSopenharmony_ci /** 15961847f8eSopenharmony_ci * Define the notification tone category. 16061847f8eSopenharmony_ci * @constant 16161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 16261847f8eSopenharmony_ci * @systemapi 16361847f8eSopenharmony_ci * @since 12 16461847f8eSopenharmony_ci */ 16561847f8eSopenharmony_ci const TONE_CATEGORY_NOTIFICATION:number; 16661847f8eSopenharmony_ci 16761847f8eSopenharmony_ci /** 16861847f8eSopenharmony_ci * Define the alarm tone category. 16961847f8eSopenharmony_ci * @constant 17061847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 17161847f8eSopenharmony_ci * @systemapi 17261847f8eSopenharmony_ci * @since 12 17361847f8eSopenharmony_ci */ 17461847f8eSopenharmony_ci const TONE_CATEGORY_ALARM:number; 17561847f8eSopenharmony_ci 17661847f8eSopenharmony_ci /** 17761847f8eSopenharmony_ci * Tone attributes. 17861847f8eSopenharmony_ci * @typedef ToneAttrs 17961847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 18061847f8eSopenharmony_ci * @systemapi 18161847f8eSopenharmony_ci * @since 12 18261847f8eSopenharmony_ci */ 18361847f8eSopenharmony_ci interface ToneAttrs { 18461847f8eSopenharmony_ci /** 18561847f8eSopenharmony_ci * Gets title of tone. 18661847f8eSopenharmony_ci * @returns { string } title. 18761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 18861847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 18961847f8eSopenharmony_ci * @systemapi 19061847f8eSopenharmony_ci * @since 12 19161847f8eSopenharmony_ci */ 19261847f8eSopenharmony_ci getTitle(): string; 19361847f8eSopenharmony_ci 19461847f8eSopenharmony_ci /** 19561847f8eSopenharmony_ci * Sets title of tone. 19661847f8eSopenharmony_ci * @param { string } title - Title of tone. 19761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 19861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 19961847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 20061847f8eSopenharmony_ci * 2.Incorrect parameter types. 20161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 20261847f8eSopenharmony_ci * @systemapi 20361847f8eSopenharmony_ci * @since 12 20461847f8eSopenharmony_ci */ 20561847f8eSopenharmony_ci setTitle(title: string): void; 20661847f8eSopenharmony_ci 20761847f8eSopenharmony_ci /** 20861847f8eSopenharmony_ci * Gets file name of tone. 20961847f8eSopenharmony_ci * @returns { string } file name. 21061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 21161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 21261847f8eSopenharmony_ci * @systemapi 21361847f8eSopenharmony_ci * @since 12 21461847f8eSopenharmony_ci */ 21561847f8eSopenharmony_ci getFileName(): string; 21661847f8eSopenharmony_ci 21761847f8eSopenharmony_ci /** 21861847f8eSopenharmony_ci * Sets file name of tone. 21961847f8eSopenharmony_ci * @param { string } name - file name. 22061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 22161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 22261847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 22361847f8eSopenharmony_ci * 2.Incorrect parameter types. 22461847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 22561847f8eSopenharmony_ci * @systemapi 22661847f8eSopenharmony_ci * @since 12 22761847f8eSopenharmony_ci */ 22861847f8eSopenharmony_ci setFileName(name: string): void; 22961847f8eSopenharmony_ci 23061847f8eSopenharmony_ci /** 23161847f8eSopenharmony_ci * Gets uri of tone. 23261847f8eSopenharmony_ci * @returns { string } uri. 23361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 23461847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 23561847f8eSopenharmony_ci * @systemapi 23661847f8eSopenharmony_ci * @since 12 23761847f8eSopenharmony_ci */ 23861847f8eSopenharmony_ci getUri(): string; 23961847f8eSopenharmony_ci 24061847f8eSopenharmony_ci /** 24161847f8eSopenharmony_ci * Gets customized type of tone. 24261847f8eSopenharmony_ci * @returns { ToneCustomizedType } Customized type of tone. 24361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 24461847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 24561847f8eSopenharmony_ci * @systemapi 24661847f8eSopenharmony_ci * @since 12 24761847f8eSopenharmony_ci */ 24861847f8eSopenharmony_ci getCustomizedType(): ToneCustomizedType; 24961847f8eSopenharmony_ci 25061847f8eSopenharmony_ci /** 25161847f8eSopenharmony_ci * Sets tone category. 25261847f8eSopenharmony_ci * @param { number } category - tone category. This parameter can be one of {@link TONE_CATEGORY_RINGTONE}, 25361847f8eSopenharmony_ci * {@link TONE_CATEGORY_TEXT_MESSAGE}, {@link TONE_CATEGORY_NOTIFICATION}, {@link TONE_CATEGORY_ALARM}. 25461847f8eSopenharmony_ci * In addition, this parameter can be result of OR logical operator of these constants. 25561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 25661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 25761847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 25861847f8eSopenharmony_ci * 2.Incorrect parameter types. 25961847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 26061847f8eSopenharmony_ci * @systemapi 26161847f8eSopenharmony_ci * @since 12 26261847f8eSopenharmony_ci */ 26361847f8eSopenharmony_ci setCategory(category: number): void; 26461847f8eSopenharmony_ci 26561847f8eSopenharmony_ci /** 26661847f8eSopenharmony_ci * Gets tone category. 26761847f8eSopenharmony_ci * @returns { number } Tone category. This value can be one of {@link TONE_CATEGORY_RINGTONE}, 26861847f8eSopenharmony_ci * {@link TONE_CATEGORY_TEXT_MESSAGE}, {@link TONE_CATEGORY_NOTIFICATION}, {@link TONE_CATEGORY_ALARM}. 26961847f8eSopenharmony_ci * In addition, this value can be result of OR logical operator of these constants. 27061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 27161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 27261847f8eSopenharmony_ci * @systemapi 27361847f8eSopenharmony_ci * @since 12 27461847f8eSopenharmony_ci */ 27561847f8eSopenharmony_ci getCategory(): number; 27661847f8eSopenharmony_ci } 27761847f8eSopenharmony_ci 27861847f8eSopenharmony_ci /** 27961847f8eSopenharmony_ci * Array of tone attributes. 28061847f8eSopenharmony_ci * 28161847f8eSopenharmony_ci * @typedef {Array<ToneAttrs>} ToneAttrsArray 28261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 28361847f8eSopenharmony_ci * @systemapi 28461847f8eSopenharmony_ci * @since 12 28561847f8eSopenharmony_ci */ 28661847f8eSopenharmony_ci type ToneAttrsArray = Array<ToneAttrs>; 28761847f8eSopenharmony_ci 28861847f8eSopenharmony_ci /** 28961847f8eSopenharmony_ci * Create customized tone attributes. 29061847f8eSopenharmony_ci * @returns { ToneAttrs } Tone attributes created. 29161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 29261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 29361847f8eSopenharmony_ci * @systemapi 29461847f8eSopenharmony_ci * @since 12 29561847f8eSopenharmony_ci */ 29661847f8eSopenharmony_ci function createCustomizedToneAttrs(): ToneAttrs; 29761847f8eSopenharmony_ci 29861847f8eSopenharmony_ci /** 29961847f8eSopenharmony_ci * Definition of haptics feature in tone scenario. 30061847f8eSopenharmony_ci * @enum { number } 30161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 30261847f8eSopenharmony_ci * @systemapi 30361847f8eSopenharmony_ci * @since 13 30461847f8eSopenharmony_ci */ 30561847f8eSopenharmony_ci enum ToneHapticsFeature { 30661847f8eSopenharmony_ci /** 30761847f8eSopenharmony_ci * Standard haptics feature. 30861847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 30961847f8eSopenharmony_ci * @systemapi 31061847f8eSopenharmony_ci * @since 13 31161847f8eSopenharmony_ci */ 31261847f8eSopenharmony_ci STANDARD = 0, 31361847f8eSopenharmony_ci /** 31461847f8eSopenharmony_ci * Gentle haptics feature. 31561847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 31661847f8eSopenharmony_ci * @systemapi 31761847f8eSopenharmony_ci * @since 13 31861847f8eSopenharmony_ci */ 31961847f8eSopenharmony_ci GENTLE = 1, 32061847f8eSopenharmony_ci } 32161847f8eSopenharmony_ci /** 32261847f8eSopenharmony_ci * Type definition of haptics in tone scenario. 32361847f8eSopenharmony_ci * 32461847f8eSopenharmony_ci * @typedef {RingtoneType | SystemToneType} ToneHapticsType 32561847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 32661847f8eSopenharmony_ci * @systemapi 32761847f8eSopenharmony_ci * @since 13 32861847f8eSopenharmony_ci */ 32961847f8eSopenharmony_ci type ToneHapticsType = RingtoneType | SystemToneType; 33061847f8eSopenharmony_ci 33161847f8eSopenharmony_ci /** 33261847f8eSopenharmony_ci * Enum for haptics mode in tone scenario. 33361847f8eSopenharmony_ci * @enum {number} 33461847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 33561847f8eSopenharmony_ci * @systemapi 33661847f8eSopenharmony_ci * @since 13 33761847f8eSopenharmony_ci */ 33861847f8eSopenharmony_ci enum ToneHapticsMode { 33961847f8eSopenharmony_ci /** 34061847f8eSopenharmony_ci * None haptics mode. 34161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 34261847f8eSopenharmony_ci * @systemapi 34361847f8eSopenharmony_ci * @since 13 34461847f8eSopenharmony_ci */ 34561847f8eSopenharmony_ci NONE = 0, 34661847f8eSopenharmony_ci /** 34761847f8eSopenharmony_ci * Haptics is synchronized with tone. 34861847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 34961847f8eSopenharmony_ci * @systemapi 35061847f8eSopenharmony_ci * @since 13 35161847f8eSopenharmony_ci */ 35261847f8eSopenharmony_ci SYNC = 1, 35361847f8eSopenharmony_ci 35461847f8eSopenharmony_ci /** 35561847f8eSopenharmony_ci * Haptics is out of synchronize with tone. 35661847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 35761847f8eSopenharmony_ci * @systemapi 35861847f8eSopenharmony_ci * @since 13 35961847f8eSopenharmony_ci */ 36061847f8eSopenharmony_ci NON_SYNC = 2, 36161847f8eSopenharmony_ci } 36261847f8eSopenharmony_ci /** 36361847f8eSopenharmony_ci * Haptics settings in tone scenario. 36461847f8eSopenharmony_ci * @typedef ToneHapticsSettings 36561847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 36661847f8eSopenharmony_ci * @systemapi 36761847f8eSopenharmony_ci * @since 13 36861847f8eSopenharmony_ci */ 36961847f8eSopenharmony_ci interface ToneHapticsSettings { 37061847f8eSopenharmony_ci /** 37161847f8eSopenharmony_ci * Haptics mode. 37261847f8eSopenharmony_ci * @type { ToneHapticsMode } 37361847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 37461847f8eSopenharmony_ci * @systemapi 37561847f8eSopenharmony_ci * @since 13 37661847f8eSopenharmony_ci */ 37761847f8eSopenharmony_ci mode: ToneHapticsMode; 37861847f8eSopenharmony_ci /** 37961847f8eSopenharmony_ci * Haptics uri. Users can set/get this parameter when {@link ToneHapticsSettings#mode} is 38061847f8eSopenharmony_ci * {@link ToneHapticsMode#NON_SYC}. In other cases, this uri is useless and should be ignored. 38161847f8eSopenharmony_ci * @type { ?string } 38261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 38361847f8eSopenharmony_ci * @systemapi 38461847f8eSopenharmony_ci * @since 13 38561847f8eSopenharmony_ci */ 38661847f8eSopenharmony_ci hapticsUri?: string; 38761847f8eSopenharmony_ci } 38861847f8eSopenharmony_ci 38961847f8eSopenharmony_ci /** 39061847f8eSopenharmony_ci * Haptics attributes in tone scenario. 39161847f8eSopenharmony_ci * @typedef ToneHapticsAttrs 39261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 39361847f8eSopenharmony_ci * @systemapi 39461847f8eSopenharmony_ci * @since 13 39561847f8eSopenharmony_ci */ 39661847f8eSopenharmony_ci interface ToneHapticsAttrs { 39761847f8eSopenharmony_ci /** 39861847f8eSopenharmony_ci * Get haptics uri. 39961847f8eSopenharmony_ci * @returns { string } Haptics uri. 40061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 40161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 40261847f8eSopenharmony_ci * @systemapi 40361847f8eSopenharmony_ci * @since 13 40461847f8eSopenharmony_ci */ 40561847f8eSopenharmony_ci getUri(): string; 40661847f8eSopenharmony_ci 40761847f8eSopenharmony_ci /** 40861847f8eSopenharmony_ci * Get title of haptics. 40961847f8eSopenharmony_ci * @returns { string } Haptics title. 41061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 41161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 41261847f8eSopenharmony_ci * @systemapi 41361847f8eSopenharmony_ci * @since 13 41461847f8eSopenharmony_ci */ 41561847f8eSopenharmony_ci getTitle(): string; 41661847f8eSopenharmony_ci 41761847f8eSopenharmony_ci /** 41861847f8eSopenharmony_ci * Get file name of haptics. 41961847f8eSopenharmony_ci * @returns { string } Haptics title. 42061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 42161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 42261847f8eSopenharmony_ci * @systemapi 42361847f8eSopenharmony_ci * @since 13 42461847f8eSopenharmony_ci */ 42561847f8eSopenharmony_ci getFileName(): string; 42661847f8eSopenharmony_ci } 42761847f8eSopenharmony_ci 42861847f8eSopenharmony_ci /** 42961847f8eSopenharmony_ci * Type definition of tone haptics array. 43061847f8eSopenharmony_ci * 43161847f8eSopenharmony_ci * @typedef { Array<ToneHapticsAttrs> } ToneHapticsAttrsArray 43261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 43361847f8eSopenharmony_ci * @systemapi 43461847f8eSopenharmony_ci * @since 13 43561847f8eSopenharmony_ci */ 43661847f8eSopenharmony_ci type ToneHapticsAttrsArray = Array<ToneHapticsAttrs>; 43761847f8eSopenharmony_ci 43861847f8eSopenharmony_ci 43961847f8eSopenharmony_ci /** 44061847f8eSopenharmony_ci * Gets system sound manager for all type sound. 44161847f8eSopenharmony_ci * @returns { SystemSoundManager } SystemSoundManager instance. 44261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 44361847f8eSopenharmony_ci * @systemapi 44461847f8eSopenharmony_ci * @since 10 44561847f8eSopenharmony_ci */ 44661847f8eSopenharmony_ci function getSystemSoundManager(): SystemSoundManager; 44761847f8eSopenharmony_ci 44861847f8eSopenharmony_ci /** 44961847f8eSopenharmony_ci * System sound manager object. 45061847f8eSopenharmony_ci * @typedef SystemSoundManager 45161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 45261847f8eSopenharmony_ci * @systemapi 45361847f8eSopenharmony_ci * @since 10 45461847f8eSopenharmony_ci */ 45561847f8eSopenharmony_ci interface SystemSoundManager { 45661847f8eSopenharmony_ci /** 45761847f8eSopenharmony_ci * Sets the ringtone uri to system. 45861847f8eSopenharmony_ci * @param { Context } context - Current application context. 45961847f8eSopenharmony_ci * @param { string } uri - Ringtone uri to set. 46061847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to set. 46161847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - Callback used to return the set uri result. 46261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 46361847f8eSopenharmony_ci * @systemapi 46461847f8eSopenharmony_ci * @since 10 46561847f8eSopenharmony_ci * @deprecated since 11 46661847f8eSopenharmony_ci * @useinstead systemSoundManager.SystemSoundManager#setRingtoneUri 46761847f8eSopenharmony_ci */ 46861847f8eSopenharmony_ci setSystemRingtoneUri(context: Context, uri: string, type: RingtoneType, callback: AsyncCallback<void>): void; 46961847f8eSopenharmony_ci 47061847f8eSopenharmony_ci /** 47161847f8eSopenharmony_ci * Sets the ringtone uri to system. 47261847f8eSopenharmony_ci * @param { Context } context - Current application context. 47361847f8eSopenharmony_ci * @param { string } uri - Ringtone uri to set. 47461847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to set. 47561847f8eSopenharmony_ci * @returns { Promise<void> } Promise used to return the set uri result. 47661847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 47761847f8eSopenharmony_ci * @systemapi 47861847f8eSopenharmony_ci * @since 10 47961847f8eSopenharmony_ci * @deprecated since 11 48061847f8eSopenharmony_ci * @useinstead systemSoundManager.SystemSoundManager#setRingtoneUri 48161847f8eSopenharmony_ci */ 48261847f8eSopenharmony_ci setSystemRingtoneUri(context: Context, uri: string, type: RingtoneType): Promise<void>; 48361847f8eSopenharmony_ci 48461847f8eSopenharmony_ci /** 48561847f8eSopenharmony_ci * Sets the ringtone uri to system. 48661847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 48761847f8eSopenharmony_ci * @param { string } uri - Ringtone uri to set. 48861847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to set. 48961847f8eSopenharmony_ci * @returns { Promise<void> } Promise used to return the set uri result. 49061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 49161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 49261847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 49361847f8eSopenharmony_ci * 2.Incorrect parameter types. 49461847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 49561847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 49661847f8eSopenharmony_ci * @systemapi 49761847f8eSopenharmony_ci * @since 11 49861847f8eSopenharmony_ci */ 49961847f8eSopenharmony_ci setRingtoneUri(context: BaseContext, uri: string, type: RingtoneType): Promise<void>; 50061847f8eSopenharmony_ci 50161847f8eSopenharmony_ci /** 50261847f8eSopenharmony_ci * Gets the ringtone uri. 50361847f8eSopenharmony_ci * @param { Context } context - Current application context. 50461847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to get. 50561847f8eSopenharmony_ci * @param { AsyncCallback<string> } callback - Callback used to return the ringtone uri maintained in system. 50661847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 50761847f8eSopenharmony_ci * @systemapi 50861847f8eSopenharmony_ci * @since 10 50961847f8eSopenharmony_ci * @deprecated since 11 51061847f8eSopenharmony_ci * @useinstead systemSoundManager.SystemSoundManager#getRingtoneUri 51161847f8eSopenharmony_ci */ 51261847f8eSopenharmony_ci getSystemRingtoneUri(context: Context, type: RingtoneType, callback: AsyncCallback<string>): void; 51361847f8eSopenharmony_ci 51461847f8eSopenharmony_ci /** 51561847f8eSopenharmony_ci * Gets the ringtone uri. 51661847f8eSopenharmony_ci * @param { Context } context - Current application context. 51761847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to get. 51861847f8eSopenharmony_ci * @returns { Promise<string> } Promise used to return the ringtone uri maintained in system. 51961847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 52061847f8eSopenharmony_ci * @systemapi 52161847f8eSopenharmony_ci * @since 10 52261847f8eSopenharmony_ci * @deprecated since 11 52361847f8eSopenharmony_ci * @useinstead systemSoundManager.SystemSoundManager#getRingtoneUri 52461847f8eSopenharmony_ci */ 52561847f8eSopenharmony_ci getSystemRingtoneUri(context: Context, type: RingtoneType): Promise<string>; 52661847f8eSopenharmony_ci 52761847f8eSopenharmony_ci /** 52861847f8eSopenharmony_ci * Gets the ringtone uri. 52961847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 53061847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to get. 53161847f8eSopenharmony_ci * @returns { Promise<string> } Promise used to return the ringtone uri maintained in system. 53261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 53361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 53461847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 53561847f8eSopenharmony_ci * 2.Incorrect parameter types. 53661847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 53761847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 53861847f8eSopenharmony_ci * @systemapi 53961847f8eSopenharmony_ci * @since 11 54061847f8eSopenharmony_ci */ 54161847f8eSopenharmony_ci getRingtoneUri(context: BaseContext, type: RingtoneType): Promise<string>; 54261847f8eSopenharmony_ci 54361847f8eSopenharmony_ci /** 54461847f8eSopenharmony_ci * Gets attributes of the default ringtone. 54561847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 54661847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to get. 54761847f8eSopenharmony_ci * @returns { Promise<ToneAttrs> } Promise used to return attributes of the default ringtone. 54861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 54961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 55061847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 55161847f8eSopenharmony_ci * 2.Incorrect parameter types. 55261847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 55361847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 55461847f8eSopenharmony_ci * @systemapi 55561847f8eSopenharmony_ci * @since 12 55661847f8eSopenharmony_ci */ 55761847f8eSopenharmony_ci getDefaultRingtoneAttrs(context: BaseContext, type: RingtoneType): Promise<ToneAttrs>; 55861847f8eSopenharmony_ci 55961847f8eSopenharmony_ci /** 56061847f8eSopenharmony_ci * Gets attribute list of ringtones. 56161847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 56261847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to get. 56361847f8eSopenharmony_ci * @returns { Promise<ToneAttrsArray> } Promise used to return attribute list of ringtone. 56461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 56561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 56661847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 56761847f8eSopenharmony_ci * 2.Incorrect parameter types. 56861847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 56961847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 57061847f8eSopenharmony_ci * @systemapi 57161847f8eSopenharmony_ci * @since 12 57261847f8eSopenharmony_ci */ 57361847f8eSopenharmony_ci getRingtoneAttrList(context: BaseContext, type: RingtoneType): Promise<ToneAttrsArray>; 57461847f8eSopenharmony_ci 57561847f8eSopenharmony_ci /** 57661847f8eSopenharmony_ci * Gets the ringtone player. 57761847f8eSopenharmony_ci * @param { Context } context - Current application context. 57861847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to get. 57961847f8eSopenharmony_ci * @param { AsyncCallback<RingtonePlayer> } callback - Callback used to return a ringtone player instance. 58061847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 58161847f8eSopenharmony_ci * @systemapi 58261847f8eSopenharmony_ci * @since 10 58361847f8eSopenharmony_ci * @deprecated since 11 58461847f8eSopenharmony_ci * @useinstead systemSoundManager.SystemSoundManager#getRingtonePlayer 58561847f8eSopenharmony_ci */ 58661847f8eSopenharmony_ci getSystemRingtonePlayer(context: Context, type: RingtoneType, callback: AsyncCallback<RingtonePlayer>): void; 58761847f8eSopenharmony_ci 58861847f8eSopenharmony_ci /** 58961847f8eSopenharmony_ci * Gets the ringtone player. 59061847f8eSopenharmony_ci * @param { Context } context - Current application context. 59161847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to get. 59261847f8eSopenharmony_ci * @returns { Promise<RingtonePlayer> } Promise used to return a ringtone player instance. 59361847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 59461847f8eSopenharmony_ci * @systemapi 59561847f8eSopenharmony_ci * @since 10 59661847f8eSopenharmony_ci * @deprecated since 11 59761847f8eSopenharmony_ci * @useinstead systemSoundManager.SystemSoundManager#getRingtonePlayer 59861847f8eSopenharmony_ci */ 59961847f8eSopenharmony_ci getSystemRingtonePlayer(context: Context, type: RingtoneType): Promise<RingtonePlayer>; 60061847f8eSopenharmony_ci 60161847f8eSopenharmony_ci /** 60261847f8eSopenharmony_ci * Gets the ringtone player. 60361847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 60461847f8eSopenharmony_ci * @param { RingtoneType } type - Ringtone type to get. 60561847f8eSopenharmony_ci * @returns { Promise<RingtonePlayer> } Promise used to return a ringtone player instance. 60661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 60761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 60861847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 60961847f8eSopenharmony_ci * 2.Incorrect parameter types. 61061847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 61161847f8eSopenharmony_ci * @systemapi 61261847f8eSopenharmony_ci * @since 11 61361847f8eSopenharmony_ci */ 61461847f8eSopenharmony_ci getRingtonePlayer(context: BaseContext, type: RingtoneType): Promise<RingtonePlayer>; 61561847f8eSopenharmony_ci 61661847f8eSopenharmony_ci /** 61761847f8eSopenharmony_ci * Sets the system tone uri to system. 61861847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 61961847f8eSopenharmony_ci * @param { string } uri - Ringtone uri to set. 62061847f8eSopenharmony_ci * @param { SystemToneType } type - System tone type to set. 62161847f8eSopenharmony_ci * @returns { Promise<void> } Promise used to return the result of set system tone uri. 62261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 62361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 62461847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 62561847f8eSopenharmony_ci * 2.Incorrect parameter types. 62661847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 62761847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 62861847f8eSopenharmony_ci * @systemapi 62961847f8eSopenharmony_ci * @since 11 63061847f8eSopenharmony_ci */ 63161847f8eSopenharmony_ci setSystemToneUri(context: BaseContext, uri: string, type: SystemToneType): Promise<void>; 63261847f8eSopenharmony_ci 63361847f8eSopenharmony_ci /** 63461847f8eSopenharmony_ci * Gets the system tone uri. 63561847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 63661847f8eSopenharmony_ci * @param { SystemToneType } type - System tone type to get. 63761847f8eSopenharmony_ci * @returns { Promise<string> } Promise used to return the system tone maintained in system. 63861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 63961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 64061847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 64161847f8eSopenharmony_ci * 2.Incorrect parameter types. 64261847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 64361847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 64461847f8eSopenharmony_ci * @systemapi 64561847f8eSopenharmony_ci * @since 11 64661847f8eSopenharmony_ci */ 64761847f8eSopenharmony_ci getSystemToneUri(context: BaseContext, type: SystemToneType): Promise<string>; 64861847f8eSopenharmony_ci 64961847f8eSopenharmony_ci /** 65061847f8eSopenharmony_ci * Gets attributes of the default system tone. 65161847f8eSopenharmony_ci * 65261847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 65361847f8eSopenharmony_ci * @param { SystemToneType } type - system tone type to get. 65461847f8eSopenharmony_ci * @returns { Promise<ToneAttrs> } Promise used to return attributes of the default system tone. 65561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 65661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 65761847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 65861847f8eSopenharmony_ci * 2.Incorrect parameter types. 65961847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 66061847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 66161847f8eSopenharmony_ci * @systemapi 66261847f8eSopenharmony_ci * @since 12 66361847f8eSopenharmony_ci */ 66461847f8eSopenharmony_ci getDefaultSystemToneAttrs(context: BaseContext, type: SystemToneType): Promise<ToneAttrs>; 66561847f8eSopenharmony_ci 66661847f8eSopenharmony_ci /** 66761847f8eSopenharmony_ci * Gets attribute list of alarm tones. 66861847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 66961847f8eSopenharmony_ci * @param { SystemToneType } type - System tone type to get. 67061847f8eSopenharmony_ci * @returns { Promise<ToneAttrsArray> } Promise used to return attribute list of system tone. 67161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 67261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 67361847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 67461847f8eSopenharmony_ci * 2.Incorrect parameter types. 67561847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 67661847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 67761847f8eSopenharmony_ci * @systemapi 67861847f8eSopenharmony_ci * @since 12 67961847f8eSopenharmony_ci */ 68061847f8eSopenharmony_ci getSystemToneAttrList(context: BaseContext, type: SystemToneType): Promise<ToneAttrsArray>; 68161847f8eSopenharmony_ci 68261847f8eSopenharmony_ci /** 68361847f8eSopenharmony_ci * Gets the system tone player. 68461847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 68561847f8eSopenharmony_ci * @param { SystemToneType } type - System tone type to get. 68661847f8eSopenharmony_ci * @returns { Promise<SystemTonePlayer> } Promise used to return the SystemTonePlayer. 68761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 68861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 68961847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 69061847f8eSopenharmony_ci * 2.Incorrect parameter types. 69161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 69261847f8eSopenharmony_ci * @systemapi 69361847f8eSopenharmony_ci * @since 11 69461847f8eSopenharmony_ci */ 69561847f8eSopenharmony_ci getSystemTonePlayer(context: BaseContext, type: SystemToneType): Promise<SystemTonePlayer>; 69661847f8eSopenharmony_ci 69761847f8eSopenharmony_ci /** 69861847f8eSopenharmony_ci * Gets attributes of the default alarm tone. 69961847f8eSopenharmony_ci * 70061847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 70161847f8eSopenharmony_ci * @returns { Promise<ToneAttrs> } Promise used to return attributes of the default alarm tone. 70261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 70361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 70461847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 70561847f8eSopenharmony_ci * 2.Incorrect parameter types. 70661847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 70761847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 70861847f8eSopenharmony_ci * @systemapi 70961847f8eSopenharmony_ci * @since 12 71061847f8eSopenharmony_ci */ 71161847f8eSopenharmony_ci getDefaultAlarmToneAttrs(context: BaseContext): Promise<ToneAttrs>; 71261847f8eSopenharmony_ci 71361847f8eSopenharmony_ci /** 71461847f8eSopenharmony_ci * Sets uri of the current alarm tone. 71561847f8eSopenharmony_ci * 71661847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 71761847f8eSopenharmony_ci * @param { string } uri - Alarm tone uri. 71861847f8eSopenharmony_ci * @returns { Promise<void> } Promise used to return result of set alarm tone. 71961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 72061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 72161847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 72261847f8eSopenharmony_ci * 2.Incorrect parameter types. 72361847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 72461847f8eSopenharmony_ci * @throws { BusinessError } 20700001 - Tone type mismatch, e.g. tone of input uri is not an alarm tone. 72561847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 72661847f8eSopenharmony_ci * @systemapi 72761847f8eSopenharmony_ci * @since 12 72861847f8eSopenharmony_ci */ 72961847f8eSopenharmony_ci setAlarmToneUri(context: BaseContext, uri: string): Promise<void>; 73061847f8eSopenharmony_ci 73161847f8eSopenharmony_ci /** 73261847f8eSopenharmony_ci * Gets uri of the current alarm tone. 73361847f8eSopenharmony_ci * 73461847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 73561847f8eSopenharmony_ci * @returns { Promise<string> } Promise used to return uri of current alarm tone. 73661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 73761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 73861847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 73961847f8eSopenharmony_ci * 2.Incorrect parameter types. 74061847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 74161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 74261847f8eSopenharmony_ci * @systemapi 74361847f8eSopenharmony_ci * @since 12 74461847f8eSopenharmony_ci */ 74561847f8eSopenharmony_ci getAlarmToneUri(context: BaseContext): Promise<string>; 74661847f8eSopenharmony_ci 74761847f8eSopenharmony_ci /** 74861847f8eSopenharmony_ci * Gets attribute list of alarm tones. 74961847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 75061847f8eSopenharmony_ci * @returns { Promise<ToneAttrsArray> } Promise used to return attribute list of system tone. 75161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 75261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 75361847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 75461847f8eSopenharmony_ci * 2.Incorrect parameter types. 75561847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 75661847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 75761847f8eSopenharmony_ci * @systemapi 75861847f8eSopenharmony_ci * @since 12 75961847f8eSopenharmony_ci */ 76061847f8eSopenharmony_ci getAlarmToneAttrList(context: BaseContext): Promise<ToneAttrsArray>; 76161847f8eSopenharmony_ci 76261847f8eSopenharmony_ci /** 76361847f8eSopenharmony_ci * Open alarm tone file. 76461847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 76561847f8eSopenharmony_ci * @param { string } uri - Uri of alarm tone to open. 76661847f8eSopenharmony_ci * @returns { Promise<number> } Promise used to return fd. 76761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 76861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 76961847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 77061847f8eSopenharmony_ci * 2.Incorrect parameter types. 77161847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 77261847f8eSopenharmony_ci * @throws { BusinessError } 20700001 - Tone type mismatch, e.g. tone of uri is notification instead of alarm. 77361847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 77461847f8eSopenharmony_ci * @systemapi 77561847f8eSopenharmony_ci * @since 12 77661847f8eSopenharmony_ci */ 77761847f8eSopenharmony_ci openAlarmTone(context: BaseContext, uri: string): Promise<number> 77861847f8eSopenharmony_ci 77961847f8eSopenharmony_ci /** 78061847f8eSopenharmony_ci * Close fd. 78161847f8eSopenharmony_ci * @param { number } fd - File descriptor to close. 78261847f8eSopenharmony_ci * @returns { Promise<void> } Promise used to return the result of close fd. 78361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 78461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 78561847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 78661847f8eSopenharmony_ci * 2.Incorrect parameter types. 78761847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 78861847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 78961847f8eSopenharmony_ci * @systemapi 79061847f8eSopenharmony_ci * @since 12 79161847f8eSopenharmony_ci */ 79261847f8eSopenharmony_ci close(fd: number): Promise<void>; 79361847f8eSopenharmony_ci 79461847f8eSopenharmony_ci /** 79561847f8eSopenharmony_ci * Add customized tone into ringtone library. 79661847f8eSopenharmony_ci * @permission ohos.permission.WRITE_RINGTONE 79761847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 79861847f8eSopenharmony_ci * @param { ToneAttrs } toneAttr - Tone attributes created by {@link createCustomizedToneAttrs}. 79961847f8eSopenharmony_ci * @param { string } externalUri - Tone uri in external storage. 80061847f8eSopenharmony_ci * @returns { Promise<string> } Tone uri after adding into ringtone library. 80161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 80261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 80361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 80461847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 80561847f8eSopenharmony_ci * 2.Incorrect parameter types. 80661847f8eSopenharmony_ci * @throws { BusinessError } 5400102 - Operation is not allowed, e.g. ringtone to add is not customized. 80761847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 80861847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 80961847f8eSopenharmony_ci * @systemapi 81061847f8eSopenharmony_ci * @since 12 81161847f8eSopenharmony_ci */ 81261847f8eSopenharmony_ci addCustomizedTone(context: BaseContext, toneAttr: ToneAttrs, externalUri: string): Promise<string>; 81361847f8eSopenharmony_ci 81461847f8eSopenharmony_ci /** 81561847f8eSopenharmony_ci * Add customized tone into ringtone library. 81661847f8eSopenharmony_ci * @permission ohos.permission.WRITE_RINGTONE 81761847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 81861847f8eSopenharmony_ci * @param { ToneAttrs } toneAttr - Tone attributes created by {@link createCustomizedToneAttrs}. 81961847f8eSopenharmony_ci * @param { number } fd - File descriptor. 82061847f8eSopenharmony_ci * @param { number } [offset] - The offset in the file where the data to be read, in bytes. By default, the offset 82161847f8eSopenharmony_ci * is zero. 82261847f8eSopenharmony_ci * @param { number } [length] - The length in bytes of the data to be read. By default, the length is the rest of 82361847f8eSopenharmony_ci * bytes in the file from the offset. 82461847f8eSopenharmony_ci * @returns { Promise<string> } Tone uri after adding into ringtone library. 82561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 82661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 82761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 82861847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 82961847f8eSopenharmony_ci * 2.Incorrect parameter types. 83061847f8eSopenharmony_ci * @throws { BusinessError } 5400102 - Operation is not allowed, e.g. ringtone to add is not customized. 83161847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 83261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 83361847f8eSopenharmony_ci * @systemapi 83461847f8eSopenharmony_ci * @since 12 83561847f8eSopenharmony_ci */ 83661847f8eSopenharmony_ci addCustomizedTone(context: BaseContext, toneAttr: ToneAttrs, fd: number, offset?: number, length?: number) 83761847f8eSopenharmony_ci : Promise<string>; 83861847f8eSopenharmony_ci 83961847f8eSopenharmony_ci /** 84061847f8eSopenharmony_ci * Remove customized tone in ringtone library. 84161847f8eSopenharmony_ci * @permission ohos.permission.WRITE_RINGTONE 84261847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 84361847f8eSopenharmony_ci * @param { string } uri - Tone uri. 84461847f8eSopenharmony_ci * @returns { Promise<void> } Promise used to return removing result. 84561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 84661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 84761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 84861847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 84961847f8eSopenharmony_ci * 2.Incorrect parameter types. 85061847f8eSopenharmony_ci * @throws { BusinessError } 5400102 - Operation is not allowed, e.g. ringtone of this uri is not customized. 85161847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 85261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 85361847f8eSopenharmony_ci * @systemapi 85461847f8eSopenharmony_ci * @since 12 85561847f8eSopenharmony_ci */ 85661847f8eSopenharmony_ci removeCustomizedTone(context: BaseContext, uri:string): Promise<void>; 85761847f8eSopenharmony_ci 85861847f8eSopenharmony_ci /** 85961847f8eSopenharmony_ci * Get haptics settings. 86061847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 86161847f8eSopenharmony_ci * @param { ToneHapticsType } type - Tone haptics type. 86261847f8eSopenharmony_ci * @returns { Promise<ToneHapticsSettings> } Promise used to return results of this call. 86361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 86461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 86561847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 86661847f8eSopenharmony_ci * 2.Incorrect parameter types. 86761847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 86861847f8eSopenharmony_ci * @throws { BusinessError } 20700003 - Unsupported operation. 86961847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 87061847f8eSopenharmony_ci * @systemapi 87161847f8eSopenharmony_ci * @since 13 87261847f8eSopenharmony_ci */ 87361847f8eSopenharmony_ci getToneHapticsSettings(context: BaseContext, type: ToneHapticsType): Promise<ToneHapticsSettings>; 87461847f8eSopenharmony_ci 87561847f8eSopenharmony_ci /** 87661847f8eSopenharmony_ci * Set haptics settings. 87761847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 87861847f8eSopenharmony_ci * @param { ToneHapticsType } type - Tone haptics type. 87961847f8eSopenharmony_ci * @param { ToneHapticsSettings } settings - Tone haptics settings. 88061847f8eSopenharmony_ci * @returns { Promise<void> } Promise used to return results of this call. 88161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 88261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 88361847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 88461847f8eSopenharmony_ci * 2.Incorrect parameter types. 88561847f8eSopenharmony_ci * @throws { BusinessError } 5400102 - Operation not allowed. For example, the input URI is not valid. 88661847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 88761847f8eSopenharmony_ci * @throws { BusinessError } 20700003 - Unsupported operation. 88861847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 88961847f8eSopenharmony_ci * @systemapi 89061847f8eSopenharmony_ci * @since 13 89161847f8eSopenharmony_ci */ 89261847f8eSopenharmony_ci setToneHapticsSettings(context: BaseContext, type: ToneHapticsType, settings: ToneHapticsSettings): Promise<void>; 89361847f8eSopenharmony_ci 89461847f8eSopenharmony_ci /** 89561847f8eSopenharmony_ci * Get haptics list. 89661847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 89761847f8eSopenharmony_ci * @param { boolean } isSynced - The queried haptics is synchronized with tone or not. 89861847f8eSopenharmony_ci * @returns { Promise<ToneHapticsAttrsArray> } Promise used to return ToneHapticsAttrsArray. 89961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 90061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 90161847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 90261847f8eSopenharmony_ci * 2.Incorrect parameter types. 90361847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 90461847f8eSopenharmony_ci * @throws { BusinessError } 20700003 - Unsupported operation. 90561847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 90661847f8eSopenharmony_ci * @systemapi 90761847f8eSopenharmony_ci * @since 13 90861847f8eSopenharmony_ci */ 90961847f8eSopenharmony_ci getToneHapticsList(context: BaseContext, isSynced: boolean): Promise<ToneHapticsAttrsArray>; 91061847f8eSopenharmony_ci 91161847f8eSopenharmony_ci /** 91261847f8eSopenharmony_ci * Get attributes of haptics which is synchronized with one tone. If no haptics is found, then the attributes in 91361847f8eSopenharmony_ci * the returned ToneHapticsAttrs is empty. 91461847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 91561847f8eSopenharmony_ci * @param { string } toneUri - Uri of tone to query. 91661847f8eSopenharmony_ci * @returns { Promise<ToneHapticsAttrs> } Promise used to return ToneHapticsAttrs. 91761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 91861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 91961847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 92061847f8eSopenharmony_ci * 2.Incorrect parameter types. 92161847f8eSopenharmony_ci * @throws { BusinessError } 5400102 - Operation not allowed. For example, the input URI is not used for tones. 92261847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 92361847f8eSopenharmony_ci * @throws { BusinessError } 20700003 - Unsupported operation. 92461847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 92561847f8eSopenharmony_ci * @systemapi 92661847f8eSopenharmony_ci * @since 13 92761847f8eSopenharmony_ci */ 92861847f8eSopenharmony_ci getHapticsAttrsSyncedWithTone(context: BaseContext, toneUri: string): Promise<ToneHapticsAttrs>; 92961847f8eSopenharmony_ci 93061847f8eSopenharmony_ci /** 93161847f8eSopenharmony_ci * Open haptics. 93261847f8eSopenharmony_ci * @param { BaseContext } context - Current application context. 93361847f8eSopenharmony_ci * @param { string } hapticsUri - Uri of haptics to open. 93461847f8eSopenharmony_ci * @returns { Promise<number> } Promise used to return fd. 93561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Caller is not a system application. 93661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 93761847f8eSopenharmony_ci * 1.Mandatory parameters are left unspecified; 93861847f8eSopenharmony_ci * 2.Incorrect parameter types. 93961847f8eSopenharmony_ci * @throws { BusinessError } 5400102 - Operation not allowed. For example, the input URI is not one for haptics. 94061847f8eSopenharmony_ci * @throws { BusinessError } 5400103 - I/O error. 94161847f8eSopenharmony_ci * @throws { BusinessError } 20700003 - Unsupported operation. 94261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 94361847f8eSopenharmony_ci * @systemapi 94461847f8eSopenharmony_ci * @since 13 94561847f8eSopenharmony_ci */ 94661847f8eSopenharmony_ci openToneHaptics(context: BaseContext, hapticsUri: string): Promise<number>; 94761847f8eSopenharmony_ci } 94861847f8eSopenharmony_ci 94961847f8eSopenharmony_ci /** 95061847f8eSopenharmony_ci * Ringtone player object. 95161847f8eSopenharmony_ci * @typedef { _RingtonePlayer } RingtonePlayer 95261847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 95361847f8eSopenharmony_ci * @systemapi 95461847f8eSopenharmony_ci * @since 10 95561847f8eSopenharmony_ci */ 95661847f8eSopenharmony_ci type RingtonePlayer = _RingtonePlayer; 95761847f8eSopenharmony_ci 95861847f8eSopenharmony_ci /** 95961847f8eSopenharmony_ci * SystemTone player object. 96061847f8eSopenharmony_ci * @typedef { _SystemTonePlayer } SystemTonePlayer 96161847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 96261847f8eSopenharmony_ci * @systemapi 96361847f8eSopenharmony_ci * @since 11 96461847f8eSopenharmony_ci */ 96561847f8eSopenharmony_ci type SystemTonePlayer = _SystemTonePlayer; 96661847f8eSopenharmony_ci 96761847f8eSopenharmony_ci /** 96861847f8eSopenharmony_ci * Interface for ringtone options. 96961847f8eSopenharmony_ci * @typedef { _RingtoneOptions } RingtoneOptions 97061847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 97161847f8eSopenharmony_ci * @systemapi 97261847f8eSopenharmony_ci * @since 10 97361847f8eSopenharmony_ci */ 97461847f8eSopenharmony_ci type RingtoneOptions = _RingtoneOptions; 97561847f8eSopenharmony_ci 97661847f8eSopenharmony_ci /** 97761847f8eSopenharmony_ci * System tone options. 97861847f8eSopenharmony_ci * @typedef { _SystemToneOptions } SystemToneOptions 97961847f8eSopenharmony_ci * @syscap SystemCapability.Multimedia.SystemSound.Core 98061847f8eSopenharmony_ci * @systemapi 98161847f8eSopenharmony_ci * @since 11 98261847f8eSopenharmony_ci */ 98361847f8eSopenharmony_ci type SystemToneOptions = _SystemToneOptions; 98461847f8eSopenharmony_ci} 98561847f8eSopenharmony_ci 98661847f8eSopenharmony_ciexport default systemSoundManager;