1 Star 0 Fork 4K

Feng Lin/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.bluetooth.d.ts 106.75 KB
一键复制 编辑 原始数据 按行查看 历史
liuqian_herb 提交于 2024-02-01 15:18 +08:00 . fix codecheck
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338
/*
* Copyright (C) 2021-2022 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';
/**
* Provides methods to operate or manage Bluetooth.
*
* @namespace bluetooth
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager
*/
declare namespace bluetooth {
/**
* Obtains the Bluetooth status of a device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { BluetoothState } Returns the Bluetooth status, which can be {@link BluetoothState#STATE_OFF},
* {@link BluetoothState#STATE_TURNING_ON}, {@link BluetoothState#STATE_ON}, {@link BluetoothState#STATE_TURNING_OFF},
* {@link BluetoothState#STATE_BLE_TURNING_ON}, {@link BluetoothState#STATE_BLE_ON},
* or {@link BluetoothState#STATE_BLE_TURNING_OFF}.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.getState
*/
function getState(): BluetoothState;
/**
* Get the local device connection state to any profile of any remote device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { ProfileConnectionState } One of {@link ProfileConnectionState#STATE_DISCONNECTED},
* {@link ProfileConnectionState#STATE_CONNECTING}, {@link ProfileConnectionState#STATE_CONNECTED},
* {@link ProfileConnectionState#STATE_DISCONNECTING}.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.getBtConnectionState
*/
function getBtConnectionState(): ProfileConnectionState;
/**
* Starts pairing with a remote Bluetooth device.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @param { string } deviceId - The address of the remote device to pair.
* @returns { boolean } Returns {@code true} if the pairing process is started; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.pairDevice
*/
function pairDevice(deviceId: string): boolean;
/**
* Remove a paired remote device.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @param { string } deviceId - The address of the remote device to be removed.
* @returns { boolean } Returns {@code true} if the cancel process is started; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @systemapi Hide this for inner system use
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.cancelPairedDevice
*/
function cancelPairedDevice(deviceId: string): boolean;
/**
* Obtains the name of a peer Bluetooth device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { string } deviceId - The address of the remote device.
* @returns { string } Returns the device name in character string format.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.getRemoteDeviceName
*/
function getRemoteDeviceName(deviceId: string): string;
/**
* Obtains the class of a peer Bluetooth device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { string } deviceId - The address of the remote device.
* @returns { DeviceClass } The class of the remote device, {@link DeviceClass}.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.getRemoteDeviceClass
*/
function getRemoteDeviceClass(deviceId: string): DeviceClass;
/**
* Enables Bluetooth on a device.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @returns { boolean } Returns {@code true} if Bluetooth is being enabled; returns {@code false} if an error occurs.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.enableBluetooth
*/
function enableBluetooth(): boolean;
/**
* Disables Bluetooth on a device.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @returns { boolean } Returns {@code true} if Bluetooth is being disabled; returns {@code false} if an error occurs.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.disableBluetooth
*/
function disableBluetooth(): boolean;
/**
* Obtains the Bluetooth local name of a device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { string } Returns the name the device.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.getLocalName
*/
function getLocalName(): string;
/**
* Obtains the list of Bluetooth devices that have been paired with the current device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { Array<string> } Returns a list of paired Bluetooth devices's address.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.getPairedDevices
*/
function getPairedDevices(): Array<string>;
/**
* Obtains the connection state of profile.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { ProfileId } profileId - The profile id.
* @returns { ProfileConnectionState } Returns the connection state.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.getProfileConnectionState
*/
function getProfileConnState(profileId: ProfileId): ProfileConnectionState;
/**
* Sets the confirmation of pairing with a certain device.
*
* @permission ohos.permission.MANAGE_BLUETOOTH
* @param { string } device - The address of the remote device.
* @param { boolean } accept - Indicates whether to accept the pairing request, {@code true} indicates accept or {@code false} otherwise.
* @returns { boolean } Returns {@code true} if the pairing confirmation is set; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.setDevicePairingConfirmation
*/
function setDevicePairingConfirmation(device: string, accept: boolean): boolean;
/**
* Sets the Bluetooth friendly name of a device.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @param { string } name - Indicates a valid Bluetooth name.
* @returns { boolean } Returns {@code true} if the Bluetooth name is set successfully; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.setLocalName
*/
function setLocalName(name: string): boolean;
/**
* Sets the Bluetooth scan mode for a device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { ScanMode } mode - Indicates the Bluetooth scan mode to set, {@link ScanMode}.
* @param { number } duration - Indicates the duration in seconds, in which the host is discoverable.
* @returns { boolean } Returns {@code true} if the Bluetooth scan mode is set; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.setBluetoothScanMode
*/
function setBluetoothScanMode(mode: ScanMode, duration: number): boolean;
/**
* Obtains the Bluetooth scanning mode of a device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { ScanMode } Returns the Bluetooth scanning mode, {@link ScanMode}.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.getBluetoothScanMode
*/
function getBluetoothScanMode(): ScanMode;
/**
* Starts scanning Bluetooth devices.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION
* @returns { boolean } Returns {@code true} if the scan is started successfully; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.startBluetoothDiscovery
*/
function startBluetoothDiscovery(): boolean;
/**
* Stops Bluetooth device scanning.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @returns { boolean } Returns {@code true} if scanning is stopped successfully; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.stopBluetoothDiscovery
*/
function stopBluetoothDiscovery(): boolean;
/**
* Subscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.USE_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.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.on#event:bluetoothDeviceFind
*/
function on(type: 'bluetoothDeviceFind', callback: Callback<Array<string>>): void;
/**
* Unsubscribe the event reported when a remote Bluetooth device is discovered.
*
* @permission ohos.permission.USE_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.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.off#event:bluetoothDeviceFind
*/
function off(type: 'bluetoothDeviceFind', callback?: Callback<Array<string>>): void;
/**
* Subscribe the event reported when a remote Bluetooth device is bonded.
*
* @permission ohos.permission.USE_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, {@link BondStateParam}.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.on#event:bondStateChange
*/
function on(type: 'bondStateChange', callback: Callback<BondStateParam>): void;
/**
* Unsubscribe the event reported when a remote Bluetooth device is bonded.
*
* @permission ohos.permission.USE_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.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.off#event:bondStateChange
*/
function off(type: 'bondStateChange', callback?: Callback<BondStateParam>): void;
/**
* Subscribe the event of a pairing request from a remote Bluetooth device.
*
* @permission ohos.permission.DISCOVER_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.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.on#event:pinRequired
*/
function on(type: 'pinRequired', callback: Callback<PinRequiredParam>): void;
/**
* Unsubscribe the event of a pairing request from a remote Bluetooth device.
*
* @permission ohos.permission.DISCOVER_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.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.off#event:pinRequired
*/
function off(type: 'pinRequired', callback?: Callback<PinRequiredParam>): void;
/**
* Subscribe the event reported when the Bluetooth state changes.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for.
* @param { Callback<BluetoothState> } callback - Callback used to listen for the Bluetooth state event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.on#event:stateChange
*/
function on(type: 'stateChange', callback: Callback<BluetoothState>): void;
/**
* Unsubscribe the event reported when the Bluetooth state changes.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'stateChange' } type - Type of the Bluetooth state changes event to listen for.
* @param { Callback<BluetoothState> } callback - Callback used to listen for the Bluetooth state event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.off#event:stateChange
*/
function off(type: 'stateChange', callback?: Callback<BluetoothState>): void;
/**
* Creates a Bluetooth server listening socket.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { string } name - Indicates the service name.
* @param { SppOption } option - Indicates the listen parameters {@link SppOption}.
* @param { AsyncCallback<number> } callback - Callback used to return a server socket ID.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.sppListen
*/
function sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void;
/**
* Waits for a remote device to connect.
*
* @param { number } serverSocket - Indicates the server socket ID, returned by {@link sppListen}.
* @param { AsyncCallback<number> } callback - Callback used to return a client socket ID.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.sppAccept
*/
function sppAccept(serverSocket: number, callback: AsyncCallback<number>): void;
/**
* Connects to a remote device over the socket.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { string } device - The address of the remote device to connect.
* @param { SppOption } option - Indicates the connect parameters {@link SppOption}.
* @param { AsyncCallback<number> } callback - Callback used to return a client socket ID.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.sppConnect
*/
function sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void;
/**
* Disables an spp server socket and releases related resources.
*
* @param { number } socket - Indicates the server socket ID, returned by {@link sppListen}.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.sppCloseServerSocket
*/
function sppCloseServerSocket(socket: number): void;
/**
* Disables an spp client socket and releases related resources.
*
* @param { number } socket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.sppCloseClientSocket
*/
function sppCloseClientSocket(socket: number): void;
/**
* Write data through the socket.
*
* @param { number } clientSocket - Indicates the client socket ID, returned by {@link sppAccept} or {@link sppConnect}.
* @param { ArrayBuffer } data - Indicates the data to write.
* @returns { boolean } Returns {@code true} if the data is write successfully; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.sppWrite
*/
function sppWrite(clientSocket: number, data: ArrayBuffer): boolean;
/**
* Subscribe the event reported when data is read from the socket.
*
* @param { 'sppRead' } type - Type of the spp read event to listen for.
* @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect.
* @param { Callback<ArrayBuffer> } callback - Callback used to listen for the spp read event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.on#event:sppRead
*/
function on(type: 'sppRead', clientSocket: number, callback: Callback<ArrayBuffer>): void;
/**
* Unsubscribe the event reported when data is read from the socket.
*
* @param { 'sppRead' } type - Type of the spp read event to listen for.
* @param { number } clientSocket - Client socket ID, which is obtained by sppAccept or sppConnect.
* @param { Callback<ArrayBuffer> } callback - Callback used to listen for the spp read event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.off#event:sppRead
*/
function off(type: 'sppRead', clientSocket: number, callback?: Callback<ArrayBuffer>): void;
/**
* Obtains the instance of profile.
*
* @param { ProfileId } profileId - The profile id..
* @returns { A2dpSourceProfile | HandsFreeAudioGatewayProfile } Returns instance of profile.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.getProfileInstance
*/
function getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile;
/**
* Base interface of profile.
*
* @typedef BaseProfile
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BaseProfile
*/
interface BaseProfile {
/**
* Obtains the connected devices list of profile.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { Array<string> } Returns the address of connected devices list.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BaseProfile#getConnectionDevices
*/
getConnectionDevices(): Array<string>;
/**
* Obtains the profile state of device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { string } device - The address of bluetooth device.
* @returns { ProfileConnectionState } Returns {@link ProfileConnectionState} of device.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BaseProfile#getDeviceState
*/
getDeviceState(device: string): ProfileConnectionState;
}
/**
* Manager a2dp source profile.
*
* @typedef A2dpSourceProfile
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile
*/
interface A2dpSourceProfile extends BaseProfile {
/**
* Connect to device with a2dp.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @param { string } device - The address of the remote device to connect.
* @returns { boolean } Returns {@code true} if the connect is in process; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile#connect
*/
connect(device: string): boolean;
/**
* Disconnect to device with a2dp.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @param { string } device - The address of the remote device to disconnect.
* @returns { boolean } Returns {@code true} if the disconnect is in process; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile#disconnect
*/
disconnect(device: string): boolean;
/**
* Subscribe the event reported when the profile connection state changes .
*
* @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for .
* @param { Callback<StateChangeParam> } callback - Callback used to listen for event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile.on#event:connectionStateChange
*/
on(type: 'connectionStateChange', callback: Callback<StateChangeParam>): void;
/**
* Unsubscribe the event reported when the profile connection state changes .
*
* @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for .
* @param { Callback<StateChangeParam> } callback - Callback used to listen for event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile.off#event:connectionStateChange
*/
off(type: 'connectionStateChange', callback?: Callback<StateChangeParam>): void;
/**
* Obtains the playing state of device.
*
* @param { string } device - The address of the remote device.
* @returns { PlayingState } Returns {@link PlayingState} of the remote device.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile#getPlayingState
*/
getPlayingState(device: string): PlayingState;
}
/**
* Manager handsfree AG profile.
*
* @typedef HandsFreeAudioGatewayProfile
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile
*/
interface HandsFreeAudioGatewayProfile extends BaseProfile {
/**
* Connect to device with hfp.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @param { string } device - The address of the remote device to connect.
* @returns { boolean } Returns {@code true} if the connect is in process; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile#connect
*/
connect(device: string): boolean;
/**
* Disconnect to device with hfp.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @param { string } device - The address of the remote device to disconnect.
* @returns { boolean } Returns {@code true} if the disconnect is in process; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile#disconnect
*/
disconnect(device: string): boolean;
/**
* Subscribe the event reported when the profile connection state changes .
*
* @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for .
* @param { Callback<StateChangeParam> } callback - Callback used to listen for event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile.on#event:connectionStateChange
*/
on(type: 'connectionStateChange', callback: Callback<StateChangeParam>): void;
/**
* Unsubscribe the event reported when the profile connection state changes .
*
* @param { 'connectionStateChange' } type - Type of the profile connection state changes event to listen for .
* @param { Callback<StateChangeParam> } callback - Callback used to listen for event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile.off#event:connectionStateChange
*/
off(type: 'connectionStateChange', callback?: Callback<StateChangeParam>): void;
}
/**
* Provides methods to operate or manage Bluetooth.
*
* @namespace BLE
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLE
*/
namespace BLE {
/**
* create a JavaScript Gatt server instance.
*
* @returns { GattServer } Returns a JavaScript Gatt server instance {@code GattServer}.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLE.createGattServer
*/
function createGattServer(): GattServer;
/**
* create a JavaScript Gatt client device instance.
*
* @param { string } deviceId - The address of the remote device.
* @returns { GattClientDevice } Returns a JavaScript Gatt client device instance {@code GattClientDevice}.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLE.createGattClientDevice
*/
function createGattClientDevice(deviceId: string): GattClientDevice;
/**
* Obtains the list of devices in the connected status.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { Array<string> } Returns the list of device address.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLE.getConnectedBLEDevices
*/
function getConnectedBLEDevices(): Array<string>;
/**
* Starts scanning for specified BLE devices with filters.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH and ohos.permission.LOCATION
* @param { Array<ScanFilter> } filters - Indicates the list of filters used to filter out specified devices.
* If you do not want to use filter, set this parameter to {@code null}.
* @param { ScanOptions } options - Indicates the parameters for scanning and if the user does not assign a value, the default value will be used.
* {@link ScanOptions#interval} set to 0, {@link ScanOptions#dutyMode} set to {@link SCAN_MODE_LOW_POWER}
* and {@link ScanOptions#matchMode} set to {@link MATCH_MODE_AGGRESSIVE}.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLE.startBLEScan
*/
function startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void;
/**
* Stops BLE scanning.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLE.stopBLEScan
*/
function stopBLEScan(): void;
/**
* Subscribe BLE scan result.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for.
* @param { Callback<Array<ScanResult>> } callback - Callback used to listen for the scan result event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLE.on#event:BLEDeviceFind
*/
function on(type: 'BLEDeviceFind', callback: Callback<Array<ScanResult>>): void;
/**
* Unsubscribe BLE scan result.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'BLEDeviceFind' } type - Type of the scan result event to listen for.
* @param { Callback<Array<ScanResult>> } callback - Callback used to listen for the scan result event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLE.off#event:BLEDeviceFind
*/
function off(type: 'BLEDeviceFind', callback?: Callback<Array<ScanResult>>): void;
}
/**
* Manages GATT server. Before calling an Gatt server method, you must use {@link createGattServer} to create an GattServer instance.
*
* @typedef GattServer
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer
*/
interface GattServer {
/**
* Starts BLE advertising.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @param { AdvertiseSetting } setting - Indicates the settings for BLE advertising.
* If you need to use the default value, set this parameter to {@code null}.
* @param { AdvertiseData } advData - Indicates the advertising data.
* @param { AdvertiseData } advResponse - Indicates the scan response associated with the advertising data.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#startAdvertising
*/
startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void;
/**
* Stops BLE advertising.
*
* @permission ohos.permission.DISCOVER_BLUETOOTH
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#stopAdvertising
*/
stopAdvertising(): void;
/**
* Adds a specified service to be hosted.
* <p>The added service and its characteristics are provided by the local device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { GattService } service - Indicates the service to add.
* @returns { boolean } Returns {@code true} if the service is added; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#addService
*/
addService(service: GattService): boolean;
/**
* Removes a specified service from the list of GATT services provided by this device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { string } serviceUuid - Indicates the UUID of the service to remove.
* @returns { boolean } Returns {@code true} if the service is removed; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#removeService
*/
removeService(serviceUuid: string): boolean;
/**
* Closes this {@code GattServer} object and unregisters its callbacks.
*
* @permission ohos.permission.USE_BLUETOOTH
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#close
*/
close(): void;
/**
* Sends a notification of a change in a specified local characteristic.
* <p>This method should be called for every BLE peripheral device that has requested notifications.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { string } deviceId - Indicates the address of the BLE peripheral device to receive the notification.
* @param { NotifyCharacteristic } notifyCharacteristic - Indicates the local characteristic that has changed.
* @returns { boolean } Returns {@code true} if the notification is sent successfully; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#notifyCharacteristicChanged
*/
notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): boolean;
/**
* Sends a response to a specified read or write request to a given BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { ServerResponse } serverResponse - Indicates the response parameters {@link ServerResponse}.
* @returns { boolean } Returns {@code true} if the response is sent successfully; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer#sendResponse
*/
sendResponse(serverResponse: ServerResponse): boolean;
/**
* Subscribe characteristic read event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'characteristicRead' } type - Type of the characteristic read event to listen for.
* @param { Callback<CharacteristicReadReq> } callback - Callback used to listen for the characteristic read event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.on#event:characteristicRead
*/
on(type: 'characteristicRead', callback: Callback<CharacteristicReadReq>): void;
/**
* Unsubscribe characteristic read event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'characteristicRead' } type - Type of the characteristic read event to listen for.
* @param { Callback<CharacteristicReadReq> } callback - Callback used to listen for the characteristic read event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.off#event:characteristicRead
*/
off(type: 'characteristicRead', callback?: Callback<CharacteristicReadReq>): void;
/**
* Subscribe characteristic write event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for.
* @param { Callback<CharacteristicWriteReq> } callback - Callback used to listen for the characteristic write event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.on#event:characteristicWrite
*/
on(type: 'characteristicWrite', callback: Callback<CharacteristicWriteReq>): void;
/**
* Unsubscribe characteristic write event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'characteristicWrite' } type - Type of the characteristic write event to listen for.
* @param { Callback<CharacteristicWriteReq> } callback - Callback used to listen for the characteristic write event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.off#event:characteristicWrite
*/
off(type: 'characteristicWrite', callback?: Callback<CharacteristicWriteReq>): void;
/**
* Subscribe descriptor read event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'descriptorRead' } type - Type of the descriptor read event to listen for.
* @param { Callback<DescriptorReadReq> } callback - Callback used to listen for the descriptor read event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.on#event:descriptorRead
*/
on(type: 'descriptorRead', callback: Callback<DescriptorReadReq>): void;
/**
* Unsubscribe descriptor read event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'descriptorRead' } type - Type of the descriptor read event to listen for.
* @param { Callback<DescriptorReadReq> } callback - Callback used to listen for the descriptor read event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.off#event:descriptorRead
*/
off(type: 'descriptorRead', callback?: Callback<DescriptorReadReq>): void;
/**
* Subscribe descriptor write event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for.
* @param { Callback<DescriptorWriteReq> } callback - Callback used to listen for the descriptor write event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.on#event:descriptorWrite
*/
on(type: 'descriptorWrite', callback: Callback<DescriptorWriteReq>): void;
/**
* Unsubscribe descriptor write event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'descriptorWrite' } type - Type of the descriptor write event to listen for.
* @param { Callback<DescriptorWriteReq> } callback - Callback used to listen for the descriptor write event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.off#event:descriptorWrite
*/
off(type: 'descriptorWrite', callback?: Callback<DescriptorWriteReq>): void;
/**
* Subscribe server connection state changed event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'connectStateChange' } type - Type of the connection state changed event to listen for.
* @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.on#event:connectStateChange
*/
on(type: 'connectStateChange', callback: Callback<BLEConnectChangedState>): void;
/**
* Unsubscribe server connection state changed event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'connectStateChange' } type - Type of the connection state changed event to listen for.
* @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattServer.off#event:connectStateChange
*/
off(type: 'connectStateChange', callback?: Callback<BLEConnectChangedState>): void;
}
/**
* Manages GATT client. Before calling an Gatt client method, you must use {@link createGattClientDevice} to create an GattClientDevice instance.
*
* @typedef GattClientDevice
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice
*/
interface GattClientDevice {
/**
* Connects to a BLE peripheral device.
* <p>The 'BLEConnectionStateChange' event is subscribed to return the connection state.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { boolean } Returns {@code true} if the connection process starts; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#connect
*/
connect(): boolean;
/**
* Disconnects from or stops an ongoing connection to a BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { boolean } Returns {@code true} if the disconnection process starts; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#disconnect
*/
disconnect(): boolean;
/**
* Disables a BLE peripheral device.
* <p> This method unregisters the device and clears the registered callbacks and handles.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { boolean } Returns {@code true} if the the device is disabled; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#close
*/
close(): boolean;
/**
* Obtains the name of BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { AsyncCallback<string> } callback - Callback used to obtain the device name.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getDeviceName
*/
getDeviceName(callback: AsyncCallback<string>): void;
/**
* Obtains the name of BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { Promise<string> } Returns a string representation of the name if obtained;
* returns {@code null} if the name fails to be obtained or the name does not exist.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getDeviceName
*/
getDeviceName(): Promise<string>;
/**
* Starts discovering services.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { AsyncCallback<Array<GattService>> } callback - Callback used to catch the services.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getServices
*/
getServices(callback: AsyncCallback<Array<GattService>>): void;
/**
* Starts discovering services.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { Promise<Array<GattService>> } Returns the list of services {@link GattService} of the BLE peripheral device.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getServices
*/
getServices(): Promise<Array<GattService>>;
/**
* Reads the characteristic of a BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { BLECharacteristic } characteristic - Indicates the characteristic to read.
* @param { AsyncCallback<BLECharacteristic> } callback - Callback invoked to return the characteristic value read.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#readCharacteristicValue
*/
readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void;
/**
* Reads the characteristic of a BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { BLECharacteristic } characteristic - Indicates the characteristic to read.
* @returns { Promise<BLECharacteristic> } - Promise used to return the characteristic value read.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#readCharacteristicValue
*/
readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic>;
/**
* Reads the descriptor of a BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { BLEDescriptor } descriptor - Indicates the descriptor to read.
* @param { AsyncCallback<BLEDescriptor> } callback - Callback invoked to return the descriptor read.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#readDescriptorValue
*/
readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void;
/**
* Reads the descriptor of a BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { BLEDescriptor } descriptor - Indicates the descriptor to read.
* @returns { Promise<BLEDescriptor> } - Promise used to return the descriptor read.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#readDescriptorValue
*/
readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor>;
/**
* Writes the characteristic of a BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { BLECharacteristic } characteristic - Indicates the characteristic to write.
* @returns { boolean } Returns {@code true} if the characteristic is written successfully; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#writeCharacteristicValue
*/
writeCharacteristicValue(characteristic: BLECharacteristic): boolean;
/**
* Writes the descriptor of a BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { BLEDescriptor } descriptor - Indicates the descriptor to write.
* @returns { boolean } Returns {@code true} if the descriptor is written successfully; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#writeDescriptorValue
*/
writeDescriptorValue(descriptor: BLEDescriptor): boolean;
/**
* Get the RSSI value of this BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { AsyncCallback<number> } callback - Callback invoked to return the RSSI, in dBm.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getRssiValue
*/
getRssiValue(callback: AsyncCallback<number>): void;
/**
* Get the RSSI value of this BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @returns { Promise<number> } Returns the RSSI value.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#getRssiValue
*/
getRssiValue(): Promise<number>;
/**
* Set the mtu size of a BLE peripheral device.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { number } mtu - The maximum transmission unit.
* @returns { boolean } Returns {@code true} if the set mtu is successfully; returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#setBLEMtuSize
*/
setBLEMtuSize(mtu: number): boolean;
/**
* Enables or disables notification of a characteristic when value changed.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { BLECharacteristic } characteristic - BLE characteristic to listen for.
* @param { boolean } enable - Specifies whether to enable notification of the characteristic. The value {@code true} indicates
* that notification is enabled, and the value {@code false} indicates that notification is disabled.
* @returns { boolean } Returns {@code true} if notification of the characteristic is enabled or disabled;
* returns {@code false} otherwise.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice#setNotifyCharacteristicChanged
*/
setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): boolean;
/**
* Subscribe characteristic value changed event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for.
* @param { Callback<BLECharacteristic> } callback - Callback used to listen for the characteristic value changed event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice.on#event:BLECharacteristicChange
*/
on(type: 'BLECharacteristicChange', callback: Callback<BLECharacteristic>): void;
/**
* Unsubscribe characteristic value changed event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'BLECharacteristicChange' } type - Type of the characteristic value changed event to listen for.
* @param { Callback<BLECharacteristic> } callback - Callback used to listen for the characteristic value changed event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice.off#event:BLECharacteristicChange
*/
off(type: 'BLECharacteristicChange', callback?: Callback<BLECharacteristic>): void;
/**
* Subscribe client connection state changed event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for.
* @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice.on#event:BLEConnectionStateChange
*/
on(type: 'BLEConnectionStateChange', callback: Callback<BLEConnectChangedState>): void;
/**
* Unsubscribe client connection state changed event.
*
* @permission ohos.permission.USE_BLUETOOTH
* @param { 'BLEConnectionStateChange' } type - Type of the connection state changed event to listen for.
* @param { Callback<BLEConnectChangedState> } callback - Callback used to listen for the connection state changed event.
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattClientDevice.off#event:BLEConnectionStateChange
*/
off(type: 'BLEConnectionStateChange', callback?: Callback<BLEConnectChangedState>): void;
}
/**
* Describes the Gatt service.
*
* @typedef GattService
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.GattService
*/
interface GattService {
/**
* The UUID of a GattService instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuid: string;
/**
* Indicates whether the GattService instance is primary or secondary.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
isPrimary: boolean;
/**
* The {@link BLECharacteristic} list belongs to this GattService instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
characteristics: Array<BLECharacteristic>;
/**
* The list of GATT services contained in the service
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
includeServices?: Array<GattService>;
}
/**
* Describes the Gatt characteristic.
*
* @typedef BLECharacteristic
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLECharacteristic
*/
interface BLECharacteristic {
/**
* The UUID of the {@link GattService} instance to which the characteristic belongs
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuid: string;
/**
* The UUID of a BLECharacteristic instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
characteristicUuid: string;
/**
* The value of a BLECharacteristic instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
characteristicValue: ArrayBuffer;
/**
* The list of {@link BLEDescriptor} contained in the characteristic
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
descriptors: Array<BLEDescriptor>;
}
/**
* Describes the Gatt descriptor.
*
* @typedef BLEDescriptor
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLEDescriptor
*/
interface BLEDescriptor {
/**
* The UUID of the {@link GattService} instance to which the descriptor belongs
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuid: string;
/**
* The UUID of the {@link BLECharacteristic} instance to which the descriptor belongs
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
characteristicUuid: string;
/**
* The UUID of the BLEDescriptor instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
descriptorUuid: string;
/**
* The value of the BLEDescriptor instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
descriptorValue: ArrayBuffer;
}
/**
* Describes the value of the indication or notification sent by the Gatt server.
*
* @typedef NotifyCharacteristic
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.NotifyCharacteristic
*/
interface NotifyCharacteristic {
/**
* The UUID of the {@link GattService} instance to which the characteristic belongs
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuid: string;
/**
* The UUID of a NotifyCharacteristic instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
characteristicUuid: string;
/**
* The value of a NotifyCharacteristic instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
characteristicValue: ArrayBuffer;
/**
* Specifies whether to request confirmation from the BLE peripheral device (indication) or
* send a notification. Value {@code true} indicates the former and {@code false} indicates the latter.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
confirm: boolean;
}
/**
* Describes the parameters of the Gatt client's characteristic read request.
*
* @typedef CharacteristicReadReq
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.CharacteristicReadRequest
*/
interface CharacteristicReadReq {
/**
* Indicates the address of the client that initiates the read request
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
deviceId: string;
/**
* The Id of the read request
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
transId: number;
/**
* Indicates the byte offset of the start position for reading characteristic value
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
offset: number;
/**
* The UUID of a CharacteristicReadReq instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
characteristicUuid: string;
/**
* The UUID of the service to which the characteristic belongs
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuid: string;
}
/**
* Describes the parameters of the of the Gatt client's characteristic write request.
*
* @typedef CharacteristicWriteReq
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.CharacteristicWriteRequest
*/
interface CharacteristicWriteReq {
/**
* Indicates the address of the client that initiates the write request
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
deviceId: string;
/**
* The Id of the write request
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
transId: number;
/**
* Indicates the byte offset of the start position for writing characteristic value
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
offset: number;
/**
* Whether this request should be pending for later operation
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
isPrep: boolean;
/**
* Whether the remote client need a response
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
needRsp: boolean;
/**
* Indicates the value to be written
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
value: ArrayBuffer;
/**
* The UUID of a CharacteristicWriteReq instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
characteristicUuid: string;
/**
* The UUID of the service to which the characteristic belongs
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuid: string;
}
/**
* Describes the parameters of the Gatt client's descriptor read request.
*
* @typedef DescriptorReadReq
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.DescriptorReadRequest
*/
interface DescriptorReadReq {
/**
* Indicates the address of the client that initiates the read request
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
deviceId: string;
/**
* The Id of the read request
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
transId: number;
/**
* Indicates the byte offset of the start position for reading characteristic value
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
offset: number;
/**
* The UUID of a DescriptorReadReq instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
descriptorUuid: string;
/**
* The UUID of the characteristic to which the descriptor belongs
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
characteristicUuid: string;
/**
* The UUID of the service to which the descriptor belongs
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuid: string;
}
/**
* Describes the parameters of the Gatt client's characteristic write request.
*
* @typedef DescriptorWriteReq
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.DescriptorWriteRequest
*/
interface DescriptorWriteReq {
/**
* Indicates the address of the client that initiates the write request
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
deviceId: string;
/**
* The Id of the write request
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
transId: number;
/**
* Indicates the byte offset of the start position for writing characteristic value
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
offset: number;
/**
* Whether this request should be pending for later operation
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
isPrep: boolean;
/**
* Whether the remote client need a response
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
needRsp: boolean;
/**
* Indicates the value to be written
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
value: ArrayBuffer;
/**
* The UUID of a DescriptorWriteReq instance
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
descriptorUuid: string;
/**
* The UUID of the characteristic to which the descriptor belongs
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
characteristicUuid: string;
/**
* The UUID of the service to which the descriptor belongs
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuid: string;
}
/**
* Describes the parameters of a response send by the server to a specified read or write request.
*
* @typedef ServerResponse
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.ServerResponse
*/
interface ServerResponse {
/**
* Indicates the address of the client to which to send the response
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
deviceId: string;
/**
* The Id of the write request
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
transId: number;
/**
* Indicates the status of the read or write request, set this parameter to '0' in normal cases
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
status: number;
/**
* Indicates the byte offset of the start position for reading or writing operation
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
offset: number;
/**
* Indicates the value to be sent
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
value: ArrayBuffer;
}
/**
* Describes the Gatt profile connection state.
*
* @typedef BLEConnectChangedState
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BLEConnectChangedState
*/
interface BLEConnectChangedState {
/**
* Indicates the peer device address
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
deviceId: string;
/**
* Connection state of the Gatt profile
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
state: ProfileConnectionState;
}
/**
* Describes the contents of the scan results.
*
* @typedef ScanResult
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.ScanResult
*/
interface ScanResult {
/**
* Address of the scanned device
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
deviceId: string;
/**
* RSSI of the remote device
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
rssi: number;
/**
* The raw data of broadcast packet
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
data: ArrayBuffer;
}
/**
* Describes the settings for BLE advertising.
*
* @typedef AdvertiseSetting
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.AdvertiseSetting
*/
interface AdvertiseSetting {
/**
* Minimum slot value for the advertising interval, which is {@code 32} (20 ms)
* Maximum slot value for the advertising interval, which is {@code 16777215} (10485.759375s)
* Default slot value for the advertising interval, which is {@code 1600} (1s)
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
interval?: number;
/**
* Minimum transmission power level for advertising, which is {@code -127}
* Maximum transmission power level for advertising, which is {@code 1}
* Default transmission power level for advertising, which is {@code -7}
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
txPower?: number;
/**
* Indicates whether the BLE is connectable, default is {@code true}
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
connectable?: boolean;
}
/**
* Describes the advertising data.
*
* @typedef AdvertiseData
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.AdvertiseData
*/
interface AdvertiseData {
/**
* The specified service UUID list to this advertisement
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuids: Array<string>;
/**
* The specified manufacturer data list to this advertisement
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
manufactureData: Array<ManufactureData>;
/**
* The specified service data list to this advertisement
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceData: Array<ServiceData>;
}
/**
* Describes the manufacturer data.
*
* @typedef ManufactureData
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.ManufactureData
*/
interface ManufactureData {
/**
* Indicates the manufacturer ID assigned by Bluetooth SIG
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
manufactureId: number;
/**
* Indicates the manufacturer data to add
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
manufactureValue: ArrayBuffer;
}
/**
* Describes the service data.
*
* @typedef ServiceData
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.ServiceData
*/
interface ServiceData {
/**
* Indicates the UUID of the service data to add
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuid: string;
/**
* Indicates the service data to add
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceValue: ArrayBuffer;
}
/**
* Describes the criteria for filtering scanning results can be set.
*
* @typedef ScanFilter
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.ScanFilter
*/
interface ScanFilter {
/**
* The address of a BLE peripheral device
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
deviceId?: string;
/**
* The name of a BLE peripheral device
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
name?: string;
/**
* The service UUID of a BLE peripheral device
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
serviceUuid?: string;
}
/**
* Describes the parameters for scan.
*
* @typedef ScanOptions
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.ScanOptions
*/
interface ScanOptions {
/**
* Time of delay for reporting the scan result
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
interval?: number;
/**
* Bluetooth LE scan mode
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
dutyMode?: ScanDuty;
/**
* Match mode for Bluetooth LE scan filters hardware match
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
matchMode?: MatchMode;
}
/**
* Describes the spp parameters.
*
* @typedef SppOption
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.SppOption
*/
interface SppOption {
/**
* Indicates the UUID in the SDP record.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
uuid: string;
/**
* Indicates secure channel or not
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
secure: boolean;
/**
* Spp link type {@link SppType}
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
type: SppType;
}
/**
* Describes the bond key param.
*
* @typedef PinRequiredParam
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.PinRequiredParam
*/
interface PinRequiredParam {
/**
* ID of the device to pair.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
deviceId: string;
/**
* Key for the device pairing.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
pinCode: string;
}
/**
* Describes the class of a bluetooth device.
*
* @typedef DeviceClass
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.DeviceClass
*/
interface DeviceClass {
/**
* Major classes of Bluetooth devices.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
majorClass: MajorClass;
/**
* Major and minor classes of Bluetooth devices.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
majorMinorClass: MajorMinorClass;
/**
* Class of the device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
classOfDevice: number;
}
/**
* Describes the class of a bluetooth device.
*
* @typedef BondStateParam
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BondStateParam
*/
interface BondStateParam {
/**
* Address of a Bluetooth device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
deviceId: string;
/**
* Profile connection state of the device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
state: BondState;
}
/**
* The enum of scan duty.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.ScanDuty
*/
enum ScanDuty {
/**
* low power mode
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
SCAN_MODE_LOW_POWER = 0,
/**
* balanced power mode
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
SCAN_MODE_BALANCED = 1,
/**
* Scan using highest duty cycle
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
SCAN_MODE_LOW_LATENCY = 2
}
/**
* The enum of BLE match mode.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.MatchMode
*/
enum MatchMode {
/**
* aggressive mode
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
MATCH_MODE_AGGRESSIVE = 1,
/**
* sticky mode
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
MATCH_MODE_STICKY = 2
}
/**
* The enum of profile connection state.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.ProfileConnectionState
*/
enum ProfileConnectionState {
/**
* the current profile is disconnected
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_DISCONNECTED = 0,
/**
* the current profile is being connected
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_CONNECTING = 1,
/**
* the current profile is connected
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_CONNECTED = 2,
/**
* the current profile is being disconnected
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_DISCONNECTING = 3
}
/**
* The enum of bluetooth state.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BluetoothState
*/
enum BluetoothState {
/**
* Indicates the local Bluetooth is off
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_OFF = 0,
/**
* Indicates the local Bluetooth is turning on
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_TURNING_ON = 1,
/**
* Indicates the local Bluetooth is on, and ready for use
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_ON = 2,
/**
* Indicates the local Bluetooth is turning off
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_TURNING_OFF = 3,
/**
* Indicates the local Bluetooth is turning LE mode on
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_BLE_TURNING_ON = 4,
/**
* Indicates the local Bluetooth is in LE only mode
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_BLE_ON = 5,
/**
* Indicates the local Bluetooth is turning off LE only mode
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
*/
STATE_BLE_TURNING_OFF = 6
}
/**
* The enum of SPP type.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.SppType
*/
enum SppType {
/**
* RFCOMM
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
SPP_RFCOMM
}
/**
* The enum of BR scan mode.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.ScanMode
*/
enum ScanMode {
/**
* Indicates the scan mode is none
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
SCAN_MODE_NONE = 0,
/**
* Indicates the scan mode is connectable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
SCAN_MODE_CONNECTABLE = 1,
/**
* Indicates the scan mode is general discoverable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
SCAN_MODE_GENERAL_DISCOVERABLE = 2,
/**
* Indicates the scan mode is limited discoverable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
SCAN_MODE_LIMITED_DISCOVERABLE = 3,
/**
* Indicates the scan mode is connectable and general discoverable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4,
/**
* Indicates the scan mode is connectable and limited discoverable
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5
}
/**
* The enum of bond state.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.BondState
*/
enum BondState {
/**
* Indicate the bond state is invalid
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
BOND_STATE_INVALID = 0,
/**
* Indicate the bond state is bonding
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
BOND_STATE_BONDING = 1,
/**
* Indicate the bond state is bonded
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
BOND_STATE_BONDED = 2
}
/**
* The enum of major class of a bluetooth device.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.MajorClass
*/
enum MajorClass {
/**
* Miscellaneous device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_MISC = 0x0000,
/**
* Computer.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_COMPUTER = 0x0100,
/**
* Mobile phone.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_PHONE = 0x0200,
/**
* Network device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_NETWORKING = 0x0300,
/**
* Audio or video device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_AUDIO_VIDEO = 0x0400,
/**
* Peripheral device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_PERIPHERAL = 0x0500,
/**
* Imaging device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_IMAGING = 0x0600,
/**
* Wearable device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_WEARABLE = 0x0700,
/**
* Toy.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_TOY = 0x0800,
/**
* Health device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_HEALTH = 0x0900,
/**
* Unclassified device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
MAJOR_UNCATEGORIZED = 0x1F00
}
/**
* The enum of major minor class of a bluetooth device.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.MajorMinorClass
*/
enum MajorMinorClass {
/**
* The Minor Device Class field
* Computer Major Class
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
COMPUTER_UNCATEGORIZED = 0x0100,
/**
* Desktop computer.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
COMPUTER_DESKTOP = 0x0104,
/**
* Server.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
COMPUTER_SERVER = 0x0108,
/**
* Laptop.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
COMPUTER_LAPTOP = 0x010C,
/**
* Hand-held computer.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
COMPUTER_HANDHELD_PC_PDA = 0x0110,
/**
* Palmtop computer.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
COMPUTER_PALM_SIZE_PC_PDA = 0x0114,
/**
* Wearable computer.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
COMPUTER_WEARABLE = 0x0118,
/**
* Tablet.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
COMPUTER_TABLET = 0x011C,
/**
* Phone Major Class
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PHONE_UNCATEGORIZED = 0x0200,
/**
* Portable phone.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PHONE_CELLULAR = 0x0204,
/**
* Cordless phone.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PHONE_CORDLESS = 0x0208,
/**
* Smartphone.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PHONE_SMART = 0x020C,
/**
* Modem or gateway phone.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PHONE_MODEM_OR_GATEWAY = 0x0210,
/**
* ISDN phone.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PHONE_ISDN = 0x0214,
/**
* LAN/Network Access Point Major Class
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
NETWORK_FULLY_AVAILABLE = 0x0300,
/**
* Device used on network 1 to 17.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
NETWORK_1_TO_17_UTILIZED = 0x0320,
/**
* Device used on network 17 to 33.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
NETWORK_17_TO_33_UTILIZED = 0x0340,
/**
* Device used on network 33 to 50.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
NETWORK_33_TO_50_UTILIZED = 0x0360,
/**
* Device used on network 60 to 67.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
NETWORK_60_TO_67_UTILIZED = 0x0380,
/**
* Device used on network 67 to 83.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
NETWORK_67_TO_83_UTILIZED = 0x03A0,
/**
* Device used on network 83 to 99.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
NETWORK_83_TO_99_UTILIZED = 0x03C0,
/**
* Device without network service.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
NETWORK_NO_SERVICE = 0x03E0,
/**
* Unclassified audio or video device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_UNCATEGORIZED = 0x0400,
/**
* Wearable audio or video headset.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_WEARABLE_HEADSET = 0x0404,
/**
* Hands-free audio or video device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_HANDSFREE = 0x0408,
/**
* Audio or video microphone.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_MICROPHONE = 0x0410,
/**
* Audio or video loudspeaker.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_LOUDSPEAKER = 0x0414,
/**
* Audio or video headphones.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_HEADPHONES = 0x0418,
/**
* Portable audio or video device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_PORTABLE_AUDIO = 0x041C,
/**
* In-vehicle audio or video device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_CAR_AUDIO = 0x0420,
/**
* Audio or video STB device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_SET_TOP_BOX = 0x0424,
/**
* High-fidelity speaker device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_HIFI_AUDIO = 0x0428,
/**
* Video cassette recording (VCR) device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_VCR = 0x042C,
/**
* Camera.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_VIDEO_CAMERA = 0x0430,
/**
* Camcorder.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_CAMCORDER = 0x0434,
/**
* Audio or video monitor.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_VIDEO_MONITOR = 0x0438,
/**
* Video display or loudspeaker.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 0x043C,
/**
* Video conferencing device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_VIDEO_CONFERENCING = 0x0440,
/**
* Audio or video gaming toy.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
AUDIO_VIDEO_VIDEO_GAMING_TOY = 0x0448,
/**
* Peripheral Major Class
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_NON_KEYBOARD_NON_POINTING = 0x0500,
/**
* Keyboard device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_KEYBOARD = 0x0540,
/**
* Pointing peripheral device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_POINTING_DEVICE = 0x0580,
/**
* Keyboard pointing device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_KEYBOARD_POINTING = 0x05C0,
/**
* Unclassified peripheral device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_UNCATEGORIZED = 0x0500,
/**
* Peripheral joystick.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_JOYSTICK = 0x0504,
/**
* Peripheral game pad.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_GAMEPAD = 0x0508,
/**
* Peripheral remote control device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_REMOTE_CONTROL = 0x05C0,
/**
* Peripheral sensing device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_SENSING_DEVICE = 0x0510,
/**
* Peripheral digitizer tablet.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_DIGITIZER_TABLET = 0x0514,
/**
* Peripheral card reader.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_CARD_READER = 0x0518,
/**
* Peripheral digital pen.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_DIGITAL_PEN = 0x051C,
/**
* Peripheral RFID scanner.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_SCANNER_RFID = 0x0520,
/**
* Gesture input device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PERIPHERAL_GESTURAL_INPUT = 0x0522,
/**
* Imaging Major Class
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
IMAGING_UNCATEGORIZED = 0x0600,
/**
* Imaging display device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
IMAGING_DISPLAY = 0x0610,
/**
* Imaging camera device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
IMAGING_CAMERA = 0x0620,
/**
* Imaging scanner.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
IMAGING_SCANNER = 0x0640,
/**
* Imaging printer.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
IMAGING_PRINTER = 0x0680,
/**
* Wearable Major Class
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
WEARABLE_UNCATEGORIZED = 0x0700,
/**
* Smart watch.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
WEARABLE_WRIST_WATCH = 0x0704,
/**
* Wearable pager.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
WEARABLE_PAGER = 0x0708,
/**
* Smart jacket.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
WEARABLE_JACKET = 0x070C,
/**
* Wearable helmet.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
WEARABLE_HELMET = 0x0710,
/**
* Wearable glasses.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
WEARABLE_GLASSES = 0x0714,
/**
* Minor Device Class field - Toy Major Class
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
TOY_UNCATEGORIZED = 0x0800,
/**
* Toy robot.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
TOY_ROBOT = 0x0804,
/**
* Toy vehicle.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
TOY_VEHICLE = 0x0808,
/**
* Humanoid toy doll.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
TOY_DOLL_ACTION_FIGURE = 0x080C,
/**
* Toy controller.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
TOY_CONTROLLER = 0x0810,
/**
* Toy gaming device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
TOY_GAME = 0x0814,
/**
* Minor Device Class field - Health
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_UNCATEGORIZED = 0x0900,
/**
* Blood pressure device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_BLOOD_PRESSURE = 0x0904,
/**
* Thermometer.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_THERMOMETER = 0x0908,
/**
* Body scale.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_WEIGHING = 0x090C,
/**
* Blood glucose monitor.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_GLUCOSE = 0x0910,
/**
* Pulse oximeter.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_PULSE_OXIMETER = 0x0914,
/**
* Heart rate monitor.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_PULSE_RATE = 0x0918,
/**
* Health data display.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_DATA_DISPLAY = 0x091C,
/**
* Step counter.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_STEP_COUNTER = 0x0920,
/**
* Body composition analyzer.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_BODY_COMPOSITION_ANALYZER = 0x0924,
/**
* Hygrometer.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_PEAK_FLOW_MOITOR = 0x0928,
/**
* Medication monitor.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_MEDICATION_MONITOR = 0x092C,
/**
* Prosthetic knee.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_KNEE_PROSTHESIS = 0x0930,
/**
* Prosthetic ankle.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_ANKLE_PROSTHESIS = 0x0934,
/**
* Generic health management device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_GENERIC_HEALTH_MANAGER = 0x0938,
/**
* Personal mobility device.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
HEALTH_PERSONAL_MOBILITY_DEVICE = 0x093C
}
/**
* Profile state change parameters.
*
* @typedef StateChangeParam
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.StateChangeParam
*/
interface StateChangeParam {
/**
* The address of device
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
deviceId: string;
/**
* Profile state value
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
state: ProfileConnectionState;
}
/**
* The enum of a2dp playing state.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.PlayingState
*/
enum PlayingState {
/**
* Not playing.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
STATE_NOT_PLAYING,
/**
* Playing.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
STATE_PLAYING
}
/**
* The enum of profile id.
*
* @enum { number }
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 7
* @deprecated since 9
* @useinstead ohos.bluetoothManager/bluetoothManager.ProfileId
*/
enum ProfileId {
/**
* A2DP profile.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PROFILE_A2DP_SOURCE = 1,
/**
* HFP profile.
*
* @syscap SystemCapability.Communication.Bluetooth.Core
* @since 8
* @deprecated since 9
*/
PROFILE_HANDS_FREE_AUDIO_GATEWAY = 4
}
}
export default bluetooth;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lffl8796/interface_sdk-js.git
git@gitee.com:lffl8796/interface_sdk-js.git
lffl8796
interface_sdk-js
interface_sdk-js
master

搜索帮助