Skip to content

CoAP v4.1.1 #5864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions features/FEATURE_COMMON_PAL/mbed-coap/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log

## [v4.1.1](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.1.1)
**Closed issues:**
- IOTCLT-2203 mbed-coap does not handle PUT or POST if they indicate a smaller block size preference (fixed regression)

-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.1.0...v4.1.1)

## [v4.1.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.1.0)

-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.0.10...v4.1.0)

**New feature:**
- New API to disable automatic GET(BLOCK2) request sending.

**Closed issues:**
- IOTCLT-2203 mbed-coap does not handle PUT or POST if they indicate a smaller block size preference

## [v4.0.10](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.0.10)

-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.0.9...v4.0.10)
Expand Down
23 changes: 23 additions & 0 deletions features/FEATURE_COMMON_PAL/mbed-coap/mbed-coap/sn_coap_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,29 @@ extern void sn_coap_protocol_block_remove(struct coap_s *handle, sn_nsdl_addr_s
*/
extern int8_t sn_coap_protocol_delete_retransmission(struct coap_s *handle, uint16_t msg_id);

/**
* \fn int8_t sn_coap_convert_block_size(uint16_t block_size)
*
* \brief Utility function to convert block size.
*
* \param block_size Block size to convert.
*
* \return Value of range 0 - 6
*/
extern int8_t sn_coap_convert_block_size(uint16_t block_size);

/**
* \fn int8_t sn_coap_protocol_handle_block2_response_internally(struct coap_s *handle, uint8_t handle_response)
*
* \brief This function change the state whether CoAP library sends the block 2 response automatically or not.
*
* \param *handle Pointer to CoAP library handle
* \param handle_response 1 if CoAP library handles the response sending otherwise 0.
*
* \return 0 = success, -1 = failure
*/
extern int8_t sn_coap_protocol_handle_block2_response_internally(struct coap_s *handle, uint8_t handle_response);

#endif /* SN_COAP_PROTOCOL_H_ */

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion features/FEATURE_COMMON_PAL/mbed-coap/module.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mbed-coap",
"version": "4.0.10",
"version": "4.1.1",
"description": "COAP library",
"keywords": [
"coap",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ struct coap_s {
uint8_t sn_coap_resending_count;
uint8_t sn_coap_resending_intervall;
uint8_t sn_coap_duplication_buffer_size;
uint8_t sn_coap_internal_block2_resp_handling; /* If this is set then coap itself sends a next GET request automatically */
};

#ifdef __cplusplus
Expand Down
10 changes: 7 additions & 3 deletions features/FEATURE_COMMON_PAL/mbed-coap/source/sn_coap_builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,22 @@ sn_coap_hdr_s *sn_coap_build_response(struct coap_s *handle, sn_coap_hdr_s *coap
return NULL;
}

if (coap_packet_ptr->msg_type == COAP_MSG_TYPE_CONFIRMABLE) {
if (msg_code == COAP_MSG_CODE_REQUEST_GET) {
// Blockwise message response is new GET
coap_res_ptr->msg_type = COAP_MSG_TYPE_CONFIRMABLE;
coap_res_ptr->msg_code = (sn_coap_msg_code_e)msg_code;
/* msg_id needs to be set by the caller in this case */
}
else if (coap_packet_ptr->msg_type == COAP_MSG_TYPE_CONFIRMABLE) {
coap_res_ptr->msg_type = COAP_MSG_TYPE_ACKNOWLEDGEMENT;
coap_res_ptr->msg_code = (sn_coap_msg_code_e)msg_code;
coap_res_ptr->msg_id = coap_packet_ptr->msg_id;
}

else if (coap_packet_ptr->msg_type == COAP_MSG_TYPE_NON_CONFIRMABLE) {
coap_res_ptr->msg_type = COAP_MSG_TYPE_NON_CONFIRMABLE;
coap_res_ptr->msg_code = (sn_coap_msg_code_e)msg_code;
/* msg_id needs to be set by the caller in this case */
}

else {
handle->sn_coap_protocol_free( coap_res_ptr );
return NULL;
Expand Down
Loading