NUGU SDK Linux  1.7.6
NUGU Directive

The message object received from the server. More...

+ Collaboration diagram for NUGU Directive:

Typedefs

typedef struct _nugu_directive NuguDirective
 Directive object.
 
typedef void(* NuguDirectiveDataCallback) (NuguDirective *ndir, int seq, void *userdata)
 Callback prototype for receiving an attachment.
 

Enumerations

enum  nugu_directive_medium {
  NUGU_DIRECTIVE_MEDIUM_AUDIO = 0 , NUGU_DIRECTIVE_MEDIUM_VISUAL = 1 , NUGU_DIRECTIVE_MEDIUM_NONE = 2 , NUGU_DIRECTIVE_MEDIUM_ANY = 3 ,
  NUGU_DIRECTIVE_MEDIUM_MAX
}
 event types More...
 

Functions

NUGU_API int nugu_directive_add_data (NuguDirective *ndir, size_t length, const unsigned char *data)
 Add attachment data to directive. (e.g. TTS payload) More...
 
NUGU_API int nugu_directive_close_data (NuguDirective *ndir)
 Set the attachment data status to "Received all data". More...
 
NUGU_API enum nugu_directive_medium nugu_directive_get_blocking_medium (const NuguDirective *ndir)
 Get the medium of BlockingPolicy for the directive. More...
 
NUGU_API const char * nugu_directive_get_blocking_medium_string (const NuguDirective *ndir)
 Get the medium string of BlockingPolicy for the directive. More...
 
NUGU_API unsigned char * nugu_directive_get_data (NuguDirective *ndir, size_t *length)
 Get the attachment data received so far. When this function is called, the internal receive buffer is cleared. More...
 
NUGU_API size_t nugu_directive_get_data_size (const NuguDirective *ndir)
 Get the size of attachment data received so far. More...
 
NUGU_API int nugu_directive_is_active (const NuguDirective *ndir)
 Get the active status of directive. "active" means the directive is added to the directive sequencer. More...
 
NUGU_API int nugu_directive_is_blocking (const NuguDirective *ndir)
 Get the blocking status of BlockingPolicy for the directive. More...
 
NUGU_API int nugu_directive_is_data_end (const NuguDirective *ndir)
 Get the attachment data status. More...
 
NUGU_API NuguDirectivenugu_directive_new (const char *name_space, const char *name, const char *version, const char *msg_id, const char *dialog_id, const char *referrer_id, const char *json, const char *groups)
 Create new directive object. More...
 
NUGU_API const char * nugu_directive_peek_dialog_id (const NuguDirective *ndir)
 Get the dialog-request-id of directive. More...
 
NUGU_API const char * nugu_directive_peek_groups (const NuguDirective *ndir)
 Get the group of directive. More...
 
NUGU_API const char * nugu_directive_peek_json (const NuguDirective *ndir)
 Get the payload of directive. More...
 
NUGU_API const char * nugu_directive_peek_media_type (const NuguDirective *ndir)
 Get the attachment mime type. More...
 
NUGU_API const char * nugu_directive_peek_msg_id (const NuguDirective *ndir)
 Get the message-id of directive. More...
 
NUGU_API const char * nugu_directive_peek_name (const NuguDirective *ndir)
 Get the name of directive. More...
 
NUGU_API const char * nugu_directive_peek_namespace (const NuguDirective *ndir)
 Get the namespace of directive. More...
 
NUGU_API const char * nugu_directive_peek_referrer_id (const NuguDirective *ndir)
 Get the referer-dialog-request-id of directive. More...
 
NUGU_API const char * nugu_directive_peek_version (const NuguDirective *ndir)
 Get the version of directive. More...
 
NUGU_API void nugu_directive_ref (NuguDirective *ndir)
 Increment the reference count of the directive object. More...
 
NUGU_API int nugu_directive_remove_data_callback (NuguDirective *ndir)
 Remove attachment received event callback. More...
 
NUGU_API int nugu_directive_set_active (NuguDirective *ndir, int flag)
 Set the active status of directive. More...
 
NUGU_API int nugu_directive_set_blocking_policy (NuguDirective *ndir, enum nugu_directive_medium medium, int is_block)
 Set the medium of BlockingPolicy for the directive. More...
 
NUGU_API int nugu_directive_set_data_callback (NuguDirective *ndir, NuguDirectiveDataCallback callback, void *userdata)
 Set attachment received event callback. More...
 
