1 /*
2  * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup Bluetooth
18  * @{
19  *
20  * @brief Defines bluetooth host, including observer and common functions.
21  *
22  * @since 6
23  */
24 
25 /**
26  * @file bluetooth_host.h
27  *
28  * @brief Framework bluetooth host interface.
29  *
30  * @since 6
31  */
32 
33 #ifndef BLUETOOTH_HOST_H
34 #define BLUETOOTH_HOST_H
35 
36 #include <string>
37 
38 #include "bluetooth_battery_info.h"
39 #include "bluetooth_def.h"
40 #include "bluetooth_types.h"
41 #include "bluetooth_remote_device.h"
42 #include "bluetooth_device_class.h"
43 #include "refbase.h"
44 #include "bluetooth_no_destructor.h"
45 
46 namespace OHOS { class IRemoteObject; }
47 namespace OHOS {
48 namespace Bluetooth {
49 /**
50  * @brief Represents framework host device basic observer.
51  *
52  * @since 6
53  */
54 class BluetoothHostObserver {
55 public:
56     /**
57      * @brief A destructor used to delete the <b>BluetoothHostObserver</b> instance.
58      *
59      * @since 6
60      */
61     virtual ~BluetoothHostObserver() = default;
62 
63     // common
64     /**
65      * @brief Adapter state change function.
66      *
67      * @param transport Transport type when state change.
68      *        BTTransport::ADAPTER_BREDR : classic;
69      *        BTTransport::ADAPTER_BLE : ble.
70      * @param state Change to the new state.
71      *        BTStateID::STATE_TURNING_ON;
72      *        BTStateID::STATE_TURN_ON;
73      *        BTStateID::STATE_TURNING_OFF;
74      *        BTStateID::STATE_TURN_OFF.
75      * @since 6
76      */
77     virtual void OnStateChanged(const int transport, const int status) = 0;
78 
79     // gap
80     /**
81      * @brief Discovery state changed observer.
82      *
83      * @param status Device discovery status.
84      * @since 6
85      */
86     virtual void OnDiscoveryStateChanged(int status) = 0;
87 
88     /**
89      * @brief Discovery result observer.
90      *
91      * @param device Remote device.
92      * @param rssi Rssi of device.
93      * @param deviceName Name of device.
94      * @param deviceClass Class of device.
95      * @since 6
96      */
97     virtual void OnDiscoveryResult(
98         const BluetoothRemoteDevice &device, int rssi, const std::string deviceName, int deviceClass) = 0;
99 
100     /**
101      * @brief Pair request observer.
102      *
103      * @param device Remote device.
104      * @since 6
105      */
106     virtual void OnPairRequested(const BluetoothRemoteDevice &device) = 0;
107 
108     /**
109      * @brief Pair confirmed observer.
110      *
111      * @param device Remote device.
112      * @param reqType Pair type.
113      * @param number Paired passkey.
114      * @since 6
115      */
116     virtual void OnPairConfirmed(const BluetoothRemoteDevice &device, int reqType, int number) = 0;
117 
118     /**
119      * @brief Scan mode changed observer.
120      *
121      * @param mode Device scan mode.
122      * @since 6
123      */
124     virtual void OnScanModeChanged(int mode) = 0;
125 
126     /**
127      * @brief Device name changed observer.
128      *
129      * @param deviceName Device name.
130      * @since 6
131      */
132     virtual void OnDeviceNameChanged(const std::string &deviceName) = 0;
133 
134     /**
135      * @brief Device address changed observer.
136      *
137      * @param address Device address.
138      * @since 6
139      */
140     virtual void OnDeviceAddrChanged(const std::string &address) = 0;
141 };
142 
143 /**
144  * @brief Represents remote device observer.
145  *
146  * @since 6
147  */
148 class BluetoothRemoteDeviceObserver {
149 public:
150     /**
151      * @brief A destructor used to delete the <b>BluetoothRemoteDeviceObserver</b> instance.
152      *
153      * @since 6
154      */
155     virtual ~BluetoothRemoteDeviceObserver() = default;
156 
157     /**
158      * @brief Acl state changed observer.
159      *
160      * @param device Remote device.
161      * @param state Remote device acl state.
162      * @param reason Remote device reason.
163      * @since 6
164      */
165     virtual void OnAclStateChanged(const BluetoothRemoteDevice &device, int state, unsigned int reason) = 0;
166 
167     /**
168      * @brief Pair status changed observer.
169      *
170      * @param device Remote device.
171      * @param status Remote device pair status.
172      * @param cause Pair fail cause.
173      * @since 12
174      */
175     virtual void OnPairStatusChanged(const BluetoothRemoteDevice &device, int status, int cause) = 0;
176 
177     /**
178      * @brief Remote uuid changed observer.
179      *
180      * @param device Remote device.
181      * @param uuids Remote device uuids.
182      * @since 6
183      */
184     virtual void OnRemoteUuidChanged(const BluetoothRemoteDevice &device, const std::vector<ParcelUuid> &uuids) = 0;
185 
186     /**
187      * @brief Remote name changed observer.
188      *
189      * @param device Remote device.
190      * @param deviceName Remote device name.
191      * @since 6
192      */
193     virtual void OnRemoteNameChanged(const BluetoothRemoteDevice &device, const std::string &deviceName) = 0;
194 
195     /**
196      * @brief Remote alias changed observer.
197      *
198      * @param device Remote device.
199      * @param alias Remote device alias.
200      * @since 6
201      */
202     virtual void OnRemoteAliasChanged(const BluetoothRemoteDevice &device, const std::string &alias) = 0;
203 
204     /**
205      * @brief Remote cod changed observer.
206      *
207      * @param device Remote device.
208      * @param cod Remote device cod.
209      * @since 6
210      */
211     virtual void OnRemoteCodChanged(const BluetoothRemoteDevice &device, const BluetoothDeviceClass &cod) = 0;
212 
213     /**
214      * @brief Remote battery level changed observer.
215      *
216      * @param device Remote device.
217      * @param cod Remote device battery Level.
218      * @since 6
219      */
220     virtual void OnRemoteBatteryLevelChanged(const BluetoothRemoteDevice &device, int batteryLevel) = 0;
221 
222     /**
223      * @brief Remote rssi event observer.
224      *
225      * @param device Remote device.
226      * @param rssi Remote device rssi.
227      * @param status Read status.
228      * @since 6
229      */
230     virtual void OnReadRemoteRssiEvent(const BluetoothRemoteDevice &device, int rssi, int status) = 0;
231 
232     /**
233      * @brief Remote device battery info observer.
234      *
235      * @param device Remote device.
236      * @param batteryInfo Remote device batteryInfo
237      * @since 12
238      */
OnRemoteBatteryChanged(const BluetoothRemoteDevice & device,const DeviceBatteryInfo & batteryInfo)239     virtual void OnRemoteBatteryChanged(const BluetoothRemoteDevice &device, const DeviceBatteryInfo &batteryInfo)
240     {};
241 
242     /**
243      * @brief Remote device common value observer.
244      *
245      * @param device Remote device.
246      * @param value Remote device report info
247      * @since 12
248      */
OnRemoteDeviceCommonInfoReport(const BluetoothRemoteDevice & device,const std::vector<uint8_t> & value)249     virtual void OnRemoteDeviceCommonInfoReport(const BluetoothRemoteDevice &device, const std::vector<uint8_t> &value)
250     {};
251 };
252 
253 /**
254  * @brief Represents bluetooth resource manager observer.
255  *
256  * @since 12
257  */
258 class BluetoothResourceManagerObserver {
259 public:
260     /**
261      * @brief A destructor used to delete the <b>BluetoothResourceManagerObserver</b> instance.
262      *
263      * @since 12
264      */
265     virtual ~BluetoothResourceManagerObserver() = default;
266 
267     /**
268      * @brief sensing state changed observer.
269      *
270      * @param eventId bluetooth resource manager event id.
271      * @param info bluetooth sensing information.
272      * @since 12
273      */
OnSensingStateChanged(uint8_t eventId,const SensingInfo & info)274     virtual void OnSensingStateChanged(uint8_t eventId, const SensingInfo &info)
275     {};
276 
277     /**
278      * @brief bluetooth resource decision observer.
279      *
280      * @param eventId bluetooth resource manager event id.
281      * @param info bluetooth sensing information.
282      * @param result bluetooth resource decision result.
283      * @since 12
284      */
OnBluetoothResourceDecision(uint8_t eventId,const SensingInfo & info,uint32_t & result)285     virtual void OnBluetoothResourceDecision(uint8_t eventId, const SensingInfo &info, uint32_t &result)
286     {};
287 };
288 
289 /**
290  * @brief Represents framework host device.
291  *
292  * @since 6
293  */
294 class BLUETOOTH_API BluetoothHost {
295 public:
296     // common
297     /**
298      * @brief Get default host device.
299      *
300      * @return Returns the singleton instance.
301      * @since 6
302      */
303     static BluetoothHost &GetDefaultHost();
304 
305     /**
306      * @brief Get remote device instance.
307      *
308      * @param addr Remote device address.
309      * @param transport Adapter transport.
310      * @return Returns remote device instance.
311      * @since 6
312      */
313     BluetoothRemoteDevice GetRemoteDevice(const std::string &addr, int transport) const;
314 
315     /**
316      * @brief Register observer.
317      *
318      * @param observer Class BluetoothHostObserver pointer to register observer.
319      * @since 6
320      */
321     void RegisterObserver(std::shared_ptr<BluetoothHostObserver> observer);
322 
323     /**
324      * @brief Deregister observer.
325      *
326      * @param observer Class BluetoothHostObserver pointer to deregister observer.
327      * @since 6
328      */
329     void DeregisterObserver(std::shared_ptr<BluetoothHostObserver> observer);
330 
331     /**
332      * @brief Enable classic.
333      *
334      * @return Returns <b>true</b> if the operation is accepted;
335      *         returns <b>false</b> if the operation is rejected.
336      * @since 6
337      */
338     int EnableBt();
339 
340     /**
341      * @brief Disable classic.
342      *
343      * @return Returns <b>true</b> if the operation is accepted;
344      *         returns <b>false</b> if the operation is rejected.
345      * @since 6
346      */
347     int DisableBt();
348 
349     /**
350      * @brief Get classic enable/disable state.
351      *
352      * @return Returns classic enable/disable state.
353      *         BTStateID::STATE_TURNING_ON;
354      *         BTStateID::STATE_TURN_ON;
355      *         BTStateID::STATE_TURNING_OFF;
356      *         BTStateID::STATE_TURN_OFF.
357      * @since 6
358      * @deprecated since 14
359      * @useinstead BluetoothHost#GetBluetoothState
360      */
361     int GetBtState() const;
362 
363     /**
364      * @brief Get classic enable/disable state.
365      *
366      * @param Returns classic enable/disable state.
367      *         BTStateID::STATE_TURNING_ON;
368      *         BTStateID::STATE_TURN_ON;
369      *         BTStateID::STATE_TURNING_OFF;
370      *         BTStateID::STATE_TURN_OFF.
371      * @since 6
372      * @deprecated since 14
373      * @useinstead BluetoothHost#GetBluetoothState
374      */
375     int GetBtState(int &state) const;
376 
377     /**
378      * @brief Get the current state of the local Bluetooth adapter.
379      *
380      * @return current state of Bluetooth adapter.
381      *         BluetoothState::STATE_TURN_OFF.
382      *         BluetoothState::STATE_TURNING_ON;
383      *         BluetoothState::STATE_TURN_ON;
384      *         BluetoothState::STATE_TURNING_OFF;
385      *         BluetoothState::STATE_BLE_TURNING_ON;
386      *         BluetoothState::STATE_BLE_ON;
387      *         BluetoothState::STATE_BLE_TURNING_OFF;
388      * @since 14
389      */
390     BluetoothState GetBluetoothState(void) const;
391 
392     /**
393      * @brief Disable ble.
394      *
395      * @return Returns <b>true</b> if the operation is accepted;
396      *         returns <b>false</b> if the operation is rejected.
397      * @since 6
398      */
399     int DisableBle();
400 
401     /**
402      * @brief Enable ble.
403      *
404      * @return Returns <b>true</b> if the operation is accepted;
405      *         returns <b>false</b> if the operation is rejected.
406      * @since 6
407      */
408     int EnableBle();
409 
410     /**
411      * @brief Enable bluetooth to restrict mode.
412      *
413      * @return Returns BT_NO_ERROR if the operation is accepted;
414      *         returns others if the operation is rejected.
415      * @since 12
416      */
417     int EnableBluetoothToRestrictMode(void);
418 
419     /**
420      * @brief Get br/edr enable/disable state.
421      *
422      * @return Returns <b>true</b> if br is enabled;
423      *         returns <b>false</b> if br is not enabled.
424      * @since 6
425      */
426     bool IsBrEnabled() const;
427 
428     /**
429      * @brief Get ble enable/disable state.
430      *
431      * @return Returns <b>true</b> if ble is enabled;
432      *         returns <b>false</b> if ble is not enabled.
433      * @since 6
434      */
435     bool IsBleEnabled() const;
436 
437     /**
438      * @brief Factory reset bluetooth service.
439      *
440      * @return Returns <b>true</b> if the operation is successful;
441      *         returns <b>false</b> if the operation fails.
442      * @since 6
443      */
444     int BluetoothFactoryReset();
445 
446     /**
447      * @brief Get profile service ID list.
448      *
449      * @return Returns vector of enabled profile services ID.
450      * @since 6
451      */
452     std::vector<uint32_t> GetProfileList() const;
453 
454     /**
455      * @brief Get max audio connected devices number.
456      *
457      * @return Returns max device number that audio can connect.
458      * @since 6
459      */
460     int GetMaxNumConnectedAudioDevices() const;
461 
462     /**
463      * @brief Get bluetooth connects state.
464      *
465      * @return Returns bluetooth connects state.
466      *         BTConnectState::CONNECTING;
467      *         BTConnectState::CONNECTED;
468      *         BTConnectState::DISCONNECTING;
469      *         BTConnectState::DISCONNECTED.
470      * @since 6
471      */
472     int GetBtConnectionState() const;
473 
474     /**
475      * @brief Get bluetooth connects state.
476      *
477      * @return Returns bluetooth connects state.
478      *         BTConnectState::CONNECTING;
479      *         BTConnectState::CONNECTED;
480      *         BTConnectState::DISCONNECTING;
481      *         BTConnectState::DISCONNECTED.
482      * @since 6
483      */
484     int GetBtConnectionState(int &state) const;
485 
486     /**
487      * @brief Get profile service connect state.
488      *
489      * @param profileID Profile service ID.
490      * @return Returns connect state for designated profile service.
491      *         BTConnectState::CONNECTING;
492      *         BTConnectState::CONNECTED;
493      *         BTConnectState::DISCONNECTING;
494      *         BTConnectState::DISCONNECTED.
495      * @since 6
496      */
497     int GetBtProfileConnState(uint32_t profileId, int &state) const;
498 
499     /**
500      * @brief Get local device supported uuids.
501      *
502      * @param[out] Vector which use to return support uuids.
503      * @since 6
504      */
505     void GetLocalSupportedUuids(std::vector<ParcelUuid> &uuids);
506 
507     /**
508      * @brief Start adapter manager, passthrough only.
509      *
510      * @return Returns <b>true</b> if the operation is successful;
511      *         returns <b>false</b> if the operation fails.
512      * @since 6
513      */
514     bool Start();
515 
516     /**
517      * @brief Stop adapter manager, passthrough only.
518      *
519      * @since 6
520      */
521     void Stop();
522 
523     // gap
524     /**
525      * @brief Get local device class.
526      *
527      * @return Returns local device class.
528      * @since 6
529      */
530     BluetoothDeviceClass GetLocalDeviceClass() const;
531 
532     /**
533      * @brief Set local device class.
534      *
535      * @param deviceClass Device class.
536      * @return Returns <b>true</b> if the operation is successful;
537      *         returns <b>false</b> if the operation fails.
538      * @since 6
539      */
540     bool SetLocalDeviceClass(const BluetoothDeviceClass &deviceClass);
541 
542     /**
543      * @brief Get local device address.
544      *
545      * @param addr local address.
546      * @return Returns {@link BT_NO_ERROR} if the operation is successful;
547      *         returns an error code defined in {@link BtErrCode} otherwise.
548      * @since 6
549      */
550     int GetLocalAddress(std::string &addr) const;
551 
552     /**
553      * @brief Get local device name.
554      *
555      * @return Returns local device name.
556      * @since 6
557      */
558     std::string GetLocalName() const;
559 
560     /**
561      * @brief Get local device name.
562      *
563      * @return Returns local device name.
564      * @since 6
565      */
566     int GetLocalName(std::string &name) const;
567 
568     /**
569      * @brief Set local device name.
570      *
571      * @param name Device name.
572      * @return Returns <b>true</b> if the operation is successful;
573      *         returns <b>false</b> if the operation fails.
574      * @since 6
575      */
576     int SetLocalName(const std::string &name);
577 
578     /**
579      * @brief Get device scan mode.
580      *
581      * @return Returns bluetooth scan mode.
582      * @since 6
583      */
584     int GetBtScanMode(int32_t &scanMode) const;
585 
586     /**
587      * @brief Set device scan mode.
588      *
589      * @param mode Scan mode.
590      * @param duration Scan time.
591      * @return Returns <b>true</b> if the operation is successful;
592      *         returns <b>false</b> if the operation fails.
593      * @since 6
594      */
595     int SetBtScanMode(int mode, int duration);
596 
597     /**
598      * @brief Get local device bondable mode.
599      *
600      * @param transport Adapter transport.
601      * @return Returns local device bondable mode.
602      * @since 6
603      */
604     int GetBondableMode(int transport) const;
605 
606     /**
607      * @brief Set local device bondable mode.
608      *
609      * @param transport Adapter transport.
610      * @param mode Device bondable mode.
611      * @return Returns <b>true</b> if the operation is successful;
612      *         returns <b>false</b> if the operation fails.
613      * @since 6
614      */
615     bool SetBondableMode(int transport, int mode);
616 
617     /**
618      * @brief Get device address.
619      * @return Returns <b>true</b> if the operation is successful;
620      *         returns <b>false</b> if the operation fails.
621      * @since 6
622      */
623     int StartBtDiscovery();
624 
625     /**
626      * @brief Cancel device discovery.
627      *
628      * @return Returns <b>true</b> if the operation is successful;
629      *         returns <b>false</b> if the operation fails.
630      * @since 6
631      */
632     int CancelBtDiscovery();
633 
634     /**
635      * @brief Check if device is discovering.
636      *
637      * @return Returns <b>BT_NO_ERROR</b> if the operation is successful;
638      *         returns <b>false</b> if device is not discovering.
639      * @since 6
640      */
641     int IsBtDiscovering(bool &isDisCovering, int transport = BT_TRANSPORT_BREDR) const;
642 
643     /**
644      * @brief Get device discovery end time.
645      *
646      * @return Returns device discovery end time.
647      * @since 6
648      */
649     long GetBtDiscoveryEndMillis() const;
650 
651     /**
652      * @brief Get paired devices.
653      *
654      * @param transport Adapter transport.
655      * @return Returns paired devices vector.
656      * @since 6
657      */
658     int32_t GetPairedDevices(int transport, std::vector<BluetoothRemoteDevice> &pairedDevices) const;
659 
660     /**
661      * @brief Remove pair.
662      *
663      * @param device Remote device address.
664      * @return Returns <b>true</b> if the operation is successful;
665      *         returns <b>false</b> if the operation fails.
666      * @since 6
667      */
668     int32_t RemovePair(const BluetoothRemoteDevice &device);
669 
670     /**
671      * @brief Remove all pairs.
672      *
673      * @return Returns <b>true</b> if the operation is successful;
674      *         returns <b>false</b> if the operation fails.
675      * @since 6
676      */
677     bool RemoveAllPairs();
678 
679     /**
680      * @brief Check if bluetooth address is valid.
681      *
682      * @param addr Bluetooth address.
683      * @return Returns <b>true</b> if bluetooth address is valid;
684      *         returns <b>false</b> if bluetooth address is not valid.
685      * @since 6
686      */
687     static bool IsValidBluetoothAddr(const std::string &addr);
688 
689     /**
690      * @brief Register remote device observer.
691      *
692      * @param observer Class BluetoothRemoteDeviceObserver pointer to register observer.
693      * @return Returns <b>true</b> if the operation is successful;
694      *         returns <b>false</b> if the operation fails.
695      * @since 6
696      */
697     void RegisterRemoteDeviceObserver(std::shared_ptr<BluetoothRemoteDeviceObserver> observer);
698 
699     /**
700      * @brief Deregister remote device observer.
701      *
702      * @param observer Class BluetoothRemoteDeviceObserver pointer to deregister observer.
703      * @return Returns <b>true</b> if the operation is successful;
704      *         returns <b>false</b> if the operation fails.
705      * @since 6
706      */
707     void DeregisterRemoteDeviceObserver(std::shared_ptr<BluetoothRemoteDeviceObserver> observer);
708 
709     /**
710      * @brief Get max advertising data length.
711      *
712      * @return Returns max advertising data length.
713      * @since 6
714      */
715     int GetBleMaxAdvertisingDataLength() const;
716 
717     void LoadSystemAbilitySuccess(const sptr<IRemoteObject> &remoteObject);
718 
719     void LoadSystemAbilityFail();
720 
721     void OnRemoveBluetoothSystemAbility();
722 
723     /**
724      * @brief Get local profile uuids.
725      *
726      * @return Returns local profile uuids.
727      * @since 10
728      */
729     int32_t GetLocalProfileUuids(std::vector<std::string> &uuids);
730 
731     /**
732     * @brief Set fast scan enable or disable.
733     * @param isEnable set fast scan status flag.
734     * @return Returns <b>true</b> if the operation is successful;
735     *         returns <b>false</b> if the operation fails.
736     */
737     int SetFastScan(bool isEnable);
738 
739     /**
740     * @brief Get the random address of a device.
741     * If the address carried in the bluetooth interface is not obtained from the bluetooth,
742     * the interface needs to be used for address translation.
743     * @param realAddr real address.
744     * @param[out] randomAddr random address.
745     * @return Returns {@link BT_NO_ERROR} if get random address success;
746     * returns an error code defined in {@link BtErrCode} otherwise.
747     */
748     int GetRandomAddress(const std::string &realAddr, std::string &randomAddr) const;
749 
750     /**
751     * @brief Connects all allowed bluetooth profiles between the local and remote device.
752     *
753     * @param remoteAddr remote device addr.
754     * @return Returns {@link BT_NO_ERROR} if the operation is successful;
755     *         returns an error code defined in {@link BtErrCode} otherwise.
756     * @since 11
757     */
758     int ConnectAllowedProfiles(const std::string &remoteAddr) const;
759 
760     /**
761     * @brief Disconnects all allowed bluetooth profiles between the local and remote device.
762     *
763     * @param remoteAddr remote device addr.
764     * @return Returns {@link BT_NO_ERROR} if the operation is successful;
765     *         returns an error code defined in {@link BtErrCode} otherwise.
766     * @since 11
767     */
768     int DisconnectAllowedProfiles(const std::string &remoteAddr) const;
769 
770     /**
771     * @brief Restrict Bluetooth BR/EDR ability, just BLE ability available.
772     *
773     * @param remoteAddr remote device addr.
774     * @return Returns {@link BT_NO_ERROR} if the operation is successful;
775     *         returns an error code defined in {@link BtErrCode} otherwise.
776     * @since 12
777     */
778     int RestrictBluetooth();
779     /**
780     * @brief update virtual device
781     *
782     * @param action add or delete virtual device.
783     * @param device device need to be operator.
784     * @since 12
785     */
786     void UpdateVirtualDevice(int32_t action, const std::string &address);
787 
788     /**
789     * @brief Restrict Bluetooth BR/EDR ability, just BLE ability available.
790     *
791     * @param type satellite control type.
792     * @param state satellite state.
793     * @return Returns {@link BT_NO_ERROR} if the operation is successful;
794     *         returns an error code defined in {@link BtErrCode} otherwise.
795     * @since 12
796     */
797     int SatelliteControl(int type, int state);
798 
799     /**
800      * @brief Register bluetooth resource manager observer.
801      *
802      * @param observer Class RegisterBtResourceManagerObserver pointer to register observer.
803      * @since 12
804      */
805     void RegisterBtResourceManagerObserver(std::shared_ptr<BluetoothResourceManagerObserver> observer);
806 
807     /**
808      * @brief Deregister bluetooth resource manager observer.
809      *
810      * @param observer Class RegisterBtResourceManagerObserver pointer to deregister observer.
811      * @since 12
812      */
813     void DeregisterBtResourceManagerObserver(std::shared_ptr<BluetoothResourceManagerObserver> observer);
814 
815     /**
816      * @brief Set local adapter scan level.
817      *
818      * @param level Scan level.
819      * @return Returns <b>true</b> if the operation is successful;
820      *         returns <b>false</b> if the operation fails.
821      * @since 12
822      */
823     int SetFastScanLevel(int level);
824 
825     /**
826      * @brief Close the bluetooth host to release resources, only called before the process exits.
827      *
828      * @since 13
829      */
830     void Close(void);
831 private:
832     /**
833      * @brief A constructor used to create a <b>BluetoothHost</b> instance.
834      *
835      * @since 6
836      */
837     BluetoothHost();
838 
839     /**
840      * @brief A destructor used to delete the <b>BluetoothHost</b> instance.
841      *
842      * @since 6
843      */
844     ~BluetoothHost();
845 
846     /**
847     * @brief Check whether bluetooth is prohibited by EDM.
848     *
849     * @return Returns <b>true</b> if bluetooth is prohibited, returns <b>false</b> otherwise.
850     * @since 11
851     */
852     bool IsBtProhibitedByEdm(void);
853 
854     BLUETOOTH_DISALLOW_COPY_AND_ASSIGN(BluetoothHost);
855     BLUETOOTH_DECLARE_IMPL();
856 
857 #ifdef DTFUZZ_TEST
858     friend class BluetoothNoDestructor<BluetoothHost>;
859 #endif
860 };
861 } // namespace Bluetooth
862 } // namespace OHOS
863 
864 #endif  // BLUETOOTH_HOST_H
865