NUGU SDK Linux  1.7.6
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 #include <nugu.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
48 typedef struct _nugu_directive NuguDirective;
49 
59 };
60 
64 typedef void (*NuguDirectiveDataCallback)(NuguDirective *ndir, int seq,
65  void *userdata);
66 
80 NUGU_API NuguDirective *
81 nugu_directive_new(const char *name_space, const char *name,
82  const char *version, const char *msg_id,
83  const char *dialog_id, const char *referrer_id,
84  const char *json, const char *groups);
85 
91 NUGU_API void nugu_directive_ref(NuguDirective *ndir);
92 
98 NUGU_API void nugu_directive_unref(NuguDirective *ndir);
99 
105 NUGU_API const char *nugu_directive_peek_namespace(const NuguDirective *ndir);
106 
112 NUGU_API const char *nugu_directive_peek_name(const NuguDirective *ndir);
113 
119 NUGU_API const char *nugu_directive_peek_groups(const NuguDirective *ndir);
120 
126 NUGU_API const char *nugu_directive_peek_version(const NuguDirective *ndir);
127 
133 NUGU_API const char *nugu_directive_peek_msg_id(const NuguDirective *ndir);
134 
140 NUGU_API const char *nugu_directive_peek_dialog_id(const NuguDirective *ndir);
141 
147 NUGU_API const char *nugu_directive_peek_referrer_id(const NuguDirective *ndir);
148 
154 NUGU_API const char *nugu_directive_peek_json(const NuguDirective *ndir);
155 
166 NUGU_API int nugu_directive_is_active(const NuguDirective *ndir);
167 
177 NUGU_API int nugu_directive_set_active(NuguDirective *ndir, int flag);
178 
192 NUGU_API int nugu_directive_add_data(NuguDirective *ndir, size_t length,
193  const unsigned char *data);
194 
204 
214 NUGU_API int nugu_directive_is_data_end(const NuguDirective *ndir);
215 
226  const char *type);
227 
234 NUGU_API const char *nugu_directive_peek_media_type(const NuguDirective *ndir);
235 
244 NUGU_API unsigned char *nugu_directive_get_data(NuguDirective *ndir,
245  size_t *length);
246 
253 NUGU_API size_t nugu_directive_get_data_size(const NuguDirective *ndir);
254 
268  NuguDirective *ndir, enum nugu_directive_medium medium, int is_block);
269 
279 
287 NUGU_API const char *
289 
299 NUGU_API int nugu_directive_is_blocking(const NuguDirective *ndir);
300 
311 NUGU_API int
313  NuguDirectiveDataCallback callback,
314  void *userdata);
315 
325 
330 #ifdef __cplusplus
331 }
332 #endif
333 
334 #endif
NUGU_API int nugu_directive_is_data_end(const NuguDirective *ndir)
Get the attachment data status.
struct _nugu_directive NuguDirective
Directive object.
Definition: nugu_directive.h:48
NUGU_API int nugu_directive_close_data(NuguDirective *ndir)
Set the attachment data status to "Received all data".
NUGU_API int nugu_directive_set_data_callback(NuguDirective *ndir, NuguDirectiveDataCallback callback, void *userdata)
Set attachment received event callback.
NUGU_API int nugu_directive_set_media_type(NuguDirective *ndir, const char *type)
Set the attachment mime type.
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.
NUGU_API void nugu_directive_ref(NuguDirective *ndir)
Increment the reference count of the directive object.
NUGU_API int nugu_directive_remove_data_callback(NuguDirective *ndir)
Remove attachment received event callback.
NUGU_API const char * nugu_directive_peek_referrer_id(const NuguDirective *ndir)
Get the referer-dialog-request-id of directive.
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.
NUGU_API int nugu_directive_is_blocking(const NuguDirective *ndir)
Get the blocking status of BlockingPolicy for the directive.
NUGU_API const char * nugu_directive_peek_name(const NuguDirective *ndir)
Get the name of directive.
NUGU_API const char * nugu_directive_peek_namespace(const NuguDirective *ndir)
Get the namespace of directive.
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)
NUGU_API const char * nugu_directive_peek_dialog_id(const NuguDirective *ndir)
Get the dialog-request-id of directive.
NUGU_API int nugu_directive_set_active(NuguDirective *ndir, int flag)
Set the active status of directive.
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...
NUGU_API const char * nugu_directive_peek_version(const NuguDirective *ndir)
Get the version of directive.
NUGU_API size_t nugu_directive_get_data_size(const NuguDirective *ndir)
Get the size of attachment data received so far.
NUGU_API enum nugu_directive_medium nugu_directive_get_blocking_medium(const NuguDirective *ndir)
Get the medium of BlockingPolicy for the directive.
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.
NUGU_API const char * nugu_directive_peek_msg_id(const NuguDirective *ndir)
Get the message-id of directive.
NUGU_API const char * nugu_directive_peek_media_type(const NuguDirective *ndir)
Get the attachment mime type.
NUGU_API const char * nugu_directive_peek_groups(const NuguDirective *ndir)
Get the group of directive.
void(* NuguDirectiveDataCallback)(NuguDirective *ndir, int seq, void *userdata)
Callback prototype for receiving an attachment.
Definition: nugu_directive.h:64
NUGU_API const char * nugu_directive_get_blocking_medium_string(const NuguDirective *ndir)
Get the medium string of BlockingPolicy for the directive.
nugu_directive_medium
event types
Definition: nugu_directive.h:53
NUGU_API const char * nugu_directive_peek_json(const NuguDirective *ndir)
Get the payload of directive.
NUGU_API void nugu_directive_unref(NuguDirective *ndir)
Decrement the reference count of the directive object.
@ NUGU_DIRECTIVE_MEDIUM_ANY
Definition: nugu_directive.h:57
@ NUGU_DIRECTIVE_MEDIUM_NONE
Definition: nugu_directive.h:56
@ NUGU_DIRECTIVE_MEDIUM_VISUAL
Definition: nugu_directive.h:55
@ NUGU_DIRECTIVE_MEDIUM_MAX
Definition: nugu_directive.h:58
@ NUGU_DIRECTIVE_MEDIUM_AUDIO
Definition: nugu_directive.h:54