Skip to content

Commit

Permalink
post -> put
Browse files Browse the repository at this point in the history
  • Loading branch information
WAvdBeek committed Nov 29, 2022
1 parent de723c3 commit 3ea4b22
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions example_sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ get_o_1_1(oc_request_t *request, oc_interface_mask_t interfaces,
}

/**
* post method for "/p/o_1_1" resource.
* put method for "/p/o_1_1" resource.
* The function has as input the request body, which are the input values of the
* POST method.
* PUT method.
* The input values (as a set) are checked if all supplied values are correct.
* If the input values are correct, they will be assigned to the global property
* values.
Expand All @@ -227,13 +227,13 @@ get_o_1_1(oc_request_t *request, oc_interface_mask_t interfaces,
* @param user_data the supplied user data.
*/
void
post_o_1_1(oc_request_t *request, oc_interface_mask_t interfaces,
put_o_1_1(oc_request_t *request, oc_interface_mask_t interfaces,
void *user_data)
{
(void)interfaces;
(void)user_data;
bool error_state = false;
PRINT("-- Begin post_dpa_421_61:\n");
PRINT("-- Begin put_dpa_421_61:\n");
oc_rep_t *rep = NULL;

if (oc_is_redirected_request(request)) {
Expand All @@ -243,17 +243,17 @@ post_o_1_1(oc_request_t *request, oc_interface_mask_t interfaces,
while (rep != NULL) {
/* handle the type of payload correctly. */
if ((rep->iname == 1) && (rep->type == OC_REP_BOOL)) {
PRINT(" post_dpa_421_61 received : %d\n", rep->value.boolean);
PRINT(" put_dpa_421_61 received : %d\n", rep->value.boolean);
g_mystate = rep->value.boolean;
oc_send_cbor_response(request, OC_STATUS_CHANGED);
PRINT("-- End post_dpa_421_61\n");
PRINT("-- End put_dpa_421_61\n");
return;
}
rep = rep->next;
}

oc_send_response(request, OC_STATUS_BAD_REQUEST);
PRINT("-- End post_dpa_421_61\n");
PRINT("-- End put_dpa_421_61\n");
}

/**
Expand All @@ -268,7 +268,7 @@ post_o_1_1(oc_request_t *request, oc_interface_mask_t interfaces,
* - used interfaces
* URL Table
* | resource url | functional block/dpa | GET | POST |
* | resource url | functional block/dpa | GET | PUT |
* | ------------ | ---------------------- | ----| ---- |
* | /p/o_1_1 | urn:knx:dpa.421.61 | Yes | Yes |
*/
Expand Down Expand Up @@ -299,7 +299,7 @@ register_resources(void)
an interrupt when something is read from the hardware. */
/*oc_resource_set_observable(res_352, true); */
oc_resource_set_request_handler(res_pushbutton, OC_GET, get_o_1_1, NULL);
oc_resource_set_request_handler(res_pushbutton, OC_POST, post_o_1_1,
oc_resource_set_request_handler(res_pushbutton, OC_PUT, put_o_1_1,
NULL);
oc_add_resource(res_pushbutton);
}
Expand Down

0 comments on commit 3ea4b22

Please sign in to comment.