NUGU_API int nugu_directive_set_media_type (NuguDirective *ndir, const char *type)
 Set the attachment mime type. More...
 
NUGU_API void nugu_directive_unref (NuguDirective *ndir)
 Decrement the reference count of the directive object. More...
 

Detailed Description

The message object received from the server.

The directive refers to a message received from the server and consists of the following elements.

Enumeration Type Documentation

◆ nugu_directive_medium

event types

Enumerator
NUGU_DIRECTIVE_MEDIUM_AUDIO 

BlockingPolicy AUDIO medium

NUGU_DIRECTIVE_MEDIUM_VISUAL 

BlockingPolicy VISUAL medium

NUGU_DIRECTIVE_MEDIUM_NONE 

BlockingPolicy NONE medium

NUGU_DIRECTIVE_MEDIUM_ANY 

BlockingPolicy ANY medium

NUGU_DIRECTIVE_MEDIUM_MAX 

maximum value for medium

Function Documentation

◆ nugu_directive_new()

NUGU_API NuguDirective* nugu_directive_new ( const char *  name_space,
const char *  name,
const char *  version,
const char *  msg_id,
const char *  dialog_id,
const char *  referrer_id,
const char *  json,
const char *  groups 
)

Create new directive object.

Parameters
[in]name_spacecapability name space (e.g. "TTS")
[in]namecapability name (e.g. "Speak")
[in]versionversion string (e.g. "1.0")
[in]msg_idunique message-id
[in]dialog_idunique dialog-request-id
[in]referrer_idreferrer-dialog-request-id
[in]jsonpayload
[in]groupsgroups
Returns
directive object
See also
nugu_directive_free()

◆ nugu_directive_ref()

NUGU_API void nugu_directive_ref ( NuguDirective ndir)

Increment the reference count of the directive object.

Parameters
[in]ndirdirective object
See also
nugu_directive_new()

◆ nugu_directive_unref()

NUGU_API void nugu_directive_unref ( NuguDirective ndir)

Decrement the reference count of the directive object.

Parameters
[in]ndirdirective object
See also
nugu_directive_new()

◆ nugu_directive_peek_namespace()

NUGU_API const char* nugu_directive_peek_namespace ( const NuguDirective ndir)

Get the namespace of directive.

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

◆ nugu_directive_peek_name()

NUGU_API const char* nugu_directive_peek_name ( const NuguDirective ndir)

Get the name of directive.

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

◆ nugu_directive_peek_groups()

NUGU_API const char* nugu_directive_peek_groups ( const NuguDirective ndir)

Get the group of directive.

Parameters
[in]ndirdirective object
Returns
groups. Please don't free the data manually.

◆ nugu_directive_peek_version()

NUGU_API const char* nugu_directive_peek_version ( const NuguDirective ndir)

Get the version of directive.

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

◆ nugu_directive_peek_msg_id()

NUGU_API const char* nugu_directive_peek_msg_id ( const NuguDirective ndir)

Get the message-id of directive.

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

◆ nugu_directive_peek_dialog_id()

NUGU_API const char* nugu_directive_peek_dialog_id ( const NuguDirective ndir)

Get the dialog-request-id of directive.

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

◆ nugu_directive_peek_referrer_id()

NUGU_API const char* nugu_directive_peek_referrer_id ( const NuguDirective ndir)

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

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

◆ nugu_directive_peek_json()

NUGU_API const char* nugu_directive_peek_json ( const NuguDirective ndir)

Get the payload of directive.

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

◆ nugu_directive_is_active()

NUGU_API int nugu_directive_is_active ( const NuguDirective ndir)

Get the active status of directive. "active" means the directive is added to the directive sequencer.

Parameters
[in]ndirdirective object
Returns
status
Return values
1active
0not active
-1failure
See also
nugu_directive_set_active()

◆ nugu_directive_set_active()

NUGU_API int nugu_directive_set_active ( NuguDirective ndir,
int  flag 
)

Set the active status of directive.

Parameters
[in]ndirdirective object
[in]flagactive status(1 = active, 0 = not active)
Returns
result
Return values
0success
-1failure
See also
nugu_directive_is_active()

◆ nugu_directive_add_data()

NUGU_API int nugu_directive_add_data ( NuguDirective ndir,
size_t  length,
const unsigned char *  data 
)

Add attachment data to directive. (e.g. TTS payload)

