1 /* 2 * Copyright (C) 2021 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 TELEPHONE_CLIENT_SERVICE_H 17 #define TELEPHONE_CLIENT_SERVICE_H 18 19 #include <list> 20 #include <string> 21 #include <memory> 22 #include <mutex> 23 24 namespace stub { 25 static const int HFP_STUB_VOLUME_TYPE_SPEAKER = 0; 26 static const int HFP_STUB_VOLUME_TYPE_MICROPHONE = 1; 27 28 class TelephoneClientServiceObserver { 29 public: 30 virtual ~TelephoneClientServiceObserver() = default; OnBatteryLevelChanged(int batteryLevel)31 virtual void OnBatteryLevelChanged(int batteryLevel) 32 {} OnVolumeChanged(int type,int volume)33 virtual void OnVolumeChanged(int type, int volume) 34 {} OnEnhancedDriverSafety(int state)35 virtual void OnEnhancedDriverSafety(int state) 36 {} OnVolumeChangedForAutotest(int type,int volume)37 virtual void OnVolumeChangedForAutotest(int type, int volume) 38 {} 39 }; 40 41 class TelePhoneClientService { 42 public: 43 static TelePhoneClientService& GetInstance(); 44 SetStreamVolume(int type,int volume)45 void SetStreamVolume(int type, int volume) 46 {} GetEnhancedDriverSafetyStatus()47 int GetEnhancedDriverSafetyStatus() 48 { 49 return 0; 50 } SetEnhancedDriverSafetyStatus(int status)51 void SetEnhancedDriverSafetyStatus(int status) 52 {} SetHfVolume(int type,int volume)53 void SetHfVolume(int type, int volume) 54 {} GetStreamVolume(int type)55 int GetStreamVolume(int type) 56 { 57 return 0; 58 } SetBatteryLevel(int level)59 void SetBatteryLevel(int level) 60 {} GetBatteryLevel()61 int GetBatteryLevel() 62 { 63 return 0; 64 } SetAudioParameters(const std::string & parameters)65 bool SetAudioParameters(const std::string ¶meters) 66 { 67 return false; 68 } RegisterObserver(TelephoneClientServiceObserver * observer)69 void RegisterObserver(TelephoneClientServiceObserver* observer) 70 {} DeregisterObserver(TelephoneClientServiceObserver * observer)71 void DeregisterObserver(TelephoneClientServiceObserver* observer) 72 {} NotifyBatteryLevel(int batteryLevel)73 void NotifyBatteryLevel(int batteryLevel) 74 {} NotifyVolumeChanged(int type,int volume)75 void NotifyVolumeChanged(int type, int volume) 76 {} NotifyEnhancedDriverSafety(int state)77 void NotifyEnhancedDriverSafety(int state) 78 {} NotifyVolumeChangedForAutotest(int type,int volume)79 void NotifyVolumeChangedForAutotest(int type, int volume) 80 {} 81 82 private: 83 TelePhoneClientService() = default; 84 ~TelePhoneClientService() = default; 85 86 TelePhoneClientService(const TelePhoneClientService &) = delete; 87 TelePhoneClientService &operator=(const TelePhoneClientService &) = delete; 88 }; 89 } // namespace stub 90 #endif // TELEPHONE_CLIENT_SERVICE_H