NUGU SDK Linux
1.7.6
|
#include <capability.hh>
Public Member Functions | |
void | addBlockingPolicy (const std::string &dname, BlockingPolicy policy) |
Add blocking policy for directive name. More... | |
void | addEventResultCallback (const std::string &ename, EventResultCallback callback) override |
Add event result callback for error handling. More... | |
void | addReferrerEvents (const std::string &ename, const std::string &dname) |
Add event name and directive name for referred dialog request id. More... | |
void | cancelDirective (NuguDirective *ndir) override |
Receive a directive cancellation from the Directive sequencer. More... | |
Capability (const std::string &name, const std::string &ver="1.0") | |
void | deInitialize () override |
Deinitialize the current object. | |
void | destroyDirective (NuguDirective *ndir, bool is_cancel=false) |
Destroy directive received from Directive Sequencer. More... | |
ICapabilityHelper * | getCapabilityHelper () |
Get ICapabilityHelper instance for using NuguCore functions. More... | |
virtual std::string | getContextInfo () |
Get current context info. More... | |
InteractionMode | getInteractionMode (const NJson::Value &interaction_control) |
Get interaction mode which is included in interactionControl. More... | |
std::string | getName () override |
Get the capability name of the current object. More... | |
NuguDirective * | getNuguDirective () |
Get directive received from Directive Sequencer. More... | |
std::string | getPlayServiceIdInStackControl (const char *payload) |
Get play service id which is managed by play stack control. More... | |
std::string | getPlayServiceIdInStackControl (const NJson::Value &playstack_control) |
Get play service id which is managed by play stack control. More... | |
bool | getProperties (const std::string &property, std::list< std::string > &values) override |
It is possible to share own property values among objects. More... | |
bool | getProperty (const std::string &property, std::string &value) override |
It is possible to share own property value among objects. More... | |
std::string | getReferrerDialogRequestId (const std::string &ename) |
Get referred dialog request id. More... | |
std::string | getVersion () override |
Get the capability version of the current object. More... | |
void | initialize () override |
Initialize the current object. | |
void | notifyEventResponse (const std::string &msg_id, const std::string &data, bool success) override |
Notify event response info. More... | |
void | notifyEventResult (const std::string &event_desc) override |
Notify event result. More... | |
virtual void | parsingDirective (const char *dname, const char *message) |
Parsing directive and do the required action. More... | |
void | preprocessDirective (NuguDirective *ndir) override |
Receive a directive preprocessing request from Directive sequencer. More... | |
void | processDirective (NuguDirective *ndir) override final |
Receive a directive processing request from Directive sequencer. More... | |
bool | receiveCommand (const std::string &from, const std::string &command, const std::string ¶m) override |
Process command from other objects. More... | |
void | receiveCommandAll (const std::string &command, const std::string ¶m) override |
Process command received from capability manager. More... | |
void | removeEventResultCallback (const std::string &ename) override |
Remove event result callback. More... | |
void | restore () override |
Restore previous suspended action. | |
void | sendAttachmentEvent (CapabilityEvent *event, bool is_end, size_t size, unsigned char *data) |
Send attachment event to server. More... | |
void | sendEvent (CapabilityEvent *event, const std::string &context, const std::string &payload, EventResultCallback cb=nullptr) |
Send event to server. More... | |
std::string | sendEvent (const std::string &name, const std::string &context, const std::string &payload, EventResultCallback cb=nullptr) |
Send event to server. More... | |
void | setCancelPolicy (bool cancel_previous_dialog, DirectiveCancelPolicy &&cancel_policy={ true }) override |
Set directive cancel policy. More... | |
void | setCapabilityListener (ICapabilityListener *clistener) override |
Set the listener object. More... | |
void | setName (const std::string &name) |
Set the capability name of the current object. More... | |
void | setNuguCoreContainer (INuguCoreContainer *core_container) override |
Set INuguCoreContainer for using functions in NuguCore. More... | |
void | setReferrerDialogRequestId (const std::string &dname, const std::string &id) |
Set referred dialog request id. More... | |
void | setSuspendPolicy (SuspendPolicy policy=SuspendPolicy::STOP) override |
Set capability suspend policy. More... | |
void | setVersion (const std::string &ver) |
Set the capability version of the current object. More... | |
void | suspend () override |
Suspend current action. | |
virtual void | updateCompactContext (NJson::Value &ctx) override |
Update the compact context information of the capability agent. More... | |
Public Member Functions inherited from NuguClientKit::ICapabilityInterface | |
virtual void | updateInfoForContext (NJson::Value &ctx)=0 |
Update the current context information of the capability agent. More... | |
Protected Attributes | |
ICapabilityHelper * | capa_helper = nullptr |
ICapabilityHelper instance for using NuguCore functions. | |
INuguCoreContainer * | core_container = nullptr |
INuguCoreContainer instance for using NuguCore functions. | |
bool | destroy_directive_by_agent = false |
whether destroy received directive by agent | |
IDirectiveSequencer * | directive_sequencer = nullptr |
IDirectiveSequencer instance for directive sequence management. | |
IFocusManager * | focus_manager = nullptr |
IFocusManager instance for using audio focus. | |
bool | initialized = false |
whether capability initialized | |
IInteractionControlManager * | interaction_control_manager = nullptr |
IInteractionControlManager instance for using interaction control management. | |
IPlaySyncManager * | playsync_manager = nullptr |
IPlaySyncManager instance for using playsync management. | |
IRoutineManager * | routine_manager = nullptr |
IRoutineManager instance for using routine management. | |
ISessionManager * | session_manager = nullptr |
ISessionManager instance for using session management. | |
SuspendPolicy | suspend_policy = SuspendPolicy::STOP |
SuspendPolicy variable for deciding suspend action (default:STOP) | |
bool | suspended = false |
whether capability suspend | |
Additional Inherited Members | |
Public Types inherited from NuguClientKit::ICapabilityInterface | |
using | EventResultCallback = std::function< void(const std::string &, const std::string &, const std::string &, int, int)> |
Event result callback for error handling. More... | |
enum class | SuspendPolicy { STOP , PAUSE } |
Capability suspend policy. More... | |
|
overridevirtual |
Set INuguCoreContainer for using functions in NuguCore.
[in] | core_container | NuguCoreContainer instance |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
Set capability suspend policy.
[in] | policy | suspend policy |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
Add event result callback for error handling.
[in] | ename | event name |
[in] | callback | event result callback |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
Remove event result callback.
[in] | ename | event name |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
Notify event result.
[in] | event_desc | event result description (format: 'cname.ename.msgid.dialogid.success.code') |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
Notify event response info.
[in] | msg_id | message id which is sent with event |
[in] | data | raw data which is received from server about event (json format) |
[in] | success | whether receive event response |
Implements NuguClientKit::ICapabilityInterface.
void NuguClientKit::Capability::addReferrerEvents | ( | const std::string & | ename, |
const std::string & | dname | ||
) |
Add event name and directive name for referred dialog request id.
[in] | ename | event name |
[in] | dname | directive name |
void NuguClientKit::Capability::addBlockingPolicy | ( | const std::string & | dname, |
BlockingPolicy | policy | ||
) |
Add blocking policy for directive name.
[in] | dname | directive name |
[in] | policy | BlockingPolicy information |
std::string NuguClientKit::Capability::getReferrerDialogRequestId | ( | const std::string & | ename | ) |
Get referred dialog request id.
[in] | ename | event name |
void NuguClientKit::Capability::setReferrerDialogRequestId | ( | const std::string & | dname, |
const std::string & | id | ||
) |
Set referred dialog request id.
[in] | dname | directive name |
[in] | id | referred dialog request id |
void NuguClientKit::Capability::setName | ( | const std::string & | name | ) |
Set the capability name of the current object.
[in] | name | capability name |
|
overridevirtual |
Get the capability name of the current object.
Implements NuguClientKit::ICapabilityInterface.
void NuguClientKit::Capability::setVersion | ( | const std::string & | ver | ) |
Set the capability version of the current object.
[in] | ver | capability version |
|
overridevirtual |
Get the capability version of the current object.
Implements NuguClientKit::ICapabilityInterface.
std::string NuguClientKit::Capability::getPlayServiceIdInStackControl | ( | const NJson::Value & | playstack_control | ) |
Get play service id which is managed by play stack control.
[in] | playstack_control | json object which has playStackControl field |
std::string NuguClientKit::Capability::getPlayServiceIdInStackControl | ( | const char * | payload | ) |
Get play service id which is managed by play stack control.
[in] | payload | raw json data |
InteractionMode NuguClientKit::Capability::getInteractionMode | ( | const NJson::Value & | interaction_control | ) |
Get interaction mode which is included in interactionControl.
|
overridevirtual |
Receive a directive preprocessing request from Directive sequencer.
[in] | ndir | directive |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
Receive a directive cancellation from the Directive sequencer.
[in] | ndir | directive |
Implements NuguClientKit::ICapabilityInterface.
|
finaloverridevirtual |
Receive a directive processing request from Directive sequencer.
[in] | ndir | directive |
Implements NuguClientKit::ICapabilityInterface.
void NuguClientKit::Capability::destroyDirective | ( | NuguDirective * | ndir, |
bool | is_cancel = false |
||
) |
Destroy directive received from Directive Sequencer.
[in] | ndir | directive |
[in] | is_cancel | whether to destroy by cancel |
NuguDirective* NuguClientKit::Capability::getNuguDirective | ( | ) |
Get directive received from Directive Sequencer.
std::string NuguClientKit::Capability::sendEvent | ( | const std::string & | name, |
const std::string & | context, | ||
const std::string & | payload, | ||
EventResultCallback | cb = nullptr |
||
) |
Send event to server.
[in] | name | event name |
[in] | context | context info |
[in] | payload | payload info |
void NuguClientKit::Capability::sendEvent | ( | CapabilityEvent * | event, |
const std::string & | context, | ||
const std::string & | payload, | ||
EventResultCallback | cb = nullptr |
||
) |
Send event to server.
[in] | event | CapabilityEvent instance |
[in] | context | context info |
[in] | payload | payload info |
void NuguClientKit::Capability::sendAttachmentEvent | ( | CapabilityEvent * | event, |
bool | is_end, | ||
size_t | size, | ||
unsigned char * | data | ||
) |
Send attachment event to server.
[in] | event | CapabilityEvent instance |
[in] | is_end | whether final attachment event |
[in] | size | attachment data size |
[in] | data | attachment data |
|
overridevirtual |
It is possible to share own property value among objects.
[in] | property | capability property |
[in] | value | capability property value |
true | The property is valid |
false | The property is invalid |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
It is possible to share own property values among objects.
[in] | property | capability property |
[in] | values | capability property values |
true | The property is valid |
false | The property is invalid |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
Set the listener object.
[in] | clistener | listener |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
Set directive cancel policy.
[in] | cancel_previous_dialog | whether canceling previous dialog or not |
[in] | cancel_policy | policy object |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
Process command from other objects.
[in] | from | capability who send the command |
[in] | command | command |
[in] | param | command parameter |
true | The command is valid |
false | The command is invalid |
Implements NuguClientKit::ICapabilityInterface.
|
overridevirtual |
Process command received from capability manager.
[in] | command | command |
[in] | param | command parameter |
Implements NuguClientKit::ICapabilityInterface.
|
virtual |
Parsing directive and do the required action.
[in] | dname | directive name |
[in] | message | directive data |
|
virtual |
Get current context info.
|
overridevirtual |
Update the compact context information of the capability agent.
[in] | ctx | capability agent's context |
Implements NuguClientKit::ICapabilityInterface.
ICapabilityHelper* NuguClientKit::Capability::getCapabilityHelper | ( | ) |
Get ICapabilityHelper instance for using NuguCore functions.