blob: e6f48982260f5b5a3ee381b802a8e10dad8f7777 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
/**
* \file MessageBrokerControllerPhone.hpp
* \brief MessageBroker Controller Phone.
* \author AKara
*/
#ifndef MB_CONTROLLERPHONE_H
#define MB_CONTROLLERPHONE_H
#include <iostream>
#include "json/json.h"
#include "mb_controller.hpp"
/**
* \namespace NsMessageBroker
* \brief MessageBroker related functions.
*/
namespace NsMessageBroker
{
/**
* \class CMessageBrokerControllerPhone
* \brief MessageBroker Controller Phone.
*/
class CMessageBrokerControllerPhone : public CMessageBrokerController
{
public:
/**
* \brief Constructor.
* \param address remote network address or FQDN
* \param port remote local port
*/
CMessageBrokerControllerPhone(const std::string& address, uint16_t port);
/**
* \brief Destructor.
*/
~CMessageBrokerControllerPhone();
/**
* \brief process request.
* \param root JSON message.
*/
void processRequest(Json::Value& root);
/**
* \brief process notification.
* \param root JSON message.
*/
void processNotification(Json::Value& root);
/**
* \brief process response.
* \param method method name which has been called.
* \param root JSON message.
*/
void processResponse(std::string method, Json::Value& root);
public://Notifications
/**
* \brief Notifies Call Status changing.
* \param callStatus status of current active call
*/
void onCallStatusChanged(int callStatus);
/**
* \brief Notifies Contacts list updated.
*/
void onContactsUpdated();
/**
* \brief Notifies History list updated.
*/
void onHistoryUpdated();
private:
/**
* \brief Makes call.
* \param phoneNumber number for call.
* \param response container for response
*/
void makeCall(std::string phoneNumber, Json::Value& response);
/**
* \brief Ends call.
* \param phoneNumber number of call.
* \param response container for response
*/
void endCall(std::string phoneNumber, Json::Value& response);
/**
* \brief Holds call.
* \param phoneNumber number of call.
* \param response container for response
*/
void holdCall(std::string phoneNumber, Json::Value& response);
/**
* \brief Gets contacts.
* \param firstLetter first letter of list.
* \param offset offset from first item
* \param numberOfItems number of expected items
* \param response container for response
*/
void getContacts(std::string firstLetter, int offset, int numberOfItems, Json::Value& response);
/**
* \brief Gets history.
* \param typeOfContacts type of contacts (incoming/outgoing/missed/all calls).
* \param offset offset from first item
* \param numberOfItems number of expected items
* \param response container for response
*/
void getHistory(std::string typeOfContacts, int offset, int numberOfItems, Json::Value& response);
};
}/* namespace NsMessageBroker */
#endif /* MB_CONTROLLERPHONE_H */
|