NUGU SDK Linux  1.7.6
session_manager_interface.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SK Telecom Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __NUGU_SESSION_MANAGER_INTERFACE_H__
18 #define __NUGU_SESSION_MANAGER_INTERFACE_H__
19 
20 #include <njson/njson.h>
21 #include <string>
22 
23 #include <nugu.h>
24 
25 namespace NuguClientKit {
26 
42 typedef struct _Session {
43  std::string session_id;
44  std::string ps_id;
46 
51 class NUGU_API ISessionManagerListener {
52 public:
53  virtual ~ISessionManagerListener() = default;
54 
60  virtual void activated(const std::string& dialog_id, Session session) = 0;
61 
66  virtual void deactivated(const std::string& dialog_id) = 0;
67 };
68 
73 class NUGU_API ISessionManager {
74 public:
75  virtual ~ISessionManager() = default;
76 
81  virtual void addListener(ISessionManagerListener* listener) = 0;
82 
87  virtual void removeListener(ISessionManagerListener* listener) = 0;
88 
94  virtual void set(const std::string& dialog_id, Session&& session) = 0;
95 
100  virtual void activate(const std::string& dialog_id) = 0;
101 
106  virtual void deactivate(const std::string& dialog_id) = 0;
107 
112  virtual NJson::Value getActiveSessionInfo() = 0;
113 
117  virtual void clear() = 0;
118 };
119 
124 } // NuguClientKit
125 
126 #endif /* __NUGU_SESSION_MANAGER_INTERFACE_H__ */
ISessionManagerListener interface.
Definition: session_manager_interface.hh:51
virtual void activated(const std::string &dialog_id, Session session)=0
Receive callback when the session is activated.
virtual void deactivated(const std::string &dialog_id)=0
Receive callback when the session is deactivated.
SessionManager interface.
Definition: session_manager_interface.hh:73
virtual void activate(const std::string &dialog_id)=0
Activate Session which is mapped with dialog request id.
virtual NJson::Value getActiveSessionInfo()=0
Get current active session info which is composed by session list.
virtual void deactivate(const std::string &dialog_id)=0
Deactivate Session which is mapped with dialog request id.
virtual void clear()=0
Clear all session info.
virtual void removeListener(ISessionManagerListener *listener)=0
Remove ISessionManagerListener.
virtual void addListener(ISessionManagerListener *listener)=0
Add ISessionManagerListener.
virtual void set(const std::string &dialog_id, Session &&session)=0
Set Session object which is received by Session Interface.
struct NuguClientKit::_Session Session
Model for containing session info.
Model for containing session info.
Definition: session_manager_interface.hh:42
std::string ps_id
Definition: session_manager_interface.hh:44
std::string session_id
Definition: session_manager_interface.hh:43