iCall.h
1 #ifndef ICALL_H_
2 #define ICALL_H_
3 
4 #include <vector>
5 #include <iostream>
6 #include <boost/system/error_code.hpp>
7 
8 #ifdef TESTING
9 #include "gtest/gtest.h"
10 #endif
11 
12 namespace dpyVoicecall {
13 
16 {
19 };
20 
23 {
32 };
33 
35 {
36  TYPE_VOICE = 0,
38 };
39 
44 {
45  std::string localSourceId = "";
46  std::string remoteSourceId = "";
48  dpyVoicecall::CallStatus status = CallStatus::STATUS_WAITING;
49  dpyVoicecall::CallType type = CallType::TYPE_VOICE;
50  struct tm creationDate = {};
51  int durationSec = 0;
52 };
53 
54 } //dpyVoicecall
55 
61 {
62 public:
68  virtual void updateCallStatus(const std::string& callid,const dpyVoicecall::CallStatus& status) = 0;
72  virtual ~CallObserver()
73  {
74  }
75 };
76 
81 class ICall
82 {
83 protected:
84  int mCallId;
85  std::string mSourceId;
86  std::vector<CallObserver*> mObserversList;
88 
89  void notifyCallStatusUpdate(const std::string& callid, const dpyVoicecall::CallStatus& status);
90 
91 
92 public:
93  virtual ~ICall();
94 
95  boost::system::error_code subscribe(CallObserver* observer);
96  boost::system::error_code unsubscribe(CallObserver* observer);
97 
102  int getId() const
103  {
104  return mCallId;
105  }
106 
112  {
113  return mCallInfo.status;
114  }
115 
121  {
122  return mCallInfo.direction;
123  }
124 
129  std::string getSourceId() const
130  {
131  return mSourceId;
132  }
133 
139  {
140  return mCallInfo;
141  }
142 
143 #ifdef TESTING
144 public:
145  FRIEND_TEST(Call_Operations,Finish_call_while_ringing_ok);
146 
147 #endif //TESTING
148 };
149 
150 #endif /* ICALL_H_ */
CallStatus
Defines the possible call status that a sim can report.
Definition: iCall.h:22
dpyVoicecall::CallStatus status
Status of the call.
Definition: iCall.h:48
struct tm creationDate
Creation date of the call (UTC)
Definition: iCall.h:50
Incoming (MTC)
Definition: iCall.h:25
1 -> Mobile terminated call (MTC)
Definition: iCall.h:18
dpyVoicecall::CallInformation getCallInformation()
Definition: iCall.h:138
The call is held.
Definition: iCall.h:28
dpyVoicecall::CallStatus getStatus() const
Definition: iCall.h:111
dpyVoicecall::CallDirection direction
Incoming call or outgoing call.
Definition: iCall.h:47
The call is not active anymore, but inband information is still available.
Definition: iCall.h:29
int getId() const
Definition: iCall.h:102
std::string remoteSourceId
ID of the remote source : phone number or address.
Definition: iCall.h:46
Represents a Call in the VoiceCall system.
Definition: iCall.h:81
dpyVoicecall::CallType type
Type of call.
Definition: iCall.h:49
The call has been suspended by the network, but may resumed later.
Definition: iCall.h:31
The call is active.
Definition: iCall.h:27
std::string getSourceId() const
Definition: iCall.h:129
Call Observer class.
Definition: iCall.h:60
Deepsy Voicecall namespace that includes the different enums, structs or method signatures that shoul...
Voice.
Definition: iCall.h:36
std::string localSourceId
ID of the local source associated with the call.
Definition: iCall.h:45
0 -> Mobile originated call (MOC)
Definition: iCall.h:17
virtual ~CallObserver()
Destructor.
Definition: iCall.h:72
Alerting (MOC)
Definition: iCall.h:30
int durationSec
Duration of the call in seconds.
Definition: iCall.h:51
dpyVoicecall::CallDirection getDirection() const
Definition: iCall.h:120
Data.
Definition: iCall.h:37
Dialing (MOC)
Definition: iCall.h:26
Struct to keep information of a call.
Definition: iCall.h:43
CallDirection
Direction.
Definition: iCall.h:15
Waiting (MTC)
Definition: iCall.h:24
CallType
Definition: iCall.h:34