17 #ifndef __NUGU_CAPABILITY_H__
18 #define __NUGU_CAPABILITY_H__
30 namespace NuguClientKit {
103 void sendEvent(
const std::string& context,
const std::string& payload);
115 std::unique_ptr<Impl> pimpl;
123 explicit Capability(
const std::string& name,
const std::string& ver =
"1.0");
322 bool getProperty(
const std::string& property, std::string& value)
override;
332 bool getProperties(
const std::string& property, std::list<std::string>& values)
override;
356 bool receiveCommand(
const std::string& from,
const std::string& command,
const std::string& param)
override;
392 bool initialized =
false;
395 bool destroy_directive_by_agent =
false;
398 bool suspended =
false;
429 std::unique_ptr<Impl> pimpl;
430 std::map<std::string, EventResultCallback> event_result_cbs;
CapabilityEvent.
Definition: capability.hh:52
void setMimeType(const std::string &type)
Set mime type.
void sendEvent(const std::string &context, const std::string &payload)
Send event to server.
std::string getMessageId()
Get message id.
void sendAttachmentEvent(bool is_end, size_t size, unsigned char *data)
Send attachment event to server.
std::string getDialogRequestId()
Get dialog request id.
void forceClose()
Close event forcibly.
void setDialogRequestId(const std::string &id)
Set dialog request id.
void setType(enum nugu_event_type type)
Set event type.
std::string getName()
Get event name.
Capability.
Definition: capability.hh:121
void setReferrerDialogRequestId(const std::string &dname, const std::string &id)
Set referred dialog request id.
std::string getVersion() override
Get the capability version of the current object.
void notifyEventResult(const std::string &event_desc) override
Notify event result.
void sendAttachmentEvent(CapabilityEvent *event, bool is_end, size_t size, unsigned char *data)
Send attachment event to server.
void setVersion(const std::string &ver)
Set the capability version of the current object.
std::string getName() override
Get the capability name of the current object.
void sendEvent(CapabilityEvent *event, const std::string &context, const std::string &payload, EventResultCallback cb=nullptr)
Send event to server.
virtual void parsingDirective(const char *dname, const char *message)
Parsing directive and do the required action.
void cancelDirective(NuguDirective *ndir) override
Receive a directive cancellation from the Directive sequencer.
ICapabilityHelper * getCapabilityHelper()
Get ICapabilityHelper instance for using NuguCore functions.
std::string getPlayServiceIdInStackControl(const NJson::Value &playstack_control)
Get play service id which is managed by play stack control.
virtual std::string getContextInfo()
Get current context info.
void setNuguCoreContainer(INuguCoreContainer *core_container) override
Set INuguCoreContainer for using functions in NuguCore.
bool getProperties(const std::string &property, std::list< std::string > &values) override
It is possible to share own property values among objects.
void setSuspendPolicy(SuspendPolicy policy=SuspendPolicy::STOP) override
Set capability suspend policy.
void initialize() override
Initialize the current object.
std::string getPlayServiceIdInStackControl(const char *payload)
Get play service id which is managed by play stack control.
void setName(const std::string &name)
Set the capability name of the current object.
void removeEventResultCallback(const std::string &ename) override
Remove event result callback.
InteractionMode getInteractionMode(const NJson::Value &interaction_control)
Get interaction mode which is included in interactionControl.
std::string getReferrerDialogRequestId(const std::string &ename)
Get referred dialog request id.
NuguDirective * getNuguDirective()
Get directive received from Directive Sequencer.
void preprocessDirective(NuguDirective *ndir) override
Receive a directive preprocessing request from Directive sequencer.
bool receiveCommand(const std::string &from, const std::string &command, const std::string ¶m) override
Process command from other objects.
void notifyEventResponse(const std::string &msg_id, const std::string &data, bool success) override
Notify event response info.
void destroyDirective(NuguDirective *ndir, bool is_cancel=false)
Destroy directive received from Directive Sequencer.
std::string sendEvent(const std::string &name, const std::string &context, const std::string &payload, EventResultCallback cb=nullptr)
Send event to server.
virtual void updateCompactContext(NJson::Value &ctx) override
Update the compact context information of the capability agent.
void setCancelPolicy(bool cancel_previous_dialog, DirectiveCancelPolicy &&cancel_policy={ true }) override
Set directive cancel policy.
bool getProperty(const std::string &property, std::string &value) override
It is possible to share own property value among objects.
void setCapabilityListener(ICapabilityListener *clistener) override
Set the listener object.
void addEventResultCallback(const std::string &ename, EventResultCallback callback) override
Add event result callback for error handling.
void receiveCommandAll(const std::string &command, const std::string ¶m) override
Process command received from capability manager.
void suspend() override
Suspend current action.
void addReferrerEvents(const std::string &ename, const std::string &dname)
Add event name and directive name for referred dialog request id.
void processDirective(NuguDirective *ndir) override final
Receive a directive processing request from Directive sequencer.
void addBlockingPolicy(const std::string &dname, BlockingPolicy policy)
Add blocking policy for directive name.
void restore() override
Restore previous suspended action.
void deInitialize() override
Deinitialize the current object.
CapabilityHelper interface.
Definition: capability_helper_interface.hh:47
capability interface
Definition: capability_interface.hh:82
SuspendPolicy
Capability suspend policy.
Definition: capability_interface.hh:87
std::function< void(const std::string &, const std::string &, const std::string &, int, int)> EventResultCallback
Event result callback for error handling.
Definition: capability_interface.hh:100
capability listener interface
Definition: capability_interface.hh:60
IDirectiveSequencer.
Definition: directive_sequencer_interface.hh:94
IFocusManager.
Definition: focus_manager_interface.hh:128
InteractionControlManager interface.
Definition: interaction_control_manager_interface.hh:69
NuguCoreContainer interface.
Definition: nugu_core_container_interface.hh:44
IPlaySyncManager interface.
Definition: playsync_manager_interface.hh:96
IRoutineManager interface.
Definition: routine_manager_interface.hh:76
SessionManager interface.
Definition: session_manager_interface.hh:73
class NUGU_API Capability
Capability.
Definition: capability.hh:47
InteractionMode
Interaction Mode.
Definition: interaction_control_manager_interface.hh:40
struct _nugu_directive NuguDirective
Directive object.
Definition: nugu_directive.h:48
nugu_event_type
event types
Definition: nugu_event.h:48
BlockingPolicy.
Definition: directive_sequencer_interface.hh:52
Policy about canceling directives which are belong to the specific dialog id.
Definition: capability_interface.hh:46