NUGU SDK Linux  1.7.6
NUGU Event

The message object sent to the server. More...

+ Collaboration diagram for NUGU Event:

Typedefs

typedef struct _nugu_event NuguEvent
 Event object.
 

Enumerations

enum  nugu_event_type { NUGU_EVENT_TYPE_DEFAULT , NUGU_EVENT_TYPE_WITH_ATTACHMENT }
 event types More...
 

Functions

NUGU_API void nugu_event_free (NuguEvent *nev)
 Destroy the event object. More...
 
NUGU_API char * nugu_event_generate_payload (NuguEvent *nev)
 Generate JSON payload using nugu_event attributes. More...
 
NUGU_API int nugu_event_get_seq (NuguEvent *nev)
 Get the current sequence number of attachment data. More...
 
NUGU_API enum nugu_event_type nugu_event_get_type (NuguEvent *nev)
 Get the type of NuguEvent. More...
 
NUGU_API int nugu_event_increase_seq (NuguEvent *nev)
 Increase the sequence number. More...
 
NUGU_API NuguEventnugu_event_new (const char *name_space, const char *name, const char *version)
 Create new event object. More...
 
NUGU_API const char * nugu_event_peek_context (NuguEvent *nev)
 Get the context of event. More...
 
NUGU_API const char * nugu_event_peek_dialog_id (NuguEvent *nev)
 Get the dialog-request-id of event. More...
 
NUGU_API const char * nugu_event_peek_json (NuguEvent *nev)
 Get the payload of event. More...
 
NUGU_API const char * nugu_event_peek_mime_type (NuguEvent *nev)
 Get the attachment mime type of NuguEvent. More...
 
NUGU_API const char * nugu_event_peek_msg_id (NuguEvent *nev)
 Get the message-id of event. More...
 
NUGU_API const char * nugu_event_peek_name (NuguEvent *nev)
 Get the name of event. More...
 
NUGU_API const char * nugu_event_peek_namespace (NuguEvent *nev)
 Get the namespace of event. More...
 
NUGU_API const char * nugu_event_peek_referrer_id (NuguEvent *nev)
 Get the referer-dialog-request-id of event. More...
 
NUGU_API const char * nugu_event_peek_version (NuguEvent *nev)
 Get the version of event. More...
 
NUGU_API int nugu_event_set_context (NuguEvent *nev, const char *context)
 Set text context of event. More...
 
NUGU_API int nugu_event_set_dialog_id (NuguEvent *nev, const char *dialog_id)
 Set the dialog-request-id of event. More...
 
NUGU_API int nugu_event_set_json (NuguEvent *nev, const char *json)
 Set the payload of event. More...
 
NUGU_API int nugu_event_set_mime_type (NuguEvent *nev, const char *type)
 Set the attachment mime type of NuguEvent. More...
 
NUGU_API int nugu_event_set_referrer_id (NuguEvent *nev, const char *referrer_id)
 Set the referer-dialog-request-id of event. More...
 
NUGU_API int nugu_event_set_type (NuguEvent *nev, enum nugu_event_type type)
 Set the type of NuguEvent. More...
 

Detailed Description

The message object sent to the server.

An event is a message sent to the server and consists of the following elements:

Enumeration Type Documentation

◆ nugu_event_type

event types

Enumerator
NUGU_EVENT_TYPE_DEFAULT 

Single event with no additional data.

NUGU_EVENT_TYPE_WITH_ATTACHMENT 

Event with additional data.

Function Documentation

◆ nugu_event_new()

NUGU_API NuguEvent* nugu_event_new ( const char *  name_space,
const char *  name,
const char *  version 
)

Create new event object.

Parameters
[in]name_spacecapability name space (e.g. "ASR")
[in]namecapability name (e.g. "Recognize")
[in]versionversion string (e.g. "1.0")
Returns
event object
See also
nugu_event_free()

◆ nugu_event_free()

NUGU_API void nugu_event_free ( NuguEvent nev)

Destroy the event object.

Parameters
[in]nevevent object
See also
nugu_event_new()

◆ nugu_event_peek_namespace()

NUGU_API const char* nugu_event_peek_namespace ( NuguEvent nev)

Get the namespace of event.

Parameters
[in]nevevent object
Returns
namespace. Please don't free the data manually.

◆ nugu_event_peek_name()

NUGU_API const char* nugu_event_peek_name ( NuguEvent nev)

Get the name of event.

Parameters
[in]nevevent object
Returns
name. Please don't free the data manually.

◆ nugu_event_peek_version()

NUGU_API const char* nugu_event_peek_version ( NuguEvent nev)

Get the version of event.

Parameters
[in]nevevent object
Returns
version. Please don't free the data manually.

◆ nugu_event_peek_msg_id()

NUGU_API const char* nugu_event_peek_msg_id ( NuguEvent nev)

Get the message-id of event.

Parameters
[in]nevevent object
Returns
message-id. Please don't free the data manually.

◆ nugu_event_set_context()

NUGU_API int nugu_event_set_context ( NuguEvent nev,
const char *  context 
)

Set text context of event.

Parameters
[in]nevevent object
[in]contextjson type context information
Returns
result
Return values
0success
-1failure

◆ nugu_event_peek_context()

NUGU_API const char* nugu_event_peek_context ( NuguEvent nev)

Get the context of event.

Parameters
[in]nevevent object
Returns
context. Please don't free the data manually.

◆ nugu_event_set_json()

NUGU_API int nugu_event_set_json ( NuguEvent nev,
const char *  json 
)

Set the payload of event.

Parameters
[in]nevevent object
[in]jsonjson type payload
Returns
result
Return values
0success
-1failure

◆ nugu_event_peek_json()

NUGU_API const char* nugu_event_peek_json ( NuguEvent nev)

Get the payload of event.

Parameters
[in]nevevent object
Returns
json type payload. Please don't free the data manually.

◆ nugu_event_set_dialog_id()

NUGU_API int nugu_event_set_dialog_id ( NuguEvent nev,
const char *  dialog_id 
)

Set the dialog-request-id of event.

Parameters
[in]nevevent object
[in]dialog_iddialog-request-id
Returns
result
Return values
0success
-1failure

◆ nugu_event_peek_dialog_id()

NUGU_API const char* nugu_event_peek_dialog_id ( NuguEvent nev)

Get the dialog-request-id of event.

Parameters
[in]nevevent object
Returns
dialog-request-id. Please don't free the data manually.

◆ nugu_event_set_referrer_id()

NUGU_API int nugu_event_set_referrer_id ( NuguEvent nev,
const char *  referrer_id 
)

Set the referer-dialog-request-id of event.

Parameters
[in]nevevent object
[in]referrer_idreferrer-dialog-request-id
Returns
result
Return values
0success
-1failure

◆ nugu_event_peek_referrer_id()

NUGU_API const char* nugu_event_peek_referrer_id ( NuguEvent nev)

Get the referer-dialog-request-id of event.

Parameters
[in]nevevent object
Returns
referrer-dialog-request-id. Please don't free the data manually.

◆ nugu_event_set_type()

NUGU_API int nugu_event_set_type ( NuguEvent nev,
enum nugu_event_type  type 
)

Set the type of NuguEvent.

Parameters
[in]nevevent object
[in]typeevent type
Returns
result
Return values
0success
-1failure

◆ nugu_event_get_type()

NUGU_API enum nugu_event_type nugu_event_get_type ( NuguEvent nev)

Get the type of NuguEvent.

Parameters
[in]nevevent object
Returns
type of NuguEvent

◆ nugu_event_get_seq()

NUGU_API int nugu_event_get_seq ( NuguEvent nev)

Get the current sequence number of attachment data.

Parameters
[in]nevevent object
Returns
sequence number

◆ nugu_event_increase_seq()

NUGU_API int nugu_event_increase_seq ( NuguEvent nev)

Increase the sequence number.

Parameters
[in]nevevent object
Returns
result
Return values
0success
-1failure

◆ nugu_event_generate_payload()

NUGU_API char* nugu_event_generate_payload ( NuguEvent nev)

Generate JSON payload using nugu_event attributes.

Parameters
[in]nevevent object
Returns
memory allocated JSON string. Developer must free the data manually.
Return values
NULLfailure

◆ nugu_event_set_mime_type()

NUGU_API int nugu_event_set_mime_type ( NuguEvent nev,
const char *  type 
)

Set the attachment mime type of NuguEvent.

Parameters
[in]nevevent object
[in]typeattachment type. e.g. "application/octet-stream"
Returns
result
Return values
0success
-1failure

◆ nugu_event_peek_mime_type()

NUGU_API const char* nugu_event_peek_mime_type ( NuguEvent nev)

Get the attachment mime type of NuguEvent.

Parameters
[in]nevevent object
Returns
attachment type. Please don't free the data manually.