Code Monkey home page Code Monkey logo

Comments (3)

ciarmcom avatar ciarmcom commented on August 16, 2024

ARM Internal Ref: IOTCLT-778

from mbed-client-c.

EduardPon avatar EduardPon commented on August 16, 2024

Hello,

This is my proposed API extensions:

sn_nsdl_lib.h

/**
 * \fn int8_t sn_nsdl_set_non_confirmable_resent_parameters(bool enable_resent)
 *
 * \brief  If re-transmissions are enabled (see also sn_nsdl_set_retransmission_parameters),
 *         this function enables/disables a resent of a non confirmable message. This
 *         improves the transmission reliability by duplicating the message (including
 *         header). The CoAP protocol at receiver side will recognize the duplications
 *         and discards the redundant messages.
 *
 * \param bool enable_resent when set to resent non confirmable messages
 * \return  0 = success, -1 = failure
 */
extern int8_t sn_nsdl_set_non_confirmable_resent_parameters(struct nsdl_s *handle, bool enable_resent);

sn_coap_protocol.h

/**
 * \fn int8_t sn_coap_protocol_set_non_confirmable_resent_parameters(bool enable_resent)
 *
 * \brief  If re-transmissions are enabled (see also sn_nsdl_set_retransmission_parameters),
 *         this function enables/disables a resent of a non confirmable message. This
 *         improves the transmission reliability by duplicating the message (including
 *         header). The CoAP protocol at receiver side will recognize the duplications
 *         and discards the redundant messages.
 *
 * \param bool enable_resent when set to resent non confirmable messages
 * \return  0 = success, -1 = failure
 */
extern int8_t sn_coap_protocol_set_non_confirmable_resent_parameters(struct coap_s *handle,
        bool enable_resent);

sn_coap_protocol_internal.h added extra boolean in struct coap_s {
bool resent_non_confirmable; /* Can be modified by sn_nsdl_set_retransmission_parameters, to perform always a resent for non confirmable messages */

Implementation extensions:

sn_nsdl.c

extern int8_t sn_nsdl_set_non_confirmable_resent_parameters(struct nsdl_s *handle,
    bool enable_resent)
{
    if (handle == NULL) {
        return SN_NSDL_FAILURE;
    }
    return sn_coap_protocol_set_non_confirmable_resent_parameters(handle->grs->coap,
                                                                  enable_resent);
}

sn_coap_protocol.c

int8_t sn_coap_protocol_set_non_confirmable_resent_parameters(struct coap_s *handle,
        bool enable_resent)
{
#if ENABLE_RESENDINGS
    if (handle == NULL) {
        return -1;
    }

    handle->resent_non_confirmable = enable_resent;

    return 0;

#endif
    return -1;
}

sn_coap_protocol.c
Added code ((src_coap_msg_ptr->msg_type == COAP_MSG_TYPE_NON_CONFIRMABLE) && (handle->resent_non_confirmable)) )

#if ENABLE_RESENDINGS /* If Message resending is not used at all, this part of code will not be compiled */

    /* Check if built Message type was confirmable, only these messages are resent when not acknowledged.
       NON confirmable messages can be queued when sn_nsdl_set_retransmission_parameters() explicit requests to perform a scheduled resent */
    if( (src_coap_msg_ptr->msg_type == COAP_MSG_TYPE_CONFIRMABLE) ||
        ((src_coap_msg_ptr->msg_type == COAP_MSG_TYPE_NON_CONFIRMABLE) && (handle->resent_non_confirmable)) ) {
        /* Store message to Linked list for resending purposes */
        sn_coap_protocol_linked_list_send_msg_store(handle, dst_addr_ptr, byte_count_built, dst_packet_data_ptr,
                handle->system_time + (uint32_t)(handle->sn_coap_resending_intervall * RESPONSE_RANDOM_FACTOR),
                param, src_coap_msg_ptr->uri_path_ptr, src_coap_msg_ptr->uri_path_len);
    }

#endif /* ENABLE_RESENDINGS */

from mbed-client-c.

teetak01 avatar teetak01 commented on August 16, 2024

Closing the issue as inactive and due to the repository being deprecated.

Please take a look at our current offering at https://cloud.mbed.com/docs/current. The actively maintained version of this component can be found in http://github.com/armmbed/mbed-cloud-client.

Please open a new issue if this is still valid. We strongly encourage you to migrate to the latest product. New issues in this repository will most likely remain unfixed.

from mbed-client-c.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.