Merge "Partial Implementation of US1574:"
[platform/upstream/iotivity.git] / csdk / controller / src / remoting / LiteSession.hpp
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #ifndef LITESESSION_HPP_
22 #define LITESESSION_HPP_
23
24 // ============================================================================
25 // Includes
26 // ============================================================================
27 #include <string>
28 #include <uuid.h>
29 #include <set>
30 #include <boost/shared_ptr.hpp>
31 #include "api.h"
32 using namespace Intel::STC;
33
34 #include "LiteConnection.h"
35
36 // ============================================================================
37 // Namespace
38 // ============================================================================
39 namespace remoting {
40
41   class LiteSession
42   {
43
44   public:
45     LiteSession(API::Context::SharedPtr pCCFContext, UUID_t uuid) : pCCFContext_(pCCFContext), sessionId_(uuid) {};
46     virtual ~LiteSession() { connectionSet_.clear(); };
47
48     virtual void invite() = 0;
49     virtual void disconnect() = 0;
50
51   public:
52     bool isInvited() {
53       return isInvited_;
54     }
55
56     bool isConnected() {
57       return isConnected_;
58     }
59
60     void setPublicAvatarId(const UUID_t& avatarId) {
61       publicAvatarId_ = avatarId;
62     }
63
64     void setPrivateAvatarId(const UUID_t& avatarId) {
65       privateAvatarId_ = avatarId;
66     }
67
68     void setUserId(const UUID_t& userId) {
69       userId_ = userId;
70     }
71
72     void setIssuer(const std::string& issuer) {
73       issuer_ = issuer;
74     }
75
76     void setName(const std::string& name) {
77       sessionName_ = name;
78     }
79
80     void setStatusText(const std::string& text) {
81       statusText_ = text;
82     }
83
84     void setSecurityCode(const std::string& code) {
85       securityCode_ = code;
86     }
87
88     void setApplicationSet(const std::set<UUID_t>& applicationSet) {
89       applicationSet_ = applicationSet;
90     }
91
92     const UUID_t& getPublicAvatarId() {
93       return publicAvatarId_;
94     }
95
96     const UUID_t& getPrivateAvatarId() {
97       return privateAvatarId_;
98     }
99
100     const UUID_t& getUserId() {
101       return userId_;
102     }
103
104     const std::string& getIssuer() {
105       return issuer_;
106     }
107
108     const std::string& getName() {
109       return sessionName_;
110     }
111
112     const std::string& getStatusText() {
113       return statusText_;
114     }
115
116     const std::string& getSecurityCode() {
117       return securityCode_;
118     }
119     const std::set<UUID_t>& getApplicationSet() {
120       return applicationSet_;
121     }
122
123     void addConnection(boost::shared_ptr<LiteConnection> connection) {
124       connectionSet_.insert(connection);
125     }
126
127     void removeConnection(boost::shared_ptr<LiteConnection> connection) {
128       connectionSet_.erase(connection);
129     }
130
131   protected:
132     bool onLocalNetwork_;
133     bool onCloudNetwork_;
134     bool isController_;
135     bool isInvited_;
136     bool isConnected_;
137
138     API::Context::SharedPtr pCCFContext_;
139     API::InvitationBuilder::SharedPtr pInvitationBuilder_;
140
141     UUID_t            sessionId_;
142     UUID_t            publicAvatarId_;
143     UUID_t            privateAvatarId_;
144     UUID_t            userId_;
145     std::string       issuer_;
146     std::string       sessionName_;
147     std::string       statusText_;
148     std::string       securityCode_;
149     std::set <UUID_t> applicationSet_;
150
151     std::set<boost::shared_ptr<LiteConnection>> connectionSet_;
152
153
154   };
155
156 }
157
158
159 #endif /* LITESESSION_HPP_ */