NUGU SDK Linux  1.7.6
directive_sequencer_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_DIRECTIVE_SEQUENCER_INTERFACE_H__
18 #define __NUGU_DIRECTIVE_SEQUENCER_INTERFACE_H__
19 
20 #include <set>
21 
22 #include <base/nugu_directive.h>
23 #include <nugu.h>
24 
25 namespace NuguClientKit {
26 
42 enum class BlockingMedium {
47 };
48 
52 typedef struct _BlockingPolicy {
54  bool isBlocking;
56 
62 public:
63  virtual ~IDirectiveSequencerListener() = default;
64 
72  virtual bool onPreHandleDirective(NuguDirective* ndir) = 0;
73 
81  virtual bool onHandleDirective(NuguDirective* ndir) = 0;
82 
87  virtual void onCancelDirective(NuguDirective* ndir) = 0;
88 };
89 
94 class NUGU_API IDirectiveSequencer {
95 public:
96  virtual ~IDirectiveSequencer() = default;
97 
103  virtual void addListener(const std::string& name_space, IDirectiveSequencerListener* listener) = 0;
104 
110  virtual void removeListener(const std::string& name_space, IDirectiveSequencerListener* listener) = 0;
111 
121  virtual bool addPolicy(const std::string& name_space, const std::string& name, BlockingPolicy policy) = 0;
122 
129  virtual BlockingPolicy getPolicy(const std::string& name_space, const std::string& name) = 0;
130 
140  virtual bool cancel(const std::string& dialog_id, bool cancel_active_directive = true) = 0;
141 
151  virtual bool cancel(const std::string& dialog_id, std::set<std::string> groups) = 0;
152 
161  virtual bool cancelAll(bool cancel_active_directive = true) = 0;
162 
171  virtual bool complete(NuguDirective* ndir) = 0;
172 
180  virtual bool add(NuguDirective* ndir) = 0;
181 
186  virtual const std::string& getCanceledDialogId() = 0;
187 
194  virtual const NuguDirective* findPending(const std::string& name_space, const std::string& name) = 0;
195 };
196 
201 } // NuguClientKit
202 
203 #endif /* __NUGU_DIRECTIVE_SEQUENCER_INTERFACE_H__ */
IDirectiveSequencerListener.
Definition: directive_sequencer_interface.hh:61
virtual bool onPreHandleDirective(NuguDirective *ndir)=0
Notify the directive to handle in advance.
virtual void onCancelDirective(NuguDirective *ndir)=0
Notify the directive to cancel.
virtual bool onHandleDirective(NuguDirective *ndir)=0
Notify the directive to handle.
IDirectiveSequencer.
Definition: directive_sequencer_interface.hh:94
virtual bool addPolicy(const std::string &name_space, const std::string &name, BlockingPolicy policy)=0
Add the BlockingPolicy.
virtual const std::string & getCanceledDialogId()=0
Get the last canceled dialog_id.
virtual bool cancelAll(bool cancel_active_directive=true)=0
Cancels all pending directives. The canceled directives are freed.
virtual BlockingPolicy getPolicy(const std::string &name_space, const std::string &name)=0
Get the BlockingPolicy for namespace.name.
virtual bool complete(NuguDirective *ndir)=0
Complete the blocking directive. The NuguDirective object will be destroyed. If there are pending dir...
virtual bool cancel(const std::string &dialog_id, std::set< std::string > groups)=0
Cancels specific pending directives related to the dialog_id. The canceled directives are freed.
virtual void removeListener(const std::string &name_space, IDirectiveSequencerListener *listener)=0
Remove the Listener object.
virtual void addListener(const std::string &name_space, IDirectiveSequencerListener *listener)=0
Add the Listener object.
virtual bool add(NuguDirective *ndir)=0
Add new directive to sequencer.
virtual bool cancel(const std::string &dialog_id, bool cancel_active_directive=true)=0
Cancel all pending directives related to the dialog_id. The canceled directives are freed.
virtual const NuguDirective * findPending(const std::string &name_space, const std::string &name)=0
Find directive from pending list.
BlockingMedium
BlockingMedium.
Definition: directive_sequencer_interface.hh:42
struct NuguClientKit::_BlockingPolicy BlockingPolicy
BlockingPolicy.
struct _nugu_directive NuguDirective
Directive object.
Definition: nugu_directive.h:48
@ NUGU_DIRECTIVE_MEDIUM_ANY
Definition: nugu_directive.h:57
@ NUGU_DIRECTIVE_MEDIUM_NONE
Definition: nugu_directive.h:56
@ NUGU_DIRECTIVE_MEDIUM_VISUAL
Definition: nugu_directive.h:55
@ NUGU_DIRECTIVE_MEDIUM_AUDIO
Definition: nugu_directive.h:54
BlockingPolicy.
Definition: directive_sequencer_interface.hh:52
BlockingMedium medium
Definition: directive_sequencer_interface.hh:53
bool isBlocking
Definition: directive_sequencer_interface.hh:54