Skip to content

Commit

Permalink
Remove LTE link establish routines
Browse files Browse the repository at this point in the history
The code used was already deprecated and the library should not be
responsible over what network it communicates, just that it
communicates over a network and handle it as a transparant layer.
  • Loading branch information
gumulka committed Aug 21, 2024
1 parent c3f9c94 commit 858c2c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 55 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ int main() {
```
### Connecting
The module takes care of modem enabling, socket creating and connecting to the server automatically. You just have to configure URL and port of the Thingsboard CoAP server, using `config COAP_CLIENT_NUM_MSGS` and `config COAP_CLIENT_MSG_LEN`. CoAP reliability can be fine-tuned using `config COAP_NUM_RETRIES` and the Zephyr-internal `config COAP_INIT_ACK_TIMEOUT_MS`. Using NB-IoT, 15000 is a good starting value for the latter.
The module takes care of socket creating and connecting to the server automatically. You just have
to configure URL and port of the Thingsboard CoAP server, using `config COAP_CLIENT_NUM_MSGS` and
`config COAP_CLIENT_MSG_LEN`.
CoAP reliability can be fine-tuned using `config COAP_NUM_RETRIES` and the Zephyr-internal
`config COAP_INIT_ACK_TIMEOUT_MS`. Using NB-IoT, 15000 is a good starting value for the latter.
### Sending telemetry to cloud
```c
Expand Down
54 changes: 0 additions & 54 deletions src/thingsboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,6 @@ static void time_worker(struct k_work *work) {
k_work_schedule(&work_time, K_MSEC(TIME_RETRY_INTERVAL));
}

static void modem_configure(void)
{
#if defined(CONFIG_LTE_LINK_CONTROL)
if (IS_ENABLED(CONFIG_LTE_AUTO_INIT_AND_CONNECT)) {
/* Do nothing, modem is already turned on
* and connected.
*/
} else {
int err;

LOG_INF("LTE Link Connecting ...");
err = lte_lc_init_and_connect();
__ASSERT(err == 0, "LTE link could not be established.");
LOG_INF("LTE Link Connected!");
}
#endif /* defined(CONFIG_LTE_LINK_CONTROL) */
}

int thingsboard_send_telemetry(const void *payload, size_t sz) {
int err;

Expand All @@ -225,38 +207,6 @@ int thingsboard_send_telemetry(const void *payload, size_t sz) {
return 0;
}

static void print_modem_info(void) {
char info_name[50];
char modem_info[50];

enum modem_info infos[] = {
MODEM_INFO_FW_VERSION,
MODEM_INFO_UICC,
MODEM_INFO_IMSI,
MODEM_INFO_ICCID,
MODEM_INFO_APN,
MODEM_INFO_IP_ADDRESS
};

int ret;

for (size_t i = 0; i < ARRAY_SIZE(infos); i++) {
ret = modem_info_string_get(infos[i],
modem_info,
sizeof(modem_info));
if (ret < 0) {
return;
}
ret = modem_info_name_get(infos[i],
info_name);
if (ret < 0 || ret > sizeof(info_name)) {
return;
}
info_name[ret] = '\0';
LOG_INF("Value of %s is %s", info_name, modem_info);
}
}

static void start_client(void);

static const struct tb_fw_id *current_fw;
Expand Down Expand Up @@ -319,10 +269,6 @@ int thingsboard_init(attr_write_callback_t cb, const struct tb_fw_id *fw_id) {

current_fw = fw_id;

modem_configure();

print_modem_info();

if (coap_client_init(start_client) != 0) {
LOG_ERR("Failed to initialize CoAP client");
return -1;
Expand Down

0 comments on commit 858c2c8

Please sign in to comment.