当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
46 Star 180 Fork 4.8K

OpenHarmony/interface_sdk-js
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.bluetooth.connection.d.ts 104.88 KB
一键复制 编辑 原始数据 按行查看 历史
马士辰 提交于 1个月前 . transport delete arkts
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755
/*
* Copyright (C) 2023-2024 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 ConnectivityKit
*/
import type { AsyncCallback, Callback } from './@ohos.base';
import type constant from './@ohos.bluetooth.constant';
/**
* Provides methods to operate or manage Bluetooth.
*
* @namespace connection
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Provides methods to operate or manage Bluetooth.
*
* @namespace connection
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Provides methods to operate or manage Bluetooth.
*
* @namespace connection
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
declare namespace connection {
/**
* Indicate the profile connection state.
*
* @typedef { constant.ProfileConnectionState } ProfileConnectionState
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Indicate the profile connection state.
*
* @typedef { constant.ProfileConnectionState } ProfileConnectionState
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
type ProfileConnectionState = constant.ProfileConnectionState;
/**
* Indicate the profile id.
*
* @typedef { constant.ProfileId } ProfileId
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Indicate the profile id.
*
* @typedef { constant.ProfileId } ProfileId
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
type ProfileId = constant.ProfileId;
/**
* Indicate the profile uuid.
*
* @typedef { constant.ProfileUuids } ProfileUuids
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
/**
* Indicate the profile uuid.
*
* @typedef { constant.ProfileUuids } ProfileUuids
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
/**
* Indicate the profile uuid.
*
* @typedef { constant.ProfileUuids } ProfileUuids
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
type ProfileUuids = constant.ProfileUuids;
/**
* Indicate the major class of a bluetooth device.
*
* @typedef { constant.MajorClass } MajorClass
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Indicate the major class of a bluetooth device.
*
* @typedef { constant.MajorClass } MajorClass
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
type MajorClass = constant.MajorClass;
/**
* Indicate the major minor class of a bluetooth device.
*
* @typedef { constant.MajorMinorClass } MajorMinorClass
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Indicate the major minor class of a bluetooth device.
*
* @typedef { constant.MajorMinorClass } MajorMinorClass
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
type MajorMinorClass = constant.MajorMinorClass;
/**
* Get the profile connection state of the current device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { ProfileId } [profileId] - Indicate the profile id. This is an optional parameter.
* With profileId, returns the current connection state of this profile, {@link ProfileConnectionState}.
* Without profileId, if any profile is connected, {@link ProfileConnectionState#STATE_CONNECTED} is returned.
* Otherwise, {@link ProfileConnectionState#STATE_DISCONNECTED} is returned.
* @returns { ProfileConnectionState } Returns the connection state.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900004 - Profile not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Get the profile connection state of the current device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { ProfileId } [profileId] - Indicate the profile id. This is an optional parameter.
* With profileId, returns the current connection state of this profile, {@link ProfileConnectionState}.
* Without profileId, if any profile is connected, {@link ProfileConnectionState#STATE_CONNECTED} is returned.
* Otherwise, {@link ProfileConnectionState#STATE_DISCONNECTED} is returned.
* @returns { ProfileConnectionState } Returns the connection state.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900004 - Profile not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
function getProfileConnectionState(profileId?: ProfileId): ProfileConnectionState;
/**
* Starts pairing with a remote Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<void> } callback - the callback of pairDevice.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Starts pairing with a remote Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<void> } callback - the callback of pairDevice.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Starts pairing with a remote Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<void> } callback - the callback of pairDevice.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since 13
*/
function pairDevice(deviceId: string, callback: AsyncCallback<void>): void;
/**
* Starts pairing with a remote Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Starts pairing with a remote Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Starts pairing with a remote Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since 13
*/
function pairDevice(deviceId: string): Promise<void>;
/**
* Starts pairing with a credible remote Bluetooth device with transport.
* This interface does not trigger a dialog box and does not require user authorization.
* Only specific system application can use this function.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { BluetoothTransport } transport - the transport of the remote device to pair.
* @param { AsyncCallback<void> } callback - the callback of pairCredibleDevice.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
function pairCredibleDevice(deviceId: string, transport: BluetoothTransport, callback: AsyncCallback<void>): void;
/**
* Starts pairing with a credible remote Bluetooth device with transport.
* This interface does not trigger a dialog box and does not require user authorization.
* Only specific system application can use this function.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { BluetoothTransport } transport - the transport of the remote device to pair.
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
function pairCredibleDevice(deviceId: string, transport: BluetoothTransport): Promise<void>;
/**
* Remove a paired remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<void> } callback - the callback of cancelPairedDevice.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
function cancelPairedDevice(deviceId: string, callback: AsyncCallback<void>): void;
/**
* Remove a paired remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
function cancelPairedDevice(deviceId: string): Promise<void>;
/**
* Remove a pairing remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<void> } callback - the callback of cancelPairingDevice.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
function cancelPairingDevice(deviceId: string, callback: AsyncCallback<void>): void;
/**
* Remove a pairing remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
function cancelPairingDevice(deviceId: string): Promise<void>;
/**
* Obtains the name of a peer Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { string } Returns the device name in character string format.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Obtains the name of a peer Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { string } Returns the device name in character string format.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Obtains the name of a peer Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { string } Returns the device name in character string format.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
function getRemoteDeviceName(deviceId: string): string;
/**
* Obtains the name or alias of the Bluetooth peer device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { boolean } [alias] - Indicates whether to obtain the device alias. If the parameter is not provided, the device alias is obtained by default.
* @returns { string } Returns the device name in character string format.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Failed to obtain the name or alias of the peer Bluetooth device.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since arkts {'1.1':'16','1.2':'20'}
* @arkts 1.1&1.2
*/
function getRemoteDeviceName(deviceId: string, alias?: boolean): string;
/**
* Obtains the class of a peer Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { DeviceClass } The class of the remote device.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Obtains the class of a peer Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { DeviceClass } The class of the remote device.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
/**
* Obtains the class of a peer Bluetooth device.
*
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { DeviceClass } The class of the remote device.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'18','1.2':'20'}
* @arkts 1.1&1.2
*/
function getRemoteDeviceClass(deviceId: string): DeviceClass;
/**
* Get the transport of the bluetooth device.
*
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { BluetoothTransport } The transport of bluetooth device.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Get transport failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 20
*/
function getRemoteDeviceTransport(deviceId: string): BluetoothTransport;
/**
* Obtains the Bluetooth local name of a device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @returns { string } Returns the name the device.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Obtains the Bluetooth local name of a device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @returns { string } Returns the name the device.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
function getLocalName(): string;
/**
* Obtains the list of Bluetooth devices that have been paired with the current device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @returns { Array<string> } Returns a list of paired Bluetooth devices's address.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Obtains the list of Bluetooth devices that have been paired with the current device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @returns { Array<string> } Returns a list of paired Bluetooth devices's address.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Obtains the list of Bluetooth devices that have been paired with the current device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @returns { Array<string> } Returns a list of paired Bluetooth devices's address.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
function getPairedDevices(): Array<string>;
/**
* Obtains the pair state of a specified device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { BondState } Returns the pair state.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 11
*/
/**
* Obtains the pair state of a specified device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { BondState } Returns the pair state.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Obtains the pair state of a specified device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { BondState } Returns the pair state.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since 13
*/
function getPairState(deviceId: string): BondState;
/**
* Sets the confirmation of pairing with a certain device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { boolean } accept - Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
function setDevicePairingConfirmation(deviceId: string, accept: boolean): void;
/**
* Set the pin during pairing when the pin type is PIN_TYPE_ENTER_PIN_CODE.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { string } code - The pin code entered by the user.
* @param { AsyncCallback<void> } callback - the callback of setDevicePinCode.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
function setDevicePinCode(deviceId: string, code: string, callback: AsyncCallback<void>): void;
/**
* Set the pin during pairing when the pin type is PIN_TYPE_ENTER_PIN_CODE.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { string } code - The pin code entered by the user.
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
function setDevicePinCode(deviceId: string, code: string): Promise<void>;
/**
* Sets the Bluetooth friendly name of a device. It is used only by system applications for security.
* If a non-system application invokes the interface, exception 801 is thrown.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } name - Indicates a valid Bluetooth name.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
* @deprecated since 12
*/
function setLocalName(name: string): void;
/**
* Sets the Bluetooth scan mode for a device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { ScanMode } mode - Indicates the Bluetooth scan mode to set.
* @param { number } duration - Indicates the duration in seconds, in which the host is discoverable.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since arkts {'1.1':'10','1.2':'20'}
* @arkts 1.1&1.2
*/
function setBluetoothScanMode(mode: ScanMode, duration: number): void;
/**
* Obtains the Bluetooth scanning mode of a device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @returns { ScanMode } Returns the Bluetooth scanning mode.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Obtains the Bluetooth scanning mode of a device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @returns { ScanMode } Returns the Bluetooth scanning mode.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
function getBluetoothScanMode(): ScanMode;
/**
* Starts scanning Bluetooth devices.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Starts scanning Bluetooth devices.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Starts scanning Bluetooth devices.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since 13
*/
function startBluetoothDiscovery(): void;
/**
* Stops Bluetooth device scanning.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Stops Bluetooth device scanning.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Stops Bluetooth device scanning.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since 13
*/
function stopBluetoothDiscovery(): void;
/**
* Check if bluetooth is discovering.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @returns { boolean } Returns {@code true} if the local device is discovering; returns {@code false} otherwise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 11
*/
/**
* Check if bluetooth is discovering.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @returns { boolean } Returns {@code true} if the local device is discovering; returns {@code false} otherwise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
function isBluetoothDiscovering(): boolean;
/**
* Obtains the profile UUIDs supported by the local device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getLocalProfileUuids.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
function getLocalProfileUuids(callback: AsyncCallback<Array<ProfileUuids>>): void;
/**
* Obtains the profile UUIDs supported by the local device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @returns { Promise<Array<ProfileUuids>> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
function getLocalProfileUuids(): Promise<Array<ProfileUuids>>;
/**
* Obtains the profile UUIDs supported by the remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getRemoteProfileUuids.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
/**
* Obtains the profile UUIDs supported by the remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getRemoteProfileUuids.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
/**
* Obtains the profile UUIDs supported by the remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<Array<ProfileUuids>> } callback - the callback of getRemoteProfileUuids.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
function getRemoteProfileUuids(deviceId: string, callback: AsyncCallback<Array<ProfileUuids>>): void;
/**
* Obtains the profile UUIDs supported by the remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<Array<ProfileUuids>> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
/**
* Obtains the profile UUIDs supported by the remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<Array<ProfileUuids>> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
/**
* Obtains the profile UUIDs supported by the remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<Array<ProfileUuids>> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
function getRemoteProfileUuids(deviceId: string): Promise<Array<ProfileUuids>>;
/**
* Connects all allowed bluetooth profiles between the local and remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<void> } callback - the callback result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 11
*/
/**
* Connects all allowed bluetooth profiles between the local and remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<void> } callback - the callback result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 16
*/
function connectAllowedProfiles(deviceId: string, callback: AsyncCallback<void>): void;
/**
* Connects all allowed bluetooth profiles between the local and remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 11
*/
/**
* Connects all allowed bluetooth profiles between the local and remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 16
*/
function connectAllowedProfiles(deviceId: string): Promise<void>;
/**
* Disconnects all allowed bluetooth profiles between the local and remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { AsyncCallback<void> } callback - the callback result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 11
*/
function disconnectAllowedProfiles(deviceId: string, callback: AsyncCallback<void>): void;
/**
* Get remote device battery information.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<BatteryInfo> } Returns battery info.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
function getRemoteDeviceBatteryInfo(deviceId: string): Promise<BatteryInfo>;
/**
* Obtains the product ID of a remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { string } Returns the remote device's product ID.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 11
*/
/**
* Obtains the product ID of a remote device.
*
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { string } Returns the remote device's product ID.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since arkts {'1.1':'16','1.2':'20'}
* @arkts 1.1&1.2
*/
function getRemoteProductId(deviceId: string): string;
/**
* Disconnects all allowed bluetooth profiles between the local and remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 11
*/
function disconnectAllowedProfiles(deviceId: string): Promise<void>;
/**
* Modify remote device name.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { string } name - New device name. Max length is 64 bytes.
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
function setRemoteDeviceName(deviceId: string, name: string): Promise<void>;
/**
* Set remote device custom type.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @param { DeviceType } type - Indicates device type.
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
function setRemoteDeviceType(deviceId: string, type: DeviceType): Promise<void>;
/**
* Get remote device custom type.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<DeviceType> } Returns the device type.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
/**
* Get remote device custom type.
*
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<DeviceType> } Returns the device type.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 18
*/
function getRemoteDeviceType(deviceId: string): Promise<DeviceType>;
/**
* Controls the actions of Bluetooth peripherals.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
* @param { ControlDeviceActionParams } controlDeviceActionParams - Indicates the action for Bluetooth peripherals.
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
function controlDeviceAction(controlDeviceActionParams: ControlDeviceActionParams): Promise<void>;
/**
* Get latest connection time of device.
*
* @param { string } deviceId - Indicates device ID. For example, "11:22:33:AA:BB:FF".
* @returns { Promise<number> } Returns latest connection time.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 15
*/
function getLastConnectionTime(deviceId: string): Promise<number>;
/**
* update cloud devices.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH
* @param { TrustedPairedDevices } trustedPairedDevices - Indicates the cloud devices.
* @returns { Promise<void> } Returns the promise object.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900001 - Service stopped.
* @throws { BusinessError } 2900003 - Bluetooth disabled.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
function updateCloudBluetoothDevice(trustedPairedDevices: TrustedPairedDevices): Promise<void>;
/**
* Subscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
* @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Subscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
* @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Subscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
* @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since 13
*/
function on(type: 'bluetoothDeviceFind', callback: Callback<Array<string>>): void;
/**
* Unsubscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
* @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Unsubscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
* @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Unsubscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'bluetoothDeviceFind' } type - Type of the discovering event to listen for.
* @param { Callback<Array<string>> } callback - Callback used to listen for the discovering event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since 13
*/
function off(type: 'bluetoothDeviceFind', callback?: Callback<Array<string>>): void;
/**
* Subscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.GET_BLUETOOTH_PEERS_MAC
* @param { 'discoveryResult' } type - Type of the discovering event to listen for.
* @param { Callback<Array<DiscoveryResult>> } callback - Callback used to listen for the discovering event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
/**
* Subscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'discoveryResult' } type - Type of the discovering event to listen for.
* @param { Callback<Array<DiscoveryResult>> } callback - Callback used to listen for the discovering event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 18
*/
function on(type: 'discoveryResult', callback: Callback<Array<DiscoveryResult>>): void;
/**
* Unsubscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.ACCESS_BLUETOOTH and ohos.permission.GET_BLUETOOTH_PEERS_MAC
* @param { 'discoveryResult' } type - Type of the discovering event to listen for.
* @param { Callback<Array<DiscoveryResult>> } callback - Callback used to listen for the discovering event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
/**
* Unsubscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'discoveryResult' } type - Type of the discovering event to listen for.
* @param { Callback<Array<DiscoveryResult>> } callback - Callback used to listen for the discovering event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 18
*/
function off(type: 'discoveryResult', callback?: Callback<Array<DiscoveryResult>>): void;
/**
* Subscribe the event reported when a remote Bluetooth device is bonded.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'bondStateChange' } type - Type of the bond state event to listen for.
* @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Subscribe the event reported when a remote Bluetooth device is bonded.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'bondStateChange' } type - Type of the bond state event to listen for.
* @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
function on(type: 'bondStateChange', callback: Callback<BondStateParam>): void;
/**
* Unsubscribe the event reported when a remote Bluetooth device is bonded.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'bondStateChange' } type - Type of the bond state event to listen for.
* @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Unsubscribe the event reported when a remote Bluetooth device is bonded.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'bondStateChange' } type - Type of the bond state event to listen for.
* @param { Callback<BondStateParam> } callback - Callback used to listen for the bond state event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
function off(type: 'bondStateChange', callback?: Callback<BondStateParam>): void;
/**
* Subscribe the event of a pairing request from a remote Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'pinRequired' } type - Type of the pairing request event to listen for.
* @param { Callback<PinRequiredParam> } callback - Callback used to listen for the pairing request event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
function on(type: 'pinRequired', callback: Callback<PinRequiredParam>): void;
/**
* Unsubscribe the event of a pairing request from a remote Bluetooth device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'pinRequired' } type - Type of the pairing request event to listen for.
* @param { Callback<PinRequiredParam> } callback - Callback used to listen for the pairing request event.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Invalid parameter. Possible causes: 1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types. 3. Parameter verification failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
function off(type: 'pinRequired', callback?: Callback<PinRequiredParam>): void;
/**
* Subscribe the event of battery state changed from a remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'batteryChange' } type - Type of the battery event to listen for.
* @param { Callback<BatteryInfo> } callback - Callback used to listen.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
function on(type: 'batteryChange', callback: Callback<BatteryInfo>): void;
/**
* Unsubscribe the event of battery state changed from a remote device.
*
* @permission ohos.permission.ACCESS_BLUETOOTH
* @param { 'batteryChange' } type - Type of the battery event to listen for.
* @param { Callback<BatteryInfo> } callback - Callback used to listen.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 2900099 - Operation failed.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
function off(type: 'batteryChange', callback?: Callback<BatteryInfo>): void;
/**
* Describes the class of a bluetooth device.
*
* @typedef BondStateParam
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Describes the class of a bluetooth device.
*
* @typedef BondStateParam
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
interface BondStateParam {
/**
* Address of a Bluetooth device.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Address of a Bluetooth device.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
deviceId: string;
/**
* Profile connection state of the device.
*
* @type { BondState }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Profile connection state of the device.
*
* @type { BondState }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
state: BondState;
/**
* Cause of unbond.
*
* @type { UnbondCause }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
/**
* Cause of unbond.
*
* @type { UnbondCause }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
cause: UnbondCause;
}
/**
* Describes the bond key param.
*
* @typedef PinRequiredParam
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since arkts {'1.1':'10','1.2':'20'}
* @arkts 1.1&1.2
*/
interface PinRequiredParam {
/**
* ID of the device to pair.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since arkts {'1.1':'10','1.2':'20'}
* @arkts 1.1&1.2
*/
deviceId: string;
/**
* Key for the device pairing.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
pinCode: string;
/**
* Indicates the pairing type to a peer device.
*
* @type { PinType }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
pinType: PinType;
}
/**
* Describes the class of a bluetooth device.
*
* @typedef DeviceClass
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Describes the class of a bluetooth device.
*
* @typedef DeviceClass
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
interface DeviceClass {
/**
* Major classes of Bluetooth devices.
*
* @type { MajorClass }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Major classes of Bluetooth devices.
*
* @type { MajorClass }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
majorClass: MajorClass;
/**
* Major and minor classes of Bluetooth devices.
*
* @type { MajorMinorClass }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Major and minor classes of Bluetooth devices.
*
* @type { MajorMinorClass }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
majorMinorClass: MajorMinorClass;
/**
* Class of the device.
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Class of the device.
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
classOfDevice: number;
}
/**
* Enum for the transport of a remote device
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
enum BluetoothTransport {
/**
* The value of bluetooth transport BR/EDR.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
TRANSPORT_BR_EDR = 0,
/**
* The value of bluetooth transport LE.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
TRANSPORT_LE = 1,
/**
* The value of bluetooth transport DUAL.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 20
*/
TRANSPORT_DUAL = 2,
/**
* The unknown bluetooth transport.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 20
*/
TRANSPORT_UNKNOWN = 3
}
/**
* The enum of BR scan mode.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* The enum of BR scan mode.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
enum ScanMode {
/**
* Indicates the scan mode is none
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Indicates the scan mode is none
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
SCAN_MODE_NONE = 0,
/**
* Indicates the scan mode is connectable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Indicates the scan mode is connectable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
SCAN_MODE_CONNECTABLE = 1,
/**
* Indicates the scan mode is general discoverable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
SCAN_MODE_GENERAL_DISCOVERABLE = 2,
/**
* Indicates the scan mode is limited discoverable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
SCAN_MODE_LIMITED_DISCOVERABLE = 3,
/**
* Indicates the scan mode is connectable and general discoverable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Indicates the scan mode is connectable and general discoverable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4,
/**
* Indicates the scan mode is connectable and limited discoverable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5
}
/**
* The enum of bond state.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* The enum of bond state.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* The enum of bond state.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
enum BondState {
/**
* Indicate the bond state is invalid
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Indicate the bond state is invalid
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Indicate the bond state is invalid
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since 13
*/
BOND_STATE_INVALID = 0,
/**
* Indicate the bond state is bonding
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Indicate the bond state is bonding
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Indicate the bond state is bonding
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since 13
*/
BOND_STATE_BONDING = 1,
/**
* Indicate the bond state is bonded
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 10
*/
/**
* Indicate the bond state is bonded
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @atomicservice
* @since 12
*/
/**
* Indicate the bond state is bonded
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @atomicservice
* @since arkts {'1.1':'13','1.2':'20'}
* @arkts 1.1&1.2
*/
BOND_STATE_BONDED = 2
}
/**
* Enum for the type of pairing to a remote device
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
enum PinType {
/**
* The user needs to enter the pin code displayed on the peer device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
PIN_TYPE_ENTER_PIN_CODE = 0,
/**
* The user needs to enter the passkey displayed on the peer device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
PIN_TYPE_ENTER_PASSKEY = 1,
/**
* The user needs to confirm the passkey displayed on the local device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
PIN_TYPE_CONFIRM_PASSKEY = 2,
/**
* The user needs to accept or deny the pairing request.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
PIN_TYPE_NO_PASSKEY_CONSENT = 3,
/**
* The user needs to enter the passkey displayed on the local device on the peer device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
PIN_TYPE_NOTIFY_PASSKEY = 4,
/**
* The user needs to enter the pin code displayed on the peer device, used for bluetooth 2.0.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
PIN_TYPE_DISPLAY_PIN_CODE = 5,
/**
* The user needs to accept or deny the OOB pairing request.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
PIN_TYPE_OOB_CONSENT = 6,
/**
* The user needs to enter the 16-digit pin code displayed on the peer device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 10
*/
PIN_TYPE_PIN_16_DIGITS = 7
}
/**
* Describes the contents of the discovery results
*
* @typedef DiscoveryResult
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
/**
* Describes the contents of the discovery results
*
* @typedef DiscoveryResult
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since arkts {'1.1':'18','1.2':'20'}
* @arkts 1.1&1.2
*/
interface DiscoveryResult {
/**
* Identify of the discovery device
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
/**
* Identify of the discovery device
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since arkts {'1.1':'18','1.2':'20'}
* @arkts 1.1&1.2
*/
deviceId: string;
/**
* RSSI of the remote device
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
/**
* RSSI of the remote device
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 18
*/
rssi: number;
/**
* The local name of the device
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
/**
* The local name of the device
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 18
*/
deviceName: string;
/**
* The class of the device
*
* @type { DeviceClass }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
/**
* The class of the device
*
* @type { DeviceClass }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 18
*/
deviceClass: DeviceClass;
}
/**
* Describes the contents of the battery information.
*
* @typedef BatteryInfo
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
interface BatteryInfo {
/**
* Identify of the discovery device.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since arkts {'1.1':'12','1.2':'20'}
* @arkts 1.1&1.2
*/
deviceId: string;
/**
* Electricity value of the general device. {@code -1} means no power information.
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
batteryLevel: number;
/**
* Electricity value of the left ear. {@code -1} means no power information.
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
leftEarBatteryLevel: number;
/**
* The charge state of the left ear.
*
* @type { DeviceChargeState }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
leftEarChargeState: DeviceChargeState;
/**
* Electricity value of the right ear. {@code -1} means no power information.
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
rightEarBatteryLevel: number;
/**
* The charge state of the right ear.
*
* @type { DeviceChargeState }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
rightEarChargeState: DeviceChargeState;
/**
* Electricity value of the box. {@code -1} means no power information.
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
boxBatteryLevel: number;
/**
* The charge state of the box.
*
* @type { DeviceChargeState }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
boxChargeState: DeviceChargeState;
}
/**
* Enum for the charge state.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
enum DeviceChargeState {
/**
* Not support super charge, and not charged.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
DEVICE_NORMAL_CHARGE_NOT_CHARGED = 0,
/**
* Not support super charge, and in charging.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
DEVICE_NORMAL_CHARGE_IN_CHARGING = 1,
/**
* Support super charge, and not charged.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
DEVICE_SUPER_CHARGE_NOT_CHARGED = 2,
/**
* Support super charge, and in charging.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
DEVICE_SUPER_CHARGE_IN_CHARGING = 3
}
/**
* Enum for the custom type of remote device.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
enum DeviceType {
/**
* Default type, the type is consistent with COD.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
DEVICE_TYPE_DEFAULT = 0,
/**
* Car bluetooth.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
DEVICE_TYPE_CAR = 1,
/**
* Headset bluetooth.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
DEVICE_TYPE_HEADSET = 2,
/**
* Hearing Aid.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
DEVICE_TYPE_HEARING = 3,
/**
* Glasses device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
DEVICE_TYPE_GLASSES = 4,
/**
* Watch device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
DEVICE_TYPE_WATCH = 5,
/**
* Speaker device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
DEVICE_TYPE_SPEAKER = 6,
/**
* Others bluetooth.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 12
*/
DEVICE_TYPE_OTHERS = 7
}
/**
* Enum for cause of unbond.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
/**
* Enum for cause of unbond.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
enum UnbondCause {
/**
* User proactively removed device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
/**
* User proactively removed device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @crossplatform
* @since 13
*/
USER_REMOVED = 0,
/**
* Remote device shut down.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
REMOTE_DEVICE_DOWN = 1,
/**
* Wrong PIN code.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
AUTH_FAILURE = 2,
/**
* Remote device rejected.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
AUTH_REJECTED = 3,
/**
* Internal error.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 12
*/
INTERNAL_ERROR = 4
}
/**
* Describes information about controlling the Bluetooth peripheral.
*
* @typedef ControlDeviceActionParams
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
interface ControlDeviceActionParams {
/**
* Indicates the address of the peripheral.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since arkts {'1.1':'15','1.2':'20'}
* @arkts 1.1&1.2
*/
deviceId: string;
/**
* Indicates the control type.
*
* @type { ControlType }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
type: ControlType;
/**
* Indicates the control value.
*
* @type { ControlTypeValue }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
typeValue: ControlTypeValue;
/**
* Indicates the control object.
*
* @type { ControlObject }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
controlObject: ControlObject;
}
/**
* Describes the control type.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
enum ControlType {
/**
* Indicates the control command of play.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
PLAY = 0,
/**
* Indicates the control command of vibration.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
VIBRATE = 1,
/**
* Indicates the control command of flash.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
FLASH = 2,
/**
* Indicates the control command of lock.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
LOCK = 3,
/**
* Indicates the control command of erase.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
ERASE = 4,
}
/**
* Describes the control type value.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
enum ControlTypeValue {
/**
* Indicates the action of disable.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
DISABLE = 0,
/**
* Indicates the action of enable.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
ENABLE = 1,
/**
* Indicates the action of query.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
QUERY = 2,
}
/**
* Describes the control object.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
enum ControlObject {
/**
* Control object of left ear.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
LEFT_EAR = 0,
/**
* Control object of right ear.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
RIGHT_EAR = 1,
/**
* Control object of left and right ear.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
LEFT_RIGHT_EAR = 2,
}
/**
* Describes the cloud pair device.
*
* @typedef TrustedPairedDevices
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
interface TrustedPairedDevices {
/**
* The list of cloud pair devices.
*
* @type { Array<TrustedPairedDevice> }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
trustedPairedDevices: Array<TrustedPairedDevice>;
}
/**
* Describes device of cloud pair.
*
* @typedef TrustedPairedDevice
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
interface TrustedPairedDevice {
/**
* Indicates the device identify.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
sn: string;
/**
* Indicates the device type of the peripheral.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
deviceType: string;
/**
* Indicates the modelId of the peripheral.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
modelId: string;
/**
* Indicates the manufactory of the peripheral.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
manufactory: string;
/**
* Indicates the productId of the peripheral.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
productId: string;
/**
* Indicates the HiLink version of the peripheral.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
hiLinkVersion: string;
/**
* Indicates the macAddress of the peripheral.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
macAddress: string;
/**
* Indicates the service type of the peripheral.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
serviceType: string;
/**
* Indicates the service id of the peripheral.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
serviceId: string;
/**
* The local name of the device
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
deviceName: string;
/**
* Indicates the uuid of the peripheral.
*
* @type { string }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
uuids: string;
/**
* Indicates the bluetoothClass of the peripheral.
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
bluetoothClass: number;
/**
* Indicates the token of the peripheral.
*
* @type { ArrayBuffer }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
token: ArrayBuffer;
/**
* Indicates the deviceNameTime of the peripheral.
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
deviceNameTime: number;
/**
* Indicates the securityAdvInfo of the peripheral.
*
* @type { ArrayBuffer }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
secureAdvertisingInfo: ArrayBuffer;
/**
* Indicates the pairState of the peripheral.
*
* @type { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi
* @since 15
*/
pairState: number;
}
}
export default connection;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/interface_sdk-js.git
git@gitee.com:openharmony/interface_sdk-js.git
openharmony
interface_sdk-js
interface_sdk-js
master

搜索帮助