Tizen Native API
9.0
|
The cion group API provides functions for cion group.
Required Header
#include <cion.h>
Overview
The cion group is used to subscribe and publish data. It provides functions to create cion group and communication APIs.
Functions | |
int | cion_group_create (cion_group_h *group, const char *topic_name, cion_security_h security) |
Creates a Cion group handle. | |
int | cion_group_destroy (cion_group_h group) |
Destroys the group handle. | |
int | cion_group_subscribe (cion_group_h group) |
Subscribes to a topic that the group handle has. | |
int | cion_group_unsubscribe (cion_group_h group) |
Unsubscribes from topic that the group handle has. | |
int | cion_group_publish (cion_group_h group, cion_payload_h data) |
Publishes data to the group. | |
int | cion_group_add_payload_received_cb (cion_group_h group, cion_group_payload_received_cb cb, void *user_data) |
Adds callback function to receive payload. | |
int | cion_group_remove_payload_received_cb (cion_group_h group, cion_group_payload_received_cb cb) |
Removes callback function to receive payload. | |
int | cion_group_add_joined_cb (cion_group_h group, cion_group_joined_cb cb, void *user_data) |
Adds callback function for join event. | |
int | cion_group_remove_joined_cb (cion_group_h group, cion_group_joined_cb cb) |
Removes callback function for join event. | |
int | cion_group_add_left_cb (cion_group_h group, cion_group_left_cb cb, void *user_data) |
Adds callback function to get peer leaving information. | |
int | cion_group_remove_left_cb (cion_group_h group, cion_group_left_cb cb) |
Removes callback function to get peer leaving information. | |
Typedefs | |
typedef void * | cion_group_h |
The Cion group handle. | |
typedef void(* | cion_group_payload_received_cb )(const char *topic_name, const cion_peer_info_h peer_info, cion_payload_h payload, void *user_data) |
Called when the payload is received. | |
typedef void(* | cion_group_joined_cb )(const char *topic_name, const cion_peer_info_h peer_info, void *user_data) |
Called when a peer joins a topic. | |
typedef void(* | cion_group_left_cb )(const char *topic_name, const cion_peer_info_h peer_info, void *user_data) |
Called when a peer leaves a topic. |
Typedef Documentation
typedef void* cion_group_h |
The Cion group handle.
- Since :
- 6.5
typedef void(* cion_group_joined_cb)(const char *topic_name, const cion_peer_info_h peer_info, void *user_data) |
Called when a peer joins a topic.
- Since :
- 6.5
- Parameters:
-
[in] topic_name The name of topic
The topic_name can be used only in the callback. To use outside, make a copy.[in] peer_info The Cion peer information handle
The peer_info can be used only in the callback. To use outside, make a copy.[in] user_data The user data
typedef void(* cion_group_left_cb)(const char *topic_name, const cion_peer_info_h peer_info, void *user_data) |
Called when a peer leaves a topic.
- Since :
- 6.5
- Parameters:
-
[in] topic_name The name of topic
The topic_name can be used only in the callback. To use outside, make a copy.[in] peer_info The Cion peer information handle
The peer_info can be used only in the callback. To use outside, make a copy.[in] user_data The user data
- See also:
- cion_group_add_left_cb()
- cion_peer_info_h
typedef void(* cion_group_payload_received_cb)(const char *topic_name, const cion_peer_info_h peer_info, cion_payload_h payload, void *user_data) |
Called when the payload is received.
- Since :
- 6.5
- Parameters:
-
[in] topic_name The name of topic
The topic_name can be used only in the callback. To use outside, make a copy.[in] peer_info The Cion peer information handle
The peer_info can be used only in the callback. To use outside, make a copy.[in] payload The received payload
The payload can be used only in the callback.
The payload should not be released.[in] user_data The user data
Function Documentation
int cion_group_add_joined_cb | ( | cion_group_h | group, |
cion_group_joined_cb | cb, | ||
void * | user_data | ||
) |
Adds callback function for join event.
- Since :
- 6.5
- Parameters:
-
[in] group The Cion group handle [in] cb The callback function [in] user_data The user data
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_INVALID_PARAMETER Invalid parameter
- Sample code:
#include <cion.h> { int ret; ret = cion_group_add_joined_cb(group, _cion_group_joined_cb, NULL); }
int cion_group_add_left_cb | ( | cion_group_h | group, |
cion_group_left_cb | cb, | ||
void * | user_data | ||
) |
Adds callback function to get peer leaving information.
- Since :
- 6.5
- Parameters:
-
[in] group The Cion group handle [in] cb The callback function [in] user_data The user_data
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_INVALID_PARAMETER Invalid parameter
- Sample code:
#include <cion.h> { int ret; ret = cion_group_add_left_cb(group, _cion_group_left_cb, NULL); }
int cion_group_add_payload_received_cb | ( | cion_group_h | group, |
cion_group_payload_received_cb | cb, | ||
void * | user_data | ||
) |
Adds callback function to receive payload.
- Since :
- 6.5
- Parameters:
-
[in] group The Cion group handle [in] cb The callback function [in] user_data The user data
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_INVALID_PARAMETER Invalid parameter
- Sample code:
#include <cion.h> { int ret; ret = cion_group_add_payload_received_cb(group, _cion_group_payload_received_cb, NULL); }
int cion_group_create | ( | cion_group_h * | group, |
const char * | topic_name, | ||
cion_security_h | security | ||
) |
Creates a Cion group handle.
The Cion group is the group to share data.
The users can subscribe the group that named topic and publish the data to share.
- Since :
- 6.5
- Remarks:
- group must be released using cion_group_destroy().
- Max length of topic_name including the null terminator is 512.
- Parameters:
-
[out] group The Cion group handle [in] topic_name The name of topic [in] security The Cion security handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_NOT_SUPPORTED Not supported CION_ERROR_INVALID_PARAMETER Invalid parameter CION_ERROR_OUT_OF_MEMORY Out of memory
- Sample code:
#include <cion.h> { int ret; cion_group_h group = NULL; ret = cion_group_create(&group, "mytopic", NULL); }
int cion_group_destroy | ( | cion_group_h | group | ) |
Destroys the group handle.
- Since :
- 6.5
- Parameters:
-
[in] group The Cion group handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- cion_group_create()
- Sample code:
#include <cion.h> { int ret; ret = cion_group_destroy(group); }
int cion_group_publish | ( | cion_group_h | group, |
cion_payload_h | data | ||
) |
Publishes data to the group.
- Since :
- 6.5
- Parameters:
-
[in] group The Cion group handle [in] data The data
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_INVALID_PARAMETER Invalid parameter CION_ERROR_INVALID_OPERATION Invalid operation
- Sample code:
#include <cion.h> { int ret; ret = cion_group_publish(group, payload); }
int cion_group_remove_joined_cb | ( | cion_group_h | group, |
cion_group_joined_cb | cb | ||
) |
Removes callback function for join event.
- Since :
- 6.5
- Parameters:
-
[in] group The Cion group handle [in] cb The callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_INVALID_PARAMETER Invalid parameter
- Sample code:
#include <cion.h> { int ret; ret = cion_group_remove_joined_cb(group, _cion_group_joined_cb); }
int cion_group_remove_left_cb | ( | cion_group_h | group, |
cion_group_left_cb | cb | ||
) |
Removes callback function to get peer leaving information.
- Since :
- 6.5
- Parameters:
-
[in] group The Cion group handle [in] cb The callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_INVALID_PARAMETER Invalid parameter
- Sample code:
#include <cion.h> { int ret; ret = cion_group_remove_left_cb(group, _cion_group_left_cb); }
int cion_group_remove_payload_received_cb | ( | cion_group_h | group, |
cion_group_payload_received_cb | cb | ||
) |
Removes callback function to receive payload.
- Since :
- 6.5
- Parameters:
-
[in] group The Cion group handle [in] cb The callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_INVALID_PARAMETER Invalid parameter
- Sample code:
#include <cion.h> { int ret; ret = cion_group_remove_payload_received_cb(group, _cion_group_payload_received_cb); }
int cion_group_subscribe | ( | cion_group_h | group | ) |
Subscribes to a topic that the group handle has.
- Since :
- 6.5
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/d2d.datasharing
http://tizen.org/privilege/internet
- Parameters:
-
[in] group The Cion group handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_PERMISSION_DENIED Permission denied CION_ERROR_INVALID_PARAMETER Invalid parameter
- Sample code:
#include <cion.h> { int ret; ret = cion_group_subscribe(group); }
int cion_group_unsubscribe | ( | cion_group_h | group | ) |
Unsubscribes from topic that the group handle has.
- Since :
- 6.5
- Parameters:
-
[in] group The Cion group handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CION_ERROR_NONE Successful CION_ERROR_INVALID_PARAMETER Invalid parameter
- Sample code:
#include <cion.h> { int ret; ret = cion_group_unsubscribe(group); }