bool nlme_set_request(nib_attribute_t NIBAttribute, uint8_t NIBAttributeIndex, uint8_t *NIBAttributeValue , FUNC_PTR confirm_cb ) { uint8_t *msg_buf; uint8_t i; uint8_t attr_len; uint8_t *ptr; ptr = NIBAttributeValue; msg_buf = get_next_tx_buffer(); /* Check if buffer could not be allocated */ if (NULL == msg_buf) { return false; } if (confirm_cb == NULL) { return false; } nlme_set_confirm_cb = (nlme_set_confirm_cb_t)confirm_cb; attr_len = nwk_get_nib_attribute_size(NIBAttribute); *msg_buf++ = NLME_SET_REQ_LEN + RF4CONTROL_PID_LEN + attr_len; *msg_buf++ = RF4CONTROL_PID; *msg_buf++ = NLME_SET_REQUEST; *msg_buf++ = NIBAttribute; *msg_buf++ = NIBAttributeIndex; *msg_buf++ = attr_len; for (i = 0; i < attr_len; i++) { *msg_buf++ = *ptr++; } *msg_buf = EOT; return true; }
static void nlme_get_confirm(nwk_enum_t Status, nib_attribute_t NIBAttribute, uint8_t NIBAttributeIndex, void *NIBAttributeValue) { uint8_t *msg_buf; uint8_t i; uint8_t attr_len; uint8_t *ptr; ptr = NIBAttributeValue; msg_buf = get_next_tx_buffer(); attr_len = nwk_get_nib_attribute_size(NIBAttribute); *msg_buf++ = NLME_GET_CONF_LEN + attr_len + RF4CONTROL_PID_LEN; *msg_buf++ = RF4CONTROL_PID; *msg_buf++ = NLME_GET_CONFIRM; *msg_buf++ = Status; *msg_buf++ = NIBAttribute; *msg_buf++ = NIBAttributeIndex; *msg_buf++ = attr_len; for (i = 0; i < attr_len; i++) { *msg_buf++ = *ptr++; } *msg_buf = EOT; }