Parameters
[in]ndirdirective object
[in]lengthlength of data
[in]datadata
Returns
result
Return values
0success
-1failure
See also
nugu_directive_set_data_callback()
nugu_directive_remove_data_callback()
nugu_directive_get_data()
nugu_directive_get_data_size()

◆ nugu_directive_close_data()

NUGU_API int nugu_directive_close_data ( NuguDirective ndir)

Set the attachment data status to "Received all data".

Parameters
[in]ndirdirective object
Returns
result
Return values
0success
-1failure
See also
nugu_directive_is_data_end()

◆ nugu_directive_is_data_end()

NUGU_API int nugu_directive_is_data_end ( const NuguDirective ndir)

Get the attachment data status.

Parameters
[in]ndirdirective object
Returns
status
Return values
0Data receiving is not yet completed.
1Received all data
-1failure
See also
nugu_directive_close_data()

◆ nugu_directive_set_media_type()

NUGU_API int nugu_directive_set_media_type ( NuguDirective ndir,
const char *  type 
)

Set the attachment mime type.

Parameters
[in]ndirdirective object
[in]typemime type
Returns
result
Return values
0success
-1failure
See also
nugu_directive_peek_media_type()

◆ nugu_directive_peek_media_type()

NUGU_API const char* nugu_directive_peek_media_type ( const NuguDirective ndir)

Get the attachment mime type.

Parameters
[in]ndirdirective object
Returns
mime type
See also
nugu_directive_set_media_type()

◆ nugu_directive_get_data()

NUGU_API unsigned char* nugu_directive_get_data ( NuguDirective ndir,
size_t *  length 
)

Get the attachment data received so far. When this function is called, the internal receive buffer is cleared.

Parameters
[in]ndirdirective object
[out]lengthattachment length
Returns
received attachment data. Developer must free the data manually.
See also
nugu_directive_get_data_size()

◆ nugu_directive_get_data_size()

NUGU_API size_t nugu_directive_get_data_size ( const NuguDirective ndir)

Get the size of attachment data received so far.

Parameters
[in]ndirdirective object
Returns
size of attachment data
See also
nugu_directive_get_data()

◆ nugu_directive_set_blocking_policy()

NUGU_API int nugu_directive_set_blocking_policy ( NuguDirective ndir,
enum nugu_directive_medium  medium,
int  is_block 
)

Set the medium of BlockingPolicy for the directive.

Parameters
[in]ndirdirective object
[in]mediummedium of BlockingPolicy
[in]is_blockblocking status (1 = block, 0 = non-block)
Returns
result
Return values
0success
-1failure
See also
nugu_directive_get_blocking_medium()
nugu_directive_get_blocking_medium_string()
nugu_directive_is_blocking()

◆ nugu_directive_get_blocking_medium()

NUGU_API enum nugu_directive_medium nugu_directive_get_blocking_medium ( const NuguDirective ndir)

Get the medium of BlockingPolicy for the directive.

Parameters
[in]ndirdirective object
Returns
medium of BlockingPolicy
See also
nugu_directive_set_blocking_policy()
nugu_directive_get_blocking_medium_string()

◆ nugu_directive_get_blocking_medium_string()

NUGU_API const char* nugu_directive_get_blocking_medium_string ( const NuguDirective ndir)

Get the medium string of BlockingPolicy for the directive.

Parameters
[in]ndirdirective object
Returns
medium of BlockingPolicy
See also
nugu_directive_set_blocking_policy()
nugu_directive_get_blocking_medium()

◆ nugu_directive_is_blocking()

NUGU_API int nugu_directive_is_blocking ( const NuguDirective ndir)

Get the blocking status of BlockingPolicy for the directive.

Parameters
[in]ndirdirective object
Returns
blocking status of BlockingPolicy
Return values
0non-block
1block
-1failure
See also
nugu_directive_set_blocking_policy()

◆ nugu_directive_set_data_callback()

NUGU_API int nugu_directive_set_data_callback ( NuguDirective ndir,
NuguDirectiveDataCallback  callback,
void *  userdata 
)

Set attachment received event callback.

Parameters
[in]ndirdirective object
[in]callbackcallback function
[in]userdatadata to pass to the user callback
Returns
result
Return values
0success
-1failure
See also
nugu_directive_remove_data_callback()

◆ nugu_directive_remove_data_callback()

NUGU_API int nugu_directive_remove_data_callback ( NuguDirective ndir)

Remove attachment received event callback.

Parameters
[in]ndirdirective object
Returns
result
Return values
0success
-1failure
See also
nugu_directive_set_data_callback()