• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024-2024 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 #ifndef TELEPHONY_DISTRIBUTED_COMMUNICATION_DEVICE_SWITCH_CONTROLLER_H
17 #define TELEPHONY_DISTRIBUTED_COMMUNICATION_DEVICE_SWITCH_CONTROLLER_H
18 
19 #include "ffrt.h"
20 #include "i_distributed_device_state_callback.h"
21 
22 namespace OHOS {
23 namespace Telephony {
24 constexpr int32_t DEFAULT_HFP_FLAG_VALUE = -1;
25 constexpr int32_t WEAR_ACTION = 0;
26 constexpr int32_t UNWEAR_ACTION = 1;
27 constexpr int32_t ENABLE_FROM_REMOTE_ACTION = 2;
28 constexpr int32_t DISABLE_FROM_REMOTE_ACTION = 3;
29 constexpr int32_t USER_SELECTION_ACTION = 6;
30 
31 class DistributedDeviceSwitchController : public IDistributedDeviceStateCallback {
32 public:
33     DistributedDeviceSwitchController() = default;
34     virtual ~DistributedDeviceSwitchController() = default;
35 
SwitchDevice(const std::string & devId,int32_t direction)36     virtual bool SwitchDevice(const std::string &devId, int32_t direction)
37     {
38         return false;
39     }
40 
IsAudioOnSink()41     virtual bool IsAudioOnSink()
42     {
43         std::lock_guard<ffrt::mutex> lock(mutex_);
44         return isAudioOnSink_;
45     }
46 
47 protected:
48     ffrt::mutex mutex_{};
49     bool isAudioOnSink_{false};
50 };
51 } // namespace Telephony
52 } // namespace OHOS
53 
54 #endif // TELEPHONY_DISTRIBUTED_COMMUNICATION_DEVICE_SWITCH_CONTROLLER_H
55