NUGU SDK Linux
1.7.6
|
Network management. More...
Classes | |
struct | nugu_network_server_policy |
Server policy information used for network connections. More... | |
Macros | |
#define | NUGU_NETWORK_MAX_ADDRESS 255 |
maximum size of address | |
Typedefs | |
typedef enum nugu_network_connection_type | NuguNetworkConnectionType |
network connection type More... | |
typedef enum nugu_network_handoff_status | NuguNetworkHandoffStatus |
network handoff status More... | |
typedef 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. More... | |
typedef void(* | NuguNetworkManagerDirectiveCallback) (NuguDirective *ndir, void *userdata) |
Callback prototype for receiving directive. More... | |
typedef void(* | NuguNetworkManagerEventDataSendNotifyCallback) (NuguEvent *nev, int is_end, size_t length, unsigned char *data, void *userdata) |
Callback prototype for notification of event data sending requests. More... | |
typedef 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. More... | |
typedef void(* | NuguNetworkManagerEventResultCallback) (int success, const char *msg_id, const char *dialog_id, int code, void *userdata) |
Callback prototype for result of event transfer request. More... | |
typedef void(* | NuguNetworkManagerEventSendNotifyCallback) (NuguEvent *nev, void *userdata) |
Callback prototype for notification of event sending requests. More... | |
typedef void(* | NuguNetworkManagerHandoffStatusCallback) (NuguNetworkHandoffStatus status, void *userdata) |
Callback prototype for handoff status events. | |
typedef void(* | NuguNetworkManagerStatusCallback) (NuguNetworkStatus status, void *userdata) |
Callback prototype for receiving network status events. More... | |
typedef struct nugu_network_server_policy | NuguNetworkServerPolicy |
Server policy information used for network connections. More... | |
typedef enum nugu_network_status | NuguNetworkStatus |
network status More... | |
Enumerations | |
enum | nugu_network_connection_type { NUGU_NETWORK_CONNECTION_ORIENTED , NUGU_NETWORK_CONNECTION_ONDEMAND } |
network connection type More... | |
enum | nugu_network_handoff_status { NUGU_NETWORK_HANDOFF_FAILED , NUGU_NETWORK_HANDOFF_READY , NUGU_NETWORK_HANDOFF_COMPLETED } |
network handoff status More... | |
enum | nugu_network_protocol { NUGU_NETWORK_PROTOCOL_H2 , NUGU_NETWORK_PROTOCOL_H2C , NUGU_NETWORK_PROTOCOL_UNKNOWN } |
network protocols More... | |
enum | nugu_network_status { NUGU_NETWORK_DISCONNECTED , NUGU_NETWORK_CONNECTING , NUGU_NETWORK_READY , NUGU_NETWORK_CONNECTED , NUGU_NETWORK_FAILED , NUGU_NETWORK_TOKEN_ERROR } |
network status More... | |
Functions | |
NUGU_API int | nugu_network_manager_connect (void) |
Connect to server. More... | |
NUGU_API void | nugu_network_manager_deinitialize (void) |
De-initialize the network manager. | |
NUGU_API int | nugu_network_manager_disconnect (void) |
Disconnect from server. More... | |
NUGU_API int | nugu_network_manager_force_close_event (NuguEvent *nev) |
Force close the NUGU_EVENT_TYPE_WITH_ATTACHMENT type event. More... | |
NUGU_API NuguNetworkConnectionType | nugu_network_manager_get_connection_type (void) |
Get the connection type. More... | |
NUGU_API NuguNetworkStatus | nugu_network_manager_get_status (void) |
Get the current network status. More... | |
NUGU_API int | nugu_network_manager_handoff (const NuguNetworkServerPolicy *policy) |
Handoff the current connection to new server. More... | |
NUGU_API int | nugu_network_manager_initialize (void) |
Initialize the network manager. More... | |
NUGU_API const char * | nugu_network_manager_peek_last_asr_time (void) |
Get the last ASR event time information. More... | |
NUGU_API const char * | nugu_network_manager_peek_registry_url (void) |
Get the device gateway registry url. More... | |
NUGU_API const char * | nugu_network_manager_peek_token (void) |
Get the access token value. More... | |
NUGU_API const char * | nugu_network_manager_peek_useragent (void) |
Get the UserAgent information. More... | |
NUGU_API int | nugu_network_manager_reset_connection (void) |
Immediately disconnect the current connection and reconnect. More... | |
NUGU_API int | nugu_network_manager_send_event (NuguEvent *nev) |
Send the event to server. More... | |
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. More... | |
NUGU_API int | nugu_network_manager_set_attachment_callback (NuguNetworkManagerAttachmentCallback callback, void *userdata) |
Set attachment of directive receive callback. More... | |
NUGU_API int | nugu_network_manager_set_connection_type (NuguNetworkConnectionType ctype) |
Set the connection type. More... | |
NUGU_API int | nugu_network_manager_set_directive_callback (NuguNetworkManagerDirectiveCallback callback, void *userdata) |
Set directive receive callback. More... | |
NUGU_API int | nugu_network_manager_set_event_data_send_notify_callback (NuguNetworkManagerEventDataSendNotifyCallback callback, void *userdata) |
Set event data send notify callback. More... | |
NUGU_API int | nugu_network_manager_set_event_response_callback (NuguNetworkManagerEventResponseCallback callback, void *userdata) |
Set event response callback. More... | |
NUGU_API int | nugu_network_manager_set_event_result_callback (NuguNetworkManagerEventResultCallback callback, void *userdata) |
Set event send result callback. More... | |
NUGU_API int | nugu_network_manager_set_event_send_notify_callback (NuguNetworkManagerEventSendNotifyCallback callback, void *userdata) |
Set event send notify callback. More... | |
NUGU_API int | nugu_network_manager_set_handoff_status_callback (NuguNetworkManagerHandoffStatusCallback callback, void *userdata) |
Set handoff status callback. More... | |
NUGU_API int | nugu_network_manager_set_registry_url (const char *urlname) |
Set the device gateway registry url. More... | |
NUGU_API int | nugu_network_manager_set_status (NuguNetworkStatus network_status) |
Set the current network status. More... | |
NUGU_API int | nugu_network_manager_set_status_callback (NuguNetworkManagerStatusCallback callback, void *userdata) |
Set network status callback. More... | |
NUGU_API int | nugu_network_manager_set_token (const char *token) |
Set the access token value. More... | |
NUGU_API int | nugu_network_manager_set_useragent (const char *app_version, const char *additional_info) |
Set the HTTP header UserAgent information. More... | |
Network management.
The network manager is responsible for managing connections and sending and receiving events and directives with the server.
typedef enum nugu_network_status NuguNetworkStatus |
network status
Basic connection status flow for connection-oriented
Basic connection status flow for connection-ondemand
Connection recovery flow for connection-oriented
typedef enum nugu_network_connection_type NuguNetworkConnectionType |
network connection type
typedef void(* NuguNetworkManagerStatusCallback) (NuguNetworkStatus status, void *userdata) |
Callback prototype for receiving network status events.
typedef enum nugu_network_handoff_status NuguNetworkHandoffStatus |
network handoff status
typedef void(* NuguNetworkManagerEventSendNotifyCallback) (NuguEvent *nev, void *userdata) |
Callback prototype for notification of event sending requests.
typedef void(* NuguNetworkManagerEventDataSendNotifyCallback) (NuguEvent *nev, int is_end, size_t length, unsigned char *data, void *userdata) |
Callback prototype for notification of event data sending requests.
typedef void(* NuguNetworkManagerEventResultCallback) (int success, const char *msg_id, const char *dialog_id, int code, void *userdata) |
Callback prototype for result of event transfer request.
typedef 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.
typedef void(* NuguNetworkManagerDirectiveCallback) (NuguDirective *ndir, void *userdata) |
Callback prototype for receiving directive.
typedef 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.
typedef struct nugu_network_server_policy NuguNetworkServerPolicy |
Server policy information used for network connections.
enum nugu_network_status |
network status
Basic connection status flow for connection-oriented
Basic connection status flow for connection-ondemand
Connection recovery flow for connection-oriented
network handoff status
NUGU_API int nugu_network_manager_set_status_callback | ( | NuguNetworkManagerStatusCallback | callback, |
void * | userdata | ||
) |
Set network status callback.
[in] | callback | callback function |
[in] | userdata | data to pass to the user callback |
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_set_handoff_status_callback | ( | NuguNetworkManagerHandoffStatusCallback | callback, |
void * | userdata | ||
) |
Set handoff status callback.
[in] | callback | callback function |
[in] | userdata | data to pass to the user callback |
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_set_event_send_notify_callback | ( | NuguNetworkManagerEventSendNotifyCallback | callback, |
void * | userdata | ||
) |
Set event send notify callback.
[in] | callback | callback function |
[in] | userdata | data to pass to the user callback |
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_set_event_data_send_notify_callback | ( | NuguNetworkManagerEventDataSendNotifyCallback | callback, |
void * | userdata | ||
) |
Set event data send notify callback.
[in] | callback | callback function |
[in] | userdata | data to pass to the user callback |
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_set_event_result_callback | ( | NuguNetworkManagerEventResultCallback | callback, |
void * | userdata | ||
) |
Set event send result callback.
[in] | callback | callback function |
[in] | userdata | data to pass to the user callback |
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_set_event_response_callback | ( | NuguNetworkManagerEventResponseCallback | callback, |
void * | userdata | ||
) |
Set event response callback.
[in] | callback | callback function |
[in] | userdata | data to pass to the user callback |
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_set_directive_callback | ( | NuguNetworkManagerDirectiveCallback | callback, |
void * | userdata | ||
) |
Set directive receive callback.
[in] | callback | callback function |
[in] | userdata | data to pass to the user callback |
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_set_attachment_callback | ( | NuguNetworkManagerAttachmentCallback | callback, |
void * | userdata | ||
) |
Set attachment of directive receive callback.
[in] | callback | callback function |
[in] | userdata | data to pass to the user callback |
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_set_status | ( | NuguNetworkStatus | network_status | ) |
Set the current network status.
[in] | network_status | network status |
0 | success |
-1 | failure |
NUGU_API NuguNetworkStatus nugu_network_manager_get_status | ( | void | ) |
Get the current network status.
NUGU_API int nugu_network_manager_send_event | ( | NuguEvent * | nev | ) |
Send the event to server.
[in] | nev | event object |
0 | success |
-1 | failure |
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.
[in] | nev | event object |
[in] | is_end | data is last(is_end=1) or not(is_end=0) |
[in] | length | length of data |
[in] | data | data to send |
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_force_close_event | ( | NuguEvent * | nev | ) |
Force close the NUGU_EVENT_TYPE_WITH_ATTACHMENT type event.
[in] | nev | event object |
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_initialize | ( | void | ) |
Initialize the network manager.
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_connect | ( | void | ) |
Connect to server.
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_disconnect | ( | void | ) |
Disconnect from server.
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_handoff | ( | const NuguNetworkServerPolicy * | policy | ) |
Handoff the current connection to new server.
0 | success |
-1 | failure |
When a handoff request is received, the client tries to connect to another server while maintaining the current connection.
NUGU_API int nugu_network_manager_reset_connection | ( | void | ) |
Immediately disconnect the current connection and reconnect.
0 | success |
-1 | failure |
NUGU_API int nugu_network_manager_set_token | ( | const char * | token | ) |
Set the access token value.
[in] | token | access token |
0 | success |
-1 | failure |
NUGU_API const char* nugu_network_manager_peek_token | ( | void | ) |
Get the access token value.
NUGU_API int nugu_network_manager_set_registry_url | ( | const char * | urlname | ) |
Set the device gateway registry url.
[in] | urlname | gateway registry url |
0 | success |
-1 | failure |
NUGU_API const char* nugu_network_manager_peek_registry_url | ( | void | ) |
Get the device gateway registry url.
NUGU_API int nugu_network_manager_set_useragent | ( | const char * | app_version, |
const char * | additional_info | ||
) |
Set the HTTP header UserAgent information.
[in] | app_version | application version (e.g. "0.1.0") |
[in] | additional_info | additional information or NULL |
0 | success |
-1 | failure |
NUGU_API const char* nugu_network_manager_peek_useragent | ( | void | ) |
Get the UserAgent information.
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_set_connection_type | ( | NuguNetworkConnectionType | ctype | ) |
Set the connection type.
ctype | connection type |
0 | success |
-1 | failure |
NUGU_API NuguNetworkConnectionType nugu_network_manager_get_connection_type | ( | void | ) |
Get the connection type.