NUGU SDK Linux  1.7.6
nugu_network_manager.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_NETWORK_MANAGER_H__
18 #define __NUGU_NETWORK_MANAGER_H__
19 
20 #include <nugu.h>
21 #include <base/nugu_event.h>
22 #include <base/nugu_directive.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
62 typedef enum nugu_network_status {
70 
80 
86  void *userdata);
87 
103 
108  NuguNetworkHandoffStatus status, void *userdata);
109 
116  void *userdata);
117 
124  NuguEvent *nev, int is_end, size_t length, unsigned char *data,
125  void *userdata);
126 
132 typedef void (*NuguNetworkManagerEventResultCallback)(int success,
133  const char *msg_id,
134  const char *dialog_id,
135  int code, void *userdata);
136 
143  int success, const char *event_msg_id, const char *event_dialog_id,
144  const char *json, void *userdata);
145 
151  void *userdata);
152 
158  const char *parent_msg_id, int seq, int is_end, const char *media_type,
159  size_t length, const void *data, void *userdata);
160 
168 };
169 
173 #define NUGU_NETWORK_MAX_ADDRESS 255
174 
182  int port;
185  int is_charge;
187 
197  NuguNetworkManagerStatusCallback callback, void *userdata);
198 
208  NuguNetworkManagerHandoffStatusCallback callback, void *userdata);
209 
219  NuguNetworkManagerEventSendNotifyCallback callback, void *userdata);
220 
230  NuguNetworkManagerEventDataSendNotifyCallback callback, void *userdata);
231 
241  NuguNetworkManagerEventResultCallback callback, void *userdata);
242 
252  NuguNetworkManagerEventResponseCallback callback, void *userdata);
253 
263  NuguNetworkManagerDirectiveCallback callback, void *userdata);
264 
274  NuguNetworkManagerAttachmentCallback callback, void *userdata);
275 
285 
292 
304 
316 NUGU_API int nugu_network_manager_send_event_data(NuguEvent *nev, int is_end,
317  size_t length,
318  unsigned char *data);
319 
329 
337 
342 
350 NUGU_API int nugu_network_manager_connect(void);
351 
360 
377 NUGU_API int
379 
387 
396 NUGU_API int nugu_network_manager_set_token(const char *token);
397 
403 NUGU_API const char *nugu_network_manager_peek_token(void);
404 
413 NUGU_API int nugu_network_manager_set_registry_url(const char *urlname);
414 
420 NUGU_API const char *nugu_network_manager_peek_registry_url(void);
421 
431 NUGU_API int nugu_network_manager_set_useragent(const char *app_version,
432  const char *additional_info);
433 
439 NUGU_API const char *nugu_network_manager_peek_useragent(void);
440 
445 NUGU_API const char *nugu_network_manager_peek_last_asr_time(void);
446 
455 NUGU_API int
457 
465 
470 #ifdef __cplusplus
471 }
472 #endif
473 
474 #endif
struct _nugu_directive NuguDirective
Directive object.
Definition: nugu_directive.h:48
struct _nugu_event NuguEvent
Event object.
Definition: nugu_event.h:59
NUGU_API int nugu_network_manager_set_handoff_status_callback(NuguNetworkManagerHandoffStatusCallback callback, void *userdata)
Set handoff status callback.
nugu_network_handoff_status
network handoff status
Definition: nugu_network_manager.h:93
NUGU_API int nugu_network_manager_set_directive_callback(NuguNetworkManagerDirectiveCallback callback, void *userdata)
Set directive receive callback.
void(* NuguNetworkManagerEventDataSendNotifyCallback)(NuguEvent *nev, int is_end, size_t length, unsigned char *data, void *userdata)
Callback prototype for notification of event data sending requests.
Definition: nugu_network_manager.h:123
void(* NuguNetworkManagerEventResponseCallback)(int success, const char *event_msg_id, const char *event_dialog_id, const char *json, void *userdata)
Callback prototype for directive response of event request.
Definition: nugu_network_manager.h:142
nugu_network_protocol
network protocols
Definition: nugu_network_manager.h:164
void(* NuguNetworkManagerHandoffStatusCallback)(NuguNetworkHandoffStatus status, void *userdata)
Callback prototype for handoff status events.
Definition: nugu_network_manager.h:107
void(* NuguNetworkManagerEventSendNotifyCallback)(NuguEvent *nev, void *userdata)
Callback prototype for notification of event sending requests.
Definition: nugu_network_manager.h:115
NUGU_API int nugu_network_manager_set_event_response_callback(NuguNetworkManagerEventResponseCallback callback, void *userdata)
Set event response callback.
NUGU_API int nugu_network_manager_force_close_event(NuguEvent *nev)
Force close the NUGU_EVENT_TYPE_WITH_ATTACHMENT type event.
NUGU_API int nugu_network_manager_initialize(void)
Initialize the network manager.
NUGU_API int nugu_network_manager_send_event_data(NuguEvent *nev, int is_end, size_t length, unsigned char *data)
Send the attachment data of event to server.
struct nugu_network_server_policy NuguNetworkServerPolicy
Server policy information used for network connections.
NUGU_API int nugu_network_manager_disconnect(void)
Disconnect from server.
void(* NuguNetworkManagerEventResultCallback)(int success, const char *msg_id, const char *dialog_id, int code, void *userdata)
Callback prototype for result of event transfer request.
Definition: nugu_network_manager.h:132
NUGU_API const char * nugu_network_manager_peek_token(void)
Get the access token value.
NUGU_API const char * nugu_network_manager_peek_last_asr_time(void)
Get the last ASR event time information.
NUGU_API int nugu_network_manager_connect(void)
Connect to server.
NUGU_API int nugu_network_manager_set_event_data_send_notify_callback(NuguNetworkManagerEventDataSendNotifyCallback callback, void *userdata)
Set event data send notify callback.
NUGU_API int nugu_network_manager_set_connection_type(NuguNetworkConnectionType ctype)
Set the connection type.
NUGU_API int nugu_network_manager_reset_connection(void)
Immediately disconnect the current connection and reconnect.
NUGU_API int nugu_network_manager_send_event(NuguEvent *nev)
Send the event to server.
NUGU_API const char * nugu_network_manager_peek_useragent(void)
Get the UserAgent information.
NUGU_API int nugu_network_manager_set_status(NuguNetworkStatus network_status)
Set the current network status.
NUGU_API int nugu_network_manager_set_event_result_callback(NuguNetworkManagerEventResultCallback callback, void *userdata)
Set event send result callback.
NUGU_API int nugu_network_manager_set_useragent(const char *app_version, const char *additional_info)
Set the HTTP header UserAgent information.
nugu_network_connection_type
network connection type
Definition: nugu_network_manager.h:76
NUGU_API NuguNetworkStatus nugu_network_manager_get_status(void)
Get the current network status.
NUGU_API int nugu_network_manager_set_event_send_notify_callback(NuguNetworkManagerEventSendNotifyCallback callback, void *userdata)
Set event send notify callback.
NUGU_API void nugu_network_manager_deinitialize(void)
De-initialize the network manager.
nugu_network_status
network status
Definition: nugu_network_manager.h:62
NUGU_API int nugu_network_manager_set_token(const char *token)
Set the access token value.
void(* NuguNetworkManagerDirectiveCallback)(NuguDirective *ndir, void *userdata)
Callback prototype for receiving directive.
Definition: nugu_network_manager.h:150
NUGU_API int nugu_network_manager_set_attachment_callback(NuguNetworkManagerAttachmentCallback callback, void *userdata)
Set attachment of directive receive callback.
#define NUGU_NETWORK_MAX_ADDRESS
maximum size of address
Definition: nugu_network_manager.h:173
void(* NuguNetworkManagerAttachmentCallback)(const char *parent_msg_id, int seq, int is_end, const char *media_type, size_t length, const void *data, void *userdata)
Callback prototype for receiving directive attachment.
Definition: nugu_network_manager.h:157
NUGU_API NuguNetworkConnectionType nugu_network_manager_get_connection_type(void)
Get the connection type.
NUGU_API int nugu_network_manager_set_status_callback(NuguNetworkManagerStatusCallback callback, void *userdata)
Set network status callback.
NUGU_API int nugu_network_manager_set_registry_url(const char *urlname)
Set the device gateway registry url.
enum nugu_network_status NuguNetworkStatus
network status
NUGU_API int nugu_network_manager_handoff(const NuguNetworkServerPolicy *policy)
Handoff the current connection to new server.
enum nugu_network_connection_type NuguNetworkConnectionType
network connection type
enum nugu_network_handoff_status NuguNetworkHandoffStatus
network handoff status
void(* NuguNetworkManagerStatusCallback)(NuguNetworkStatus status, void *userdata)
Callback prototype for receiving network status events.
Definition: nugu_network_manager.h:85
NUGU_API const char * nugu_network_manager_peek_registry_url(void)
Get the device gateway registry url.
@ NUGU_NETWORK_HANDOFF_READY
Definition: nugu_network_manager.h:97
@ NUGU_NETWORK_HANDOFF_COMPLETED
Definition: nugu_network_manager.h:100
@ NUGU_NETWORK_HANDOFF_FAILED
Definition: nugu_network_manager.h:94
@ NUGU_NETWORK_PROTOCOL_H2
Definition: nugu_network_manager.h:165
@ NUGU_NETWORK_PROTOCOL_UNKNOWN
Definition: nugu_network_manager.h:167
@ NUGU_NETWORK_PROTOCOL_H2C
Definition: nugu_network_manager.h:166
@ NUGU_NETWORK_CONNECTION_ONDEMAND
Definition: nugu_network_manager.h:78
@ NUGU_NETWORK_CONNECTION_ORIENTED
Definition: nugu_network_manager.h:77
@ NUGU_NETWORK_READY
Definition: nugu_network_manager.h:65
@ NUGU_NETWORK_FAILED
Definition: nugu_network_manager.h:67
@ NUGU_NETWORK_TOKEN_ERROR
Definition: nugu_network_manager.h:68
@ NUGU_NETWORK_CONNECTING
Definition: nugu_network_manager.h:64
@ NUGU_NETWORK_CONNECTED
Definition: nugu_network_manager.h:66
@ NUGU_NETWORK_DISCONNECTED
Definition: nugu_network_manager.h:63
Server policy information used for network connections.
Definition: nugu_network_manager.h:179
int is_charge
Definition: nugu_network_manager.h:185
int retry_count_limit
Definition: nugu_network_manager.h:183
enum nugu_network_protocol protocol
Definition: nugu_network_manager.h:180
int port
Definition: nugu_network_manager.h:182
int connection_timeout_ms
Definition: nugu_network_manager.h:184
char hostname[255+1]
Definition: nugu_network_manager.h:181