Skip to content

Commit 12bc79b

Browse files
jhirsinordicjm
authored andcommitted
samples: dect_phy: dect_shell: mac: rach_tx: interval support
Added a an option to send data in intervals: --interval <secs> Additionally, in addition to given data, to include also modem temperature to data in json format: --get_mdm_temp Signed-off-by: Jani Hirsimäki <[email protected]>
1 parent 2b78ca6 commit 12bc79b

27 files changed

+217
-49
lines changed

samples/dect/dect_phy/dect_shell/README.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ Example: starting of cluster beacon and sending RA data to it
639639

640640
.. code-block:: console
641641
642+
desh:~$ dect sett --reset
643+
desh:~$ dect sett -t 1245
642644
desh:~$ dect mac beacon_scan -c 1659
643645
-----------------------------------------------------------------------------
644646
Beacon scan started.
@@ -824,6 +826,18 @@ Example: starting of cluster beacon and sending RA data to it
824826
Payload length: 0
825827
Received padding data, len 0, payload is not printed
826828
829+
* PT/client side - Send JSON-formatted periodic RA data in 10-second intervals with the current modem temperature to the scanned beacon:
830+
831+
.. code-block:: console
832+
833+
desh:~$ dect mac rach_tx -t 1234 -d "Data from device 1245" -i 10 -j
834+
835+
* PT/client side - Stop periodic RA data sending:
836+
837+
.. code-block:: console
838+
839+
desh:~$ dect mac rach_tx stop
840+
827841
* PT/client side - Send association release to the scanned beacon:
828842

829843
.. code-block:: console

samples/dect/dect_phy/dect_shell/src/dect/common/dect_app_time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <stdio.h>
1010
#include <stdlib.h>
1111

12-
#include "nrf_modem_dect_phy.h"
12+
#include <nrf_modem_dect_phy.h>
1313

1414
#include "dect_app_time.h"
1515

samples/dect/dect_phy/dect_shell/src/dect/common/dect_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <zephyr/kernel.h>
1111
#include <modem/nrf_modem_lib.h>
1212
#include <nrf_modem_at.h>
13-
#include "nrf_modem_dect_phy.h"
13+
#include <nrf_modem_dect_phy.h>
1414

1515
#define DECT_MAX_TBS 5600
1616
#define DECT_DATA_MAX_LEN (DECT_MAX_TBS / 8)

samples/dect/dect_phy/dect_shell/src/dect/common/dect_common_pdu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
#include <stdio.h>
1010
#include <stdlib.h>
1111
#include <zephyr/shell/shell.h>
12+
#include <nrf_modem_dect_phy.h>
13+
1214
#include "desh_print.h"
13-
#include "nrf_modem_dect_phy.h"
1415

1516
#include "dect_common.h"
1617
#include "dect_common_utils.h"

samples/dect/dect_phy/dect_shell/src/dect/common/dect_common_settings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
#include <zephyr/shell/shell.h>
1313
#include <zephyr/settings/settings.h>
1414
#include <zephyr/random/random.h>
15+
#include <nrf_modem_dect_phy.h>
1516

1617
#include "desh_print.h"
17-
#include "nrf_modem_dect_phy.h"
1818
#include "dect_common.h"
1919
#include "dect_common_settings.h"
2020

samples/dect/dect_phy/dect_shell/src/dect/common/dect_phy_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <zephyr/kernel.h>
1111
#include <modem/nrf_modem_lib.h>
1212
#include <nrf_modem_at.h>
13-
#include "nrf_modem_dect_phy.h"
13+
#include <nrf_modem_dect_phy.h>
1414
#include "dect_common.h"
1515

1616
/******************************************************************************/

samples/dect/dect_phy/dect_shell/src/dect/common/dect_phy_common_rx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <stdio.h>
1010
#include <stdlib.h>
1111

12-
#include "nrf_modem_dect_phy.h"
12+
#include <nrf_modem_dect_phy.h>
1313

1414
static uint16_t last_rx_op_channel;
1515

samples/dect/dect_phy/dect_shell/src/dect/common/dect_phy_common_rx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#ifndef DECT_PHY_COMMON_RX_H
88
#define DECT_PHY_COMMON_RX_H
99

10-
#include "nrf_modem_dect_phy.h"
10+
#include <nrf_modem_dect_phy.h>
1111

1212
/* Due to lack of information of a carrier/channel in pdc_cb from libmodem/modem,
1313
* a small wrapper for RX operations is needed to have a glue to which channel pdc_cb is for.

samples/dect/dect_phy/dect_shell/src/dect/dect_phy_ctrl.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
#include <modem/nrf_modem_lib.h>
1717
#include <nrf_modem_at.h>
18+
#include <nrf_modem_dect_phy.h>
1819

1920
#include "desh_print.h"
20-
#include "nrf_modem_dect_phy.h"
2121

2222
#include "dect_common_utils.h"
2323
#include "dect_common_settings.h"
@@ -69,6 +69,8 @@ static struct dect_phy_ctrl_data {
6969
uint8_t last_received_pcc_short_nw_id;
7070
uint16_t last_received_pcc_transmitter_short_rd_id;
7171

72+
int16_t last_valid_temperature;
73+
7274
uint8_t last_received_pcc_phy_len;
7375
enum dect_phy_packet_length_type last_received_pcc_phy_len_type;
7476

@@ -197,6 +199,10 @@ static void dect_phy_ctrl_msgq_thread_handler(void)
197199
struct dect_phy_common_op_initialized_params *params =
198200
(struct dect_phy_common_op_initialized_params *)event.data;
199201

202+
if (params->temperature != NRF_MODEM_DECT_PHY_TEMP_NOT_MEASURED) {
203+
ctrl_data.last_valid_temperature = params->temperature;
204+
}
205+
200206
if (params->status) {
201207
desh_error("(%s): init failed (time %llu, temperature %d, "
202208
"temp_limit %d): %d",
@@ -352,6 +358,10 @@ static void dect_phy_ctrl_msgq_thread_handler(void)
352358
struct dect_phy_common_op_completed_params *params =
353359
(struct dect_phy_common_op_completed_params *)event.data;
354360

361+
if (params->temperature != NRF_MODEM_DECT_PHY_TEMP_NOT_MEASURED) {
362+
ctrl_data.last_valid_temperature = params->temperature;
363+
}
364+
355365
if (params->status != NRF_MODEM_DECT_PHY_SUCCESS) {
356366
char tmp_str[128] = {0};
357367

@@ -768,6 +778,11 @@ int dect_phy_ctrl_time_query(void)
768778
return nrf_modem_dect_phy_time_get();
769779
}
770780

781+
int dect_phy_ctrl_modem_temperature_get(void)
782+
{
783+
return ctrl_data.last_valid_temperature;
784+
}
785+
771786
/**************************************************************************************************/
772787

773788
void dect_phy_ctrl_rx_stop(void)
@@ -861,9 +876,9 @@ int dect_phy_ctrl_rx_start(struct dect_phy_rx_cmd_params *params, bool restart)
861876
void dect_phy_ctrl_status_get_n_print(void)
862877
{
863878
char tmp_mdm_str[128] = {0};
864-
int temperature;
865879
int ret;
866880
struct dect_phy_settings *current_settings = dect_common_settings_ref_get();
881+
int temperature = dect_phy_ctrl_modem_temperature_get();
867882

868883
desh_print("desh-dect-phy status:");
869884
ret = nrf_modem_at_scanf("AT+CGMR", "%s", tmp_mdm_str);
@@ -880,8 +895,7 @@ void dect_phy_ctrl_status_get_n_print(void)
880895
}
881896
desh_print(" HW version: %s", tmp_mdm_str);
882897

883-
ret = nrf_modem_at_scanf("AT%XTEMP?", "%%XTEMP: %d", &temperature);
884-
if (ret <= 0) {
898+
if (temperature == NRF_MODEM_DECT_PHY_TEMP_NOT_MEASURED) {
885899
sprintf(tmp_mdm_str, "%s", "not known");
886900
} else {
887901
sprintf(tmp_mdm_str, "%d", temperature);
@@ -1332,6 +1346,7 @@ NRF_MODEM_LIB_ON_INIT(dect_phy_ctrl_init_hook, dect_phy_ctrl_on_modem_lib_init,
13321346
static int dect_phy_ctrl_init(void)
13331347
{
13341348
memset(&ctrl_data, 0, sizeof(struct dect_phy_ctrl_data));
1349+
ctrl_data.last_valid_temperature = NRF_MODEM_DECT_PHY_TEMP_NOT_MEASURED;
13351350

13361351
ctrl_data.debug = true; /* Debugs enabled as a default */
13371352
k_work_queue_start(&dect_phy_ctrl_work_q, dect_phy_ctrl_th_stack,

samples/dect/dect_phy/dect_shell/src/dect/dect_phy_ctrl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ void dect_phy_ctrl_rx_stop(void);
4949

5050
int dect_phy_ctrl_time_query(void);
5151

52+
int dect_phy_ctrl_modem_temperature_get(void);
53+
5254
/******************************************************************************/
5355

5456
typedef void (*dect_phy_ctrl_rssi_scan_completed_callback_t)(

0 commit comments

Comments
 (0)