mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
net/asymcute : Move 'ASYMCUTE_BUFSIZE' to 'CONFIG_'
Move ASYMCUTE_BUFSIZE to CONFIG_ namespace, update entry in Kconfig
This commit is contained in:
parent
8f36c817eb
commit
1559aa1dc6
@ -80,10 +80,17 @@ extern "C" {
|
||||
#define CONFIG_ASYMCUTE_BUFSIZE_EXP (7U)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default buffer size used for receive and request buffers
|
||||
*/
|
||||
#ifndef CONFIG_ASYMCUTE_BUFSIZE
|
||||
#define CONFIG_ASYMCUTE_BUFSIZE (128U)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Maximum topic length
|
||||
*
|
||||
* @note Must be less than (256 - 8) AND less than ( @ref ASYMCUTE_BUFSIZE - 8).
|
||||
* @note Must be less than (256 - 8) AND less than ( @ref CONFIG_ASYMCUTE_BUFSIZE - 8).
|
||||
*/
|
||||
#ifndef CONFIG_ASYMCUTE_TOPIC_MAXLEN
|
||||
#define CONFIG_ASYMCUTE_TOPIC_MAXLEN (32U)
|
||||
@ -140,13 +147,6 @@ extern "C" {
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
#ifndef ASYMCUTE_BUFSIZE
|
||||
/**
|
||||
* @brief Default buffer size used for receive and request buffers
|
||||
*/
|
||||
#define ASYMCUTE_BUFSIZE (1 << CONFIG_ASYMCUTE_BUFSIZE_EXP)
|
||||
#endif
|
||||
|
||||
#ifndef ASYMCUTE_HANDLER_PRIO
|
||||
/**
|
||||
* @brief Default priority for Asymcute's handler thread
|
||||
@ -275,7 +275,7 @@ struct asymcute_req {
|
||||
void *arg; /**< internally used additional state */
|
||||
event_callback_t to_evt; /**< timeout event */
|
||||
event_timeout_t to_timer; /**< timeout timer */
|
||||
uint8_t data[ASYMCUTE_BUFSIZE]; /**< buffer holding the request's data */
|
||||
uint8_t data[CONFIG_ASYMCUTE_BUFSIZE]; /**< buffer holding the request's data */
|
||||
size_t data_len; /**< length of the request packet in byte */
|
||||
uint16_t msg_id; /**< used message id for this request */
|
||||
uint8_t retry_cnt; /**< retransmission counter */
|
||||
@ -297,7 +297,7 @@ struct asymcute_con {
|
||||
* connection */
|
||||
uint8_t keepalive_retry_cnt; /**< keep alive transmission counter */
|
||||
uint8_t state; /**< connection state */
|
||||
uint8_t rxbuf[ASYMCUTE_BUFSIZE]; /**< connection specific receive buf */
|
||||
uint8_t rxbuf[CONFIG_ASYMCUTE_BUFSIZE]; /**< connection specific receive buf */
|
||||
char cli_id[MQTTSN_CLI_ID_MAXLEN + 1]; /**< buffer to store client ID */
|
||||
};
|
||||
|
||||
|
@ -24,21 +24,16 @@ config ASYMCUTE_DEFAULT_PORT
|
||||
to macro 'CONFIG_ASYMCUTE_DEFAULT_PORT'. Usage can be found in
|
||||
examples/asymcute_mqttsn
|
||||
|
||||
config ASYMCUTE_BUFSIZE_EXP
|
||||
int "Exponent for the buffer size (resulting in the buffer size 2^n)"
|
||||
default 7
|
||||
help
|
||||
As the buffer size ALWAYS needs to be power of two, this option
|
||||
represents the exponent of 2^n, which will be used as the size of the
|
||||
buffer ('ASYMCUTE_BUFSIZE'). Default value is 7 which corresponds to a
|
||||
buffer size of 128.
|
||||
config ASYMCUTE_BUFSIZE
|
||||
int "Size of buffer used for receive and request buffers"
|
||||
default 128
|
||||
|
||||
config ASYMCUTE_TOPIC_MAXLEN
|
||||
int "Maximum topic length"
|
||||
default 32
|
||||
help
|
||||
Configure maximum length for client's topic. The value must be less than
|
||||
(256 - 8) and less than ('ASYMCUTE_BUFSIZE' - 8).
|
||||
(256 - 8) and less than ('CONFIG_ASYMCUTE_BUFSIZE' - 8).
|
||||
|
||||
config ASYMCUTE_KEEPALIVE
|
||||
int "Keep alive interval in seconds"
|
||||
|
@ -597,7 +597,7 @@ void *_listener(void *arg)
|
||||
|
||||
while (1) {
|
||||
sock_udp_ep_t remote;
|
||||
int n = sock_udp_recv(&con->sock, con->rxbuf, ASYMCUTE_BUFSIZE,
|
||||
int n = sock_udp_recv(&con->sock, con->rxbuf, CONFIG_ASYMCUTE_BUFSIZE,
|
||||
SOCK_NO_TIMEOUT, &remote);
|
||||
if (n > 0) {
|
||||
_on_data(con, (size_t)n, &remote);
|
||||
@ -860,7 +860,7 @@ int asymcute_publish(asymcute_con_t *con, asymcute_req_t *req,
|
||||
return ASYMCUTE_NOTSUP;
|
||||
}
|
||||
/* check for message size */
|
||||
if ((data_len + 9) > ASYMCUTE_BUFSIZE) {
|
||||
if ((data_len + 9) > CONFIG_ASYMCUTE_BUFSIZE) {
|
||||
return ASYMCUTE_OVERFLOW;
|
||||
}
|
||||
/* make sure topic is registered */
|
||||
|
Loading…
Reference in New Issue
Block a user