Skip to content

Commit 8e683d5

Browse files
authored
Merge pull request #5864 from JaniSuonpera/CoAP_v4.0.11
CoAP v4.1.1
2 parents eb2f4ae + e0e3dbb commit 8e683d5

File tree

6 files changed

+252
-164
lines changed

6 files changed

+252
-164
lines changed

features/FEATURE_COMMON_PAL/mbed-coap/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Change Log
22

3+
## [v4.1.1](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.1.1)
4+
**Closed issues:**
5+
- IOTCLT-2203 mbed-coap does not handle PUT or POST if they indicate a smaller block size preference (fixed regression)
6+
7+
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.1.0...v4.1.1)
8+
9+
## [v4.1.0](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.1.0)
10+
11+
-[Full Changelog](https://github.com/ARMmbed/mbed-coap/compare/v4.0.10...v4.1.0)
12+
13+
**New feature:**
14+
- New API to disable automatic GET(BLOCK2) request sending.
15+
16+
**Closed issues:**
17+
- IOTCLT-2203 mbed-coap does not handle PUT or POST if they indicate a smaller block size preference
18+
319
## [v4.0.10](https://github.com/ARMmbed/mbed-coap/releases/tag/v4.0.10)
420

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

features/FEATURE_COMMON_PAL/mbed-coap/mbed-coap/sn_coap_protocol.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,29 @@ extern void sn_coap_protocol_block_remove(struct coap_s *handle, sn_nsdl_addr_s
213213
*/
214214
extern int8_t sn_coap_protocol_delete_retransmission(struct coap_s *handle, uint16_t msg_id);
215215

216+
/**
217+
* \fn int8_t sn_coap_convert_block_size(uint16_t block_size)
218+
*
219+
* \brief Utility function to convert block size.
220+
*
221+
* \param block_size Block size to convert.
222+
*
223+
* \return Value of range 0 - 6
224+
*/
225+
extern int8_t sn_coap_convert_block_size(uint16_t block_size);
226+
227+
/**
228+
* \fn int8_t sn_coap_protocol_handle_block2_response_internally(struct coap_s *handle, uint8_t handle_response)
229+
*
230+
* \brief This function change the state whether CoAP library sends the block 2 response automatically or not.
231+
*
232+
* \param *handle Pointer to CoAP library handle
233+
* \param handle_response 1 if CoAP library handles the response sending otherwise 0.
234+
*
235+
* \return 0 = success, -1 = failure
236+
*/
237+
extern int8_t sn_coap_protocol_handle_block2_response_internally(struct coap_s *handle, uint8_t handle_response);
238+
216239
#endif /* SN_COAP_PROTOCOL_H_ */
217240

218241
#ifdef __cplusplus

features/FEATURE_COMMON_PAL/mbed-coap/module.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mbed-coap",
3-
"version": "4.0.10",
3+
"version": "4.1.1",
44
"description": "COAP library",
55
"keywords": [
66
"coap",

features/FEATURE_COMMON_PAL/mbed-coap/source/include/sn_coap_protocol_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ struct coap_s {
229229
uint8_t sn_coap_resending_count;
230230
uint8_t sn_coap_resending_intervall;
231231
uint8_t sn_coap_duplication_buffer_size;
232+
uint8_t sn_coap_internal_block2_resp_handling; /* If this is set then coap itself sends a next GET request automatically */
232233
};
233234

234235
#ifdef __cplusplus

features/FEATURE_COMMON_PAL/mbed-coap/source/sn_coap_builder.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,22 @@ sn_coap_hdr_s *sn_coap_build_response(struct coap_s *handle, sn_coap_hdr_s *coap
6363
return NULL;
6464
}
6565

66-
if (coap_packet_ptr->msg_type == COAP_MSG_TYPE_CONFIRMABLE) {
66+
if (msg_code == COAP_MSG_CODE_REQUEST_GET) {
67+
// Blockwise message response is new GET
68+
coap_res_ptr->msg_type = COAP_MSG_TYPE_CONFIRMABLE;
69+
coap_res_ptr->msg_code = (sn_coap_msg_code_e)msg_code;
70+
/* msg_id needs to be set by the caller in this case */
71+
}
72+
else if (coap_packet_ptr->msg_type == COAP_MSG_TYPE_CONFIRMABLE) {
6773
coap_res_ptr->msg_type = COAP_MSG_TYPE_ACKNOWLEDGEMENT;
6874
coap_res_ptr->msg_code = (sn_coap_msg_code_e)msg_code;
6975
coap_res_ptr->msg_id = coap_packet_ptr->msg_id;
7076
}
71-
7277
else if (coap_packet_ptr->msg_type == COAP_MSG_TYPE_NON_CONFIRMABLE) {
7378
coap_res_ptr->msg_type = COAP_MSG_TYPE_NON_CONFIRMABLE;
7479
coap_res_ptr->msg_code = (sn_coap_msg_code_e)msg_code;
7580
/* msg_id needs to be set by the caller in this case */
7681
}
77-
7882
else {
7983
handle->sn_coap_protocol_free( coap_res_ptr );
8084
return NULL;

0 commit comments

Comments
 (0)