Skip to content

Commit 06a98e7

Browse files
author
Cruz Monrreal
authored
Merge pull request #7778 from SeppoTakalo/provide_default_mesh
Fix MeshInterface::get_default_instance()
2 parents 88eb8aa + 4989650 commit 06a98e7

File tree

10 files changed

+124
-8
lines changed

10 files changed

+124
-8
lines changed

features/nanostack/mbed-mesh-api/source/LoWPANNDInterface.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ bool LoWPANNDInterface::getRouterIpAddress(char *address, int8_t len)
161161

162162
#define LOWPAN 0x2345
163163
#if MBED_CONF_NSAPI_DEFAULT_MESH_TYPE == LOWPAN && DEVICE_802_15_4_PHY
164-
MBED_WEAK MeshInterface *MeshInterface::get_default_instance()
164+
MBED_WEAK MeshInterface *MeshInterface::get_target_default_instance()
165165
{
166-
static LoWPANNDInterface lowpan(NanostackRfPhy::get_default_instance());
166+
static LoWPANNDInterface lowpan(&NanostackRfPhy::get_default_instance());
167167

168-
return lowpan;
168+
return &lowpan;
169169
}
170170
#endif

features/nanostack/mbed-mesh-api/source/ThreadInterface.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ mesh_error_t Nanostack::ThreadInterface::device_pskd_set(const char *pskd)
256256
#if MBED_CONF_NSAPI_DEFAULT_MESH_TYPE == THREAD && DEVICE_802_15_4_PHY
257257
MBED_WEAK MeshInterface *MeshInterface::get_target_default_instance()
258258
{
259-
static ThreadInterface thread(NanostackRfPhy::get_default_instance());
259+
static ThreadInterface thread(&NanostackRfPhy::get_default_instance());
260260

261-
return thread;
261+
return &thread;
262262
}
263263
#endif

features/nanostack/targets/TARGET_NCS36510/NanostackRfPhyNcs36510.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -902,3 +902,8 @@ void NanostackRfPhyNcs36510::set_mac_address(uint8_t *mac)
902902
platform_exit_critical();
903903
}
904904

905+
NanostackRfPhy &NanostackRfPhy::get_default_instance()
906+
{
907+
static NanostackRfPhyNcs36510 rf_phy;
908+
return rf_phy;
909+
}

features/netsocket/mbed_lib.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
"default-cellular-apn": null,
1010
"default-cellular-username": null,
1111
"default-cellular-password": null,
12-
"default-mesh-type": "THREAD",
12+
"default-mesh-type": {
13+
"help": "Configuration type for MeshInterface::get_default_instance(). [LOWPAN/THREAD]",
14+
"value": "THREAD"
15+
},
1316
"dns-response-wait-time": {
1417
"help": "How long the DNS translator waits for a reply from a server in milliseconds",
1518
"value": 5000

targets/targets.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4101,7 +4101,7 @@
41014101
"post_binary_hook": {"function": "NCS36510TargetCode.ncs36510_addfib"},
41024102
"macros": ["CM3", "CPU_NCS36510", "TARGET_NCS36510", "LOAD_ADDRESS=0x3000"],
41034103
"supported_toolchains": ["GCC_ARM", "ARM", "IAR"],
4104-
"device_has": ["ANALOGIN", "SERIAL", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "TRNG", "SPISLAVE"],
4104+
"device_has": ["ANALOGIN", "SERIAL", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "TRNG", "SPISLAVE", "802_15_4_PHY"],
41054105
"release_versions": ["2", "5"]
41064106
},
41074107
"NUMAKER_PFM_M453": {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"config": {
3+
"echo-server-addr" : {
4+
"help" : "IP address of echo server",
5+
"value" : "\"echo.mbedcloudtesting.com\""
6+
},
7+
"echo-server-port" : {
8+
"help" : "Port of echo server",
9+
"value" : "7"
10+
}
11+
},
12+
"target_overrides": {
13+
"*": {
14+
"target.network-default-interface-type": "MESH",
15+
"nsapi.default-stack": "NANOSTACK",
16+
"nsapi.default-mesh-type": "LOWPAN",
17+
"nanostack.configuration": "lowpan_host",
18+
"mbed-mesh-api.heap-size": 14000,
19+
"mbed-mesh-api.6lowpan-nd-device-type": "NET_6LOWPAN_HOST",
20+
"mbed-mesh-api.6lowpan-nd-panid-filter": "0xffff",
21+
"mbed-mesh-api.6lowpan-nd-channel-page": 0,
22+
"mbed-mesh-api.6lowpan-nd-channel": 12,
23+
"mbed-mesh-api.6lowpan-nd-channel-mask": "(1<<12)",
24+
"mbed-trace.enable": false
25+
}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"config": {
3+
"echo-server-addr" : {
4+
"help" : "IP address of echo server",
5+
"value" : "\"echo.mbedcloudtesting.com\""
6+
},
7+
"echo-server-port" : {
8+
"help" : "Port of echo server",
9+
"value" : "7"
10+
}
11+
},
12+
"target_overrides": {
13+
"*": {
14+
"target.network-default-interface-type": "MESH",
15+
"nsapi.default-stack": "NANOSTACK",
16+
"nsapi.default-mesh-type": "LOWPAN",
17+
"nanostack.configuration": "lowpan_router",
18+
"mbed-mesh-api.heap-size": 14000,
19+
"mbed-mesh-api.6lowpan-nd-device-type": "NET_6LOWPAN_ROUTER",
20+
"mbed-mesh-api.6lowpan-nd-panid-filter": "0xffff",
21+
"mbed-mesh-api.6lowpan-nd-channel-page": 0,
22+
"mbed-mesh-api.6lowpan-nd-channel": 12,
23+
"mbed-mesh-api.6lowpan-nd-channel-mask": "(1<<12)",
24+
"mbed-trace.enable": false
25+
}
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"config": {
3+
"echo-server-addr" : {
4+
"help" : "IP address of echo server",
5+
"value" : "\"echo.mbedcloudtesting.com\""
6+
},
7+
"echo-server-port" : {
8+
"help" : "Port of echo server",
9+
"value" : "7"
10+
}
11+
},
12+
"target_overrides": {
13+
"*": {
14+
"target.network-default-interface-type": "MESH",
15+
"nsapi.default-stack": "NANOSTACK",
16+
"nsapi.default-mesh-type": "THREAD",
17+
"nanostack.configuration": "thread_end_device",
18+
"mbed-mesh-api.thread-device-type": "MESH_DEVICE_TYPE_THREAD_MINIMAL_END_DEVICE",
19+
"mbed-mesh-api.thread-config-panid": "0x0700",
20+
"mbed-mesh-api.thread-master-key": "{0x10, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}",
21+
"mbed-mesh-api.thread-config-channel": 22,
22+
"mbed-trace.enable": false
23+
}
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"config": {
3+
"echo-server-addr" : {
4+
"help" : "IP address of echo server",
5+
"value" : "\"echo.mbedcloudtesting.com\""
6+
},
7+
"echo-server-port" : {
8+
"help" : "Port of echo server",
9+
"value" : "7"
10+
}
11+
},
12+
"target_overrides": {
13+
"*": {
14+
"target.network-default-interface-type": "MESH",
15+
"nsapi.default-stack": "NANOSTACK",
16+
"nsapi.default-mesh-type": "THREAD",
17+
"nanostack.configuration": "thread_router",
18+
"mbed-mesh-api.thread-device-type": "MESH_DEVICE_TYPE_THREAD_ROUTER",
19+
"mbed-mesh-api.thread-config-panid": "0x0700",
20+
"mbed-mesh-api.thread-master-key": "{0x10, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}",
21+
"mbed-mesh-api.thread-config-channel": 22,
22+
"mbed-trace.enable": false
23+
}
24+
}
25+
}

tools/test_configs/config_paths.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@
55
"HEAPBLOCKDEVICE_AND_WIFI": "HeapBlockDeviceAndWifiInterface.json",
66
"ESP8266_WIFI" : "ESP8266Interface.json",
77
"ISM43362_WIFI" : "ISM43362Interface.json",
8-
"IDW0XX1_WIFI" : "SpwfSAInterface.json"
8+
"IDW0XX1_WIFI" : "SpwfSAInterface.json",
9+
"6LOWPAN_HOST" : "6lowpanInterface_host.json",
10+
"6LOWPAN_ROUTER" : "6lowpanInterface_router.json",
11+
"THREAD_END_DEVICE" : "ThreadInterface_end_device.json",
12+
"THREAD_ROUTER" : "ThreadInterface_router.json"
913
}

0 commit comments

Comments
 (0)