NUGU SDK Linux  1.7.5
nugu_directive.h
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_H__
18 #define __NUGU_DIRECTIVE_H__
19 
20 #include <stddef.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
47 typedef struct _nugu_directive NuguDirective;
48 
58 };
59 
63 typedef void (*NuguDirectiveDataCallback)(NuguDirective *ndir, int seq,
64  void *userdata);
65 
79 NuguDirective *nugu_directive_new(const char *name_space, const char *name,
80  const char *version, const char *msg_id,
81  const char *dialog_id,
82  const char *referrer_id, const char *json,
83  const char *groups);
84 
91 
98 
105 
111 const char *nugu_directive_peek_name(const NuguDirective *ndir);
112 
118 const char *nugu_directive_peek_groups(const NuguDirective *ndir);
119 
126 
132 const char *nugu_directive_peek_msg_id(const NuguDirective *ndir);
133 
140 
147 
153 const char *nugu_directive_peek_json(const NuguDirective *ndir);
154 
166 
177 
191 int nugu_directive_add_data(NuguDirective *ndir, size_t length,
192  const unsigned char *data);
193 
203 
214 
224 int nugu_directive_set_media_type(NuguDirective *ndir, const char *type);
225 
233 
242 unsigned char *nugu_directive_get_data(NuguDirective *ndir, size_t *length);
243 
251 
265  enum nugu_directive_medium medium,
266  int is_block);
267 
277 
285 const char *
287 
298 
310  NuguDirectiveDataCallback callback,
311  void *userdata);
312 
322 
327 #ifdef __cplusplus
328 }
329 #endif
330 
331 #endif
struct _nugu_directive NuguDirective
Directive object.
Definition: nugu_directive.h:47
int nugu_directive_is_active(const NuguDirective *ndir)
Get the active status of directive. "active" means the directive is added to the directive sequencer.
int nugu_directive_close_data(NuguDirective *ndir)
Set the attachment data status to "Received all data".
const char * nugu_directive_peek_namespace(const NuguDirective *ndir)
Get the namespace of directive.
enum nugu_directive_medium nugu_directive_get_blocking_medium(const NuguDirective *ndir)
Get the medium of BlockingPolicy for the directive.
const char * nugu_directive_get_blocking_medium_string(const NuguDirective *ndir)
Get the medium string of BlockingPolicy for the directive.
const char * nugu_directive_peek_name(const NuguDirective *ndir)
Get the name of directive.
const char * nugu_directive_peek_dialog_id(const NuguDirective *ndir)
Get the dialog-request-id of directive.
void nugu_directive_ref(NuguDirective *ndir)
Increment the reference count of the directive object.
const char * nugu_directive_peek_msg_id(const NuguDirective *ndir)
Get the message-id of directive.
int nugu_directive_set_active(NuguDirective *ndir, int flag)
Set the active status of directive.
void nugu_directive_unref(NuguDirective *ndir)
Decrement the reference count of the directive object.
int nugu_directive_add_data(NuguDirective *ndir, size_t length, const unsigned char *data)
Add attachment data to directive. (e.g. TTS payload)
const char * nugu_directive_peek_media_type(const NuguDirective *ndir)
Get the attachment mime type.
size_t nugu_directive_get_data_size(const NuguDirective *ndir)
Get the size of attachment data received so far.
int nugu_directive_is_data_end(const NuguDirective *ndir)
Get the attachment data status.
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.
int nugu_directive_is_blocking(const NuguDirective *ndir)
Get the blocking status of BlockingPolicy for the directive.
int nugu_directive_set_data_callback(NuguDirective *ndir, NuguDirectiveDataCallback callback, void *userdata)
Set attachment received event callback.
int nugu_directive_remove_data_callback(NuguDirective *ndir)
Remove attachment received event callback.
int nugu_directive_set_media_type(NuguDirective *ndir, const char *type)
Set the attachment mime type.
int nugu_directive_set_blocking_policy(NuguDirective *ndir, enum nugu_directive_medium medium, int is_block)
Set the medium of BlockingPolicy for the directive.
const char * nugu_directive_peek_json(const NuguDirective *ndir)
Get the payload of directive.
void(* NuguDirectiveDataCallback)(NuguDirective *ndir, int seq, void *userdata)
Callback prototype for receiving an attachment.
Definition: nugu_directive.h:63
const char * nugu_directive_peek_version(const NuguDirective *ndir)
Get the version of directive.
const char * nugu_directive_peek_referrer_id(const NuguDirective *ndir)
Get the referer-dialog-request-id of directive.
nugu_directive_medium
event types
Definition: nugu_directive.h:52
const char * nugu_directive_peek_groups(const NuguDirective *ndir)
Get the group of directive.
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...
@ NUGU_DIRECTIVE_MEDIUM_ANY
Definition: nugu_directive.h:56
@ NUGU_DIRECTIVE_MEDIUM_NONE
Definition: nugu_directive.h:55
@ NUGU_DIRECTIVE_MEDIUM_VISUAL
Definition: nugu_directive.h:54
@ NUGU_DIRECTIVE_MEDIUM_MAX
Definition: nugu_directive.h:57
@ NUGU_DIRECTIVE_MEDIUM_AUDIO
Definition: nugu_directive.h:53