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_SERVICE_H
17 #define TELEPHONE_SERVICE_H
18 
19 #include <list>
20 #include <string>
21 #include <vector>
22 #include <memory>
23 #include <mutex>
24 
25 namespace stub {
26 typedef struct {
27     int index = 0;
28     int direction = 0;
29     int status = 0;
30     int mode = 0;
31     bool mpty = false;
32     std::string number = "";
33     int type = 0;
34 }CurrentCalls;
35 
36 class TelephoneServiceObserver {
37 public:
38     virtual ~TelephoneServiceObserver() = default;
OnRegistrationStatusChanged(int status)39     virtual void OnRegistrationStatusChanged(int status)
40     {}
OnSignalStrengthChanged(int signalStrength)41     virtual void OnSignalStrengthChanged(int signalStrength)
42     {}
OnRoamingStatusChanged(int status)43     virtual void OnRoamingStatusChanged(int status)
44     {}
OnBatteryLevelChanged(int batteryLevel)45     virtual void OnBatteryLevelChanged(int batteryLevel)
46     {}
OnVolumeChanged(int type,int volume)47     virtual void OnVolumeChanged(int type, int volume)
48     {}
RejectCall()49     virtual void RejectCall()
50     {}
DialOutCall(std::string number)51     virtual void DialOutCall(std::string number)
52     {}
HangupCall()53     virtual void HangupCall()
54     {}
AnswerCall()55     virtual void AnswerCall()
56     {}
SendDtmf(int dtmf)57     virtual void SendDtmf(int dtmf)
58     {}
ProcessChld(int chld)59     virtual void ProcessChld(int chld)
60     {}
OnVolumeChangedForAutotest(int type,int volume)61     virtual void OnVolumeChangedForAutotest(int type, int volume)
62     {}
63 };
64 
65 class TelephoneService {
66 public:
67     static TelephoneService *GetInstance();
GetPhoneType()68     int GetPhoneType()
69     {
70         return 0;
71     }
GetPhoneNumber()72     std::string GetPhoneNumber()
73     {
74         return "";
75     }
GetTelephoneAccount()76     std::vector<std::string> GetTelephoneAccount()
77     {
78         std::vector<std::string> ret;
79         return ret;
80     }
RejectCall()81     void RejectCall()
82     {}
DialOutCall(const std::string & number)83     void DialOutCall(const std::string &number)
84     {}
HangupCall()85     void HangupCall()
86     {}
AnswerCall()87     void AnswerCall()
88     {}
SendDtmf(int dtmf)89     bool SendDtmf(int dtmf)
90     {
91         return false;
92     }
ProcessChld(int chld)93     bool ProcessChld(int chld)
94     {
95         return false;
96     }
GetNetworkOperator()97     std::string GetNetworkOperator()
98     {
99         return "";
100     }
GetSubscriberNumber()101     std::string GetSubscriberNumber()
102     {
103         return "";
104     }
GetLastDialNumber()105     std::string GetLastDialNumber()
106     {
107         return "";
108     }
ListCurrentCalls()109     bool ListCurrentCalls()
110     {
111         return false;
112     }
QueryPhoneState()113     void QueryPhoneState()
114     {}
StartVoiceRecognition(const std::string & address)115     bool StartVoiceRecognition(const std::string &address)
116     {
117         return false;
118     }
StopVoiceRecogition(const std::string & address)119     bool StopVoiceRecogition(const std::string &address)
120     {
121         return false;
122     }
SetAudioParameters(const std::string & parameters)123     bool SetAudioParameters(const std::string &parameters)
124     {
125         return false;
126     }
SetStreamVolume(int type,int volume,int flag)127     bool SetStreamVolume(int type, int volume, int flag)
128     {
129         return false;
130     }
SetHfVolume(int type,int volume)131     bool SetHfVolume(int type, int volume)
132     {
133         return false;
134     }
GetRegistrationStatus()135     int GetRegistrationStatus()
136     {
137         return 0;
138     }
GetSignalStrength()139     int GetSignalStrength()
140     {
141         return 0;
142     }
GetRoamingStatus()143     int GetRoamingStatus()
144     {
145         return 0;
146     }
GetBatteryLevel()147     int GetBatteryLevel()
148     {
149         return 0;
150     }
NotifyHfBatteryLevel(int level)151     void NotifyHfBatteryLevel(int level)
152     {}
NotifyHfEnhancedDriverSafety(int status)153     void NotifyHfEnhancedDriverSafety(int status)
154     {}
SetPhoneState(int numActive,int numHeld,int callState,const std::string & number,int type,const std::string & name)155     void SetPhoneState(int numActive, int numHeld, int callState,
156         const std::string &number, int type, const std::string &name)
157     {}
SetCurrentCalls(CurrentCalls & call)158     void SetCurrentCalls(CurrentCalls &call)
159     {}
RemoveCall(int index)160     void RemoveCall(int index)
161     {}
ShowCallList()162     void ShowCallList()
163     {}
ClearCallList()164     void ClearCallList()
165     {}
SetOperatorName(std::string & name)166     void SetOperatorName(std::string &name)
167     {}
SetSubscriberNumber(std::string & number)168     void SetSubscriberNumber(std::string &number)
169     {}
SetLastDialNumber(std::string & number)170     void SetLastDialNumber(std::string &number)
171     {}
NotifyCurrentCalls()172     void NotifyCurrentCalls()
173     {}
SetRegistrationStatus(int registrationStatus)174     void SetRegistrationStatus(int registrationStatus)
175     {}
SetSignalStrength(int signalStrength)176     void SetSignalStrength(int signalStrength)
177     {}
SetRoamingStatus(int roamingStatus)178     void SetRoamingStatus(int roamingStatus)
179     {}
SetBatteryLevel(int batteryLevel)180     void SetBatteryLevel(int batteryLevel)
181     {}
RegisterObserver(TelephoneServiceObserver * observer)182     void RegisterObserver(TelephoneServiceObserver *observer)
183     {}
DeregisterObserver(TelephoneServiceObserver * observer)184     void DeregisterObserver(TelephoneServiceObserver *observer)
185     {}
NotifyRegistrationStatusChanged(int status)186     void NotifyRegistrationStatusChanged(int status)
187     {}
NotifySignalStrengthChanged(int signalStrength)188     void NotifySignalStrengthChanged(int signalStrength)
189     {}
NotifyRoamingStatusChanged(int status)190     void NotifyRoamingStatusChanged(int status)
191     {}
NotifyBatteryLevelChanged(int batteryLevel)192     void NotifyBatteryLevelChanged(int batteryLevel)
193     {}
NotifyVolumeChanged(int type,int volume)194     void NotifyVolumeChanged(int type, int volume)
195     {}
NotifyRejectCall()196     void NotifyRejectCall()
197     {}
NotifyDialOutCall(std::string number)198     void NotifyDialOutCall(std::string number)
199     {}
NotifyHangupCall()200     void NotifyHangupCall()
201     {}
NotifyAnswerCall()202     void NotifyAnswerCall()
203     {}
NotifySendDtmf(int dtmf)204     void NotifySendDtmf(int dtmf)
205     {}
NotifyProcessChld(int chld)206     void NotifyProcessChld(int chld)
207     {}
NotifyVolumeChangedForAutotest(int type,int volume)208     void NotifyVolumeChangedForAutotest(int type, int volume)
209     {}
210 
211 private:
212     TelephoneService() = default;
213     ~TelephoneService() = default;
214 
215     TelephoneService(const TelephoneService &) = delete;
216     TelephoneService &operator=(const TelephoneService &) = delete;
217 };
218 } // namespace stub
219 #endif // TELEPHONE_SERVICE_H