File tree Expand file tree Collapse file tree 4 files changed +27
-5
lines changed
components/esp_modem/examples/simple_cmux_client Expand file tree Collapse file tree 4 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -129,4 +129,16 @@ menu "Example Configuration"
129
129
help
130
130
URL of an mqtt broker which this example connects to.
131
131
132
+ config EXAMPLE_MQTT_TEST_TOPIC
133
+ string "MQTT topic to publish/subscribe"
134
+ default "/topic/esp-pppos"
135
+ help
136
+ MQTT topic, which we subscribe on and publish to.
137
+
138
+ config EXAMPLE_MQTT_TEST_DATA
139
+ string "MQTT data to publish/receive"
140
+ default "esp32-pppos"
141
+ help
142
+ MQTT data message, which we publish and expect to receive.
143
+
132
144
endmenu
Original file line number Diff line number Diff line change @@ -234,8 +234,8 @@ extern "C" void app_main(void)
234
234
}
235
235
std::cout << " Connected" << std::endl;
236
236
237
- mqtt.subscribe (" /topic/esp-modem " );
238
- mqtt.publish (" /topic/esp-modem " , " Hello modem " );
237
+ mqtt.subscribe (CONFIG_EXAMPLE_MQTT_TEST_TOPIC );
238
+ mqtt.publish (CONFIG_EXAMPLE_MQTT_TEST_TOPIC, CONFIG_EXAMPLE_MQTT_TEST_DATA );
239
239
if (!handler.wait_for (StatusHandler::MQTT_Data, 60000 )) {
240
240
ESP_LOGE (TAG, " Didn't receive published data within specified timeout... exiting" );
241
241
return ;
Original file line number Diff line number Diff line change 1
- # SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
1
+ # SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2
2
# SPDX-License-Identifier: Unlicense OR CC0-1.0
3
3
from __future__ import print_function , unicode_literals
4
4
@@ -10,8 +10,17 @@ def test_cmux_connection(dut):
10
10
2. checks we get an IP
11
11
3. checks for the MQTT events
12
12
"""
13
+ # Get topic and data from Kconfig
14
+ topic = ''
15
+ data = ''
16
+ try :
17
+ topic = dut .app .sdkconfig .get ('EXAMPLE_MQTT_TEST_TOPIC' )
18
+ data = dut .app .sdkconfig .get ('EXAMPLE_MQTT_TEST_DATA' )
19
+ except Exception :
20
+ print ('ENV_TEST_FAILURE: Cannot find broker url in sdkconfig' )
21
+ raise
13
22
# Check the sequence of connecting, publishing, disconnecting
14
23
dut .expect ('Modem has correctly entered multiplexed' )
15
24
# Check for MQTT connection and the data event
16
- dut .expect ('TOPIC: / topic/esp-modem ' )
17
- dut .expect ('DATA: Hello modem ' )
25
+ dut .expect (f 'TOPIC: { topic } ' )
26
+ dut .expect (f 'DATA: { data } ' )
Original file line number Diff line number Diff line change @@ -15,3 +15,4 @@ CONFIG_ESP32_PANIC_PRINT_HALT=y
15
15
CONFIG_COMPILER_CXX_EXCEPTIONS=y
16
16
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
17
17
CONFIG_EXAMPLE_CLOSE_CMUX_AT_END=y
18
+ CONFIG_EXAMPLE_MQTT_TEST_TOPIC="/ci/esp-modem/pppos-client"
You can’t perform that action at this time.
0 commit comments