Skip to content

Commit

Permalink
rename data types:
Browse files Browse the repository at this point in the history
- `oc_pushd_rsc_rep` => `oc_pushd_resource_rep`
- `oc_pushd_rsc_rep_t` => `oc_pushd_resource_rep_t`
  • Loading branch information
joochlee committed Sep 19, 2022
1 parent ba81c87 commit f5e4803
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
28 changes: 14 additions & 14 deletions api/oc_push.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ OC_MEMB(rep_instance_memb, oc_rep_t, 1);
* @brief memory block definition for storing pushed resource representation
* list
*/
OC_MEMB(pushd_rsc_rep_instance_memb, oc_pushd_rsc_rep_t, 1);
OC_MEMB(pushd_rsc_rep_instance_memb, oc_pushd_resource_rep_t, 1);

/*
* @brief `pushed_rsc_list` keeps Resource representation of Pushed Resources
Expand Down Expand Up @@ -189,7 +189,7 @@ enum {
* if this callback function is provided by user, it will called whenever new
* push is arrived...
*/
static void (*oc_push_arrived)(oc_pushd_rsc_rep_t *) = NULL;
static void (*oc_push_arrived)(oc_pushd_resource_rep_t *) = NULL;

#define pp_statestr(i) (pp_state_strs[(i)])

Expand Down Expand Up @@ -1031,13 +1031,13 @@ _build_rep_payload(CborEncoder *parent, oc_rep_t *rep)
*
* @param uri uri for pushed Resource
* @param device_index device index which pushed Resource belongs to
* @return `oc_pushd_rsc_rep_t` instance
* @return `oc_pushd_resource_rep_t` instance
*/
static oc_pushd_rsc_rep_t *
static oc_pushd_resource_rep_t *
_find_pushd_rsc_rep_by_uri(oc_string_t *uri, size_t device_index)
{
oc_pushd_rsc_rep_t *pushd_rsc_rep =
(oc_pushd_rsc_rep_t *)(oc_list_head(pushd_rsc_rep_list));
oc_pushd_resource_rep_t *pushd_rsc_rep =
(oc_pushd_resource_rep_t *)(oc_list_head(pushd_rsc_rep_list));

while (pushd_rsc_rep) {
if (!strcmp(oc_string(pushd_rsc_rep->resource->uri), oc_string(*uri)) &&
Expand Down Expand Up @@ -1065,7 +1065,7 @@ get_pushd_rsc(oc_request_t *request, oc_interface_mask_t iface_mask,
(void)user_data;

int result = OC_STATUS_OK;
oc_pushd_rsc_rep_t *pushd_rsc_rep = _find_pushd_rsc_rep_by_uri(
oc_pushd_resource_rep_t *pushd_rsc_rep = _find_pushd_rsc_rep_by_uri(
&request->resource->uri, request->resource->device);

if (!pushd_rsc_rep) {
Expand Down Expand Up @@ -1468,7 +1468,7 @@ post_pushd_rsc(oc_request_t *request, oc_interface_mask_t iface_mask,
int result = OC_STATUS_CHANGED;
oc_rep_t *rep = request->request_payload;
oc_rep_t *common_property;
oc_pushd_rsc_rep_t *pushd_rsc_rep;
oc_pushd_resource_rep_t *pushd_rsc_rep;
oc_recvs_t *recvs_instance;
oc_recv_t *recv_obj;

Expand Down Expand Up @@ -1673,7 +1673,7 @@ get_pushrecv(oc_request_t *request, oc_interface_mask_t iface_mask,

/*
* @brief purge app resource (`oc_resource_t`) and resource representation
* instance (`oc_pushd_rsc_rep_t`) accessed through `uri` in device whose
* instance (`oc_pushd_resource_rep_t`) accessed through `uri` in device whose
* index is `device_index`
*
* @param uri URI of app resource to be purged
Expand All @@ -1684,7 +1684,7 @@ _purge_pushd_rsc(oc_string_t *uri, size_t device_index)
{
oc_resource_t *pushd_rsc = oc_ri_get_app_resource_by_uri(
oc_string(*uri), oc_string_len(*uri), device_index);
oc_pushd_rsc_rep_t *pushd_rsc_rep =
oc_pushd_resource_rep_t *pushd_rsc_rep =
_find_pushd_rsc_rep_by_uri(uri, device_index);

if (pushd_rsc_rep) {
Expand Down Expand Up @@ -1714,7 +1714,7 @@ _purge_pushd_rsc(oc_string_t *uri, size_t device_index)

/*
* @brief create app Resource (`oc_resource_t`) and Resource representation
* (`oc_pushd_rsc_rep_t`) instance for the pushed Resource
* (`oc_pushd_resource_rep_t`) instance for the pushed Resource
*
* @param recv_obj receiver object that points pushed resource
* @param resource Push Receiver resource
Expand Down Expand Up @@ -1756,8 +1756,8 @@ _create_pushd_rsc(oc_recv_t *recv_obj, const oc_resource_t *resource)
result = false;

/* create resource representation container for this resource */
oc_pushd_rsc_rep_t *pushd_rsc_rep_instance =
(oc_pushd_rsc_rep_t *)oc_memb_alloc(&pushd_rsc_rep_instance_memb);
oc_pushd_resource_rep_t *pushd_rsc_rep_instance =
(oc_pushd_resource_rep_t *)oc_memb_alloc(&pushd_rsc_rep_instance_memb);
if (pushd_rsc_rep_instance) {
pushd_rsc_rep_instance->resource = pushd_rsc;
pushd_rsc_rep_instance->rep = NULL;
Expand Down Expand Up @@ -1813,7 +1813,7 @@ static void
_update_recv_obj(oc_recv_t *recv_obj, const oc_recvs_t *recvs_instance,
oc_rep_t *rep)
{
oc_pushd_rsc_rep_t *pushd_rsc_rep;
oc_pushd_resource_rep_t *pushd_rsc_rep;

while (rep) {
switch (rep->type) {
Expand Down
12 changes: 6 additions & 6 deletions apps/docs/push.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,20 @@ OCF Push Notification is composed of 3 players: **Origin Server**, **Target Serv
```c
/**
* @brief object used to store Resource pushed to
* "oic.r.pshreceiver:receivers[i].receiveruri"
* "oic.r.pushreceiver:receivers[i].receiveruri"
*/
typedef struct oc_pushd_rsc_rep
typedef struct oc_pushd_resource_rep
{
struct oc_pushd_rsc_rep *next;
struct oc_pushd_resource_rep *next;
oc_resource_t
*resource; ///< used to point any pushed Resource managed by iotivity-lite
oc_rep_t *rep; ///< payload of pushed Resource
} oc_pushd_rsc_rep_t;
} oc_pushd_resource_rep_t;

/**
* @brief callback function called whenever new push arrives
*/
typedef void (*oc_on_push_arrived_t)(oc_pushd_rsc_rep_t *);
typedef void (*oc_on_push_arrived_t)(oc_pushd_resource_rep_t *);

/**
* @brief set callback function called whenever new push arrives
Expand All @@ -190,7 +190,7 @@ OCF Push Notification is composed of 3 players: **Origin Server**, **Target Serv
- Example:
```c
/* callback function example */
void push_arrived(oc_pushd_rsc_rep_t *push_payload)
void push_arrived(oc_pushd_resource_rep_t *push_payload)
{
printf("new push arrives (path: %s, rt: ", oc_string(push_payload->resource->uri));
for (size_t i=0; i<oc_string_array_get_allocated_size(push_payload->resource->types); i++)
Expand Down
2 changes: 1 addition & 1 deletion apps/push_configurator_multithread_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ typedef struct
} custom_func_s;

void
push_arrived(oc_pushd_rsc_rep_t *push_payload)
push_arrived(oc_pushd_resource_rep_t *push_payload)
{
PRINT("new push arrives (path: %s, rt: ",
oc_string(push_payload->resource->uri));
Expand Down
2 changes: 1 addition & 1 deletion apps/push_originserver_multithread_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static int brightness2;
* callback function to be called whenever new PUSH arrives
*/
void
push_arrived(oc_pushd_rsc_rep_t *push_payload)
push_arrived(oc_pushd_resource_rep_t *push_payload)
{
printf("new push arrives (path: %s, rt: ",
oc_string(push_payload->resource->uri));
Expand Down
2 changes: 1 addition & 1 deletion apps/push_targetserver_multithread_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pthread_mutex_t app_mutex;
int quit = 0;

void
push_arrived(oc_pushd_rsc_rep_t *push_payload)
push_arrived(oc_pushd_resource_rep_t *push_payload)
{
printf("new push arrives (path: %s, rt: ",
oc_string(push_payload->resource->uri));
Expand Down
10 changes: 5 additions & 5 deletions include/oc_push.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ extern "C" {

/**
* @brief object used to store Resource pushed to
* "oic.r.pshreceiver:receivers[i].receiveruri"
* "oic.r.pushreceiver:receivers[i].receiveruri"
*/
typedef struct oc_pushd_rsc_rep
typedef struct oc_pushd_resource_rep
{
struct oc_pushd_rsc_rep *next;
struct oc_pushd_resource_rep *next;
oc_resource_t
*resource; ///< used to point any pushed Resource managed by iotivity-lite
oc_rep_t *rep; ///< payload of pushed Resource
} oc_pushd_rsc_rep_t;
} oc_pushd_resource_rep_t;

/**
* @brief callback function called whenever new push arrives
*/
typedef void (*oc_on_push_arrived_t)(oc_pushd_rsc_rep_t *);
typedef void (*oc_on_push_arrived_t)(oc_pushd_resource_rep_t *);

/**
* @brief print payload of Resource in user friendly format
Expand Down

0 comments on commit f5e4803

Please sign in to comment.