Merge pull request #7778 from SeppoTakalo/provide_default_mesh

Fix MeshInterface::get_default_instance()
pull/7941/head
Cruz Monrreal 2018-08-30 16:11:00 -05:00 committed by GitHub
commit 06a98e7dcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 124 additions and 8 deletions

View File

@ -161,10 +161,10 @@ bool LoWPANNDInterface::getRouterIpAddress(char *address, int8_t len)
#define LOWPAN 0x2345
#if MBED_CONF_NSAPI_DEFAULT_MESH_TYPE == LOWPAN && DEVICE_802_15_4_PHY
MBED_WEAK MeshInterface *MeshInterface::get_default_instance()
MBED_WEAK MeshInterface *MeshInterface::get_target_default_instance()
{
static LoWPANNDInterface lowpan(NanostackRfPhy::get_default_instance());
static LoWPANNDInterface lowpan(&NanostackRfPhy::get_default_instance());
return lowpan;
return &lowpan;
}
#endif

View File

@ -256,8 +256,8 @@ mesh_error_t Nanostack::ThreadInterface::device_pskd_set(const char *pskd)
#if MBED_CONF_NSAPI_DEFAULT_MESH_TYPE == THREAD && DEVICE_802_15_4_PHY
MBED_WEAK MeshInterface *MeshInterface::get_target_default_instance()
{
static ThreadInterface thread(NanostackRfPhy::get_default_instance());
static ThreadInterface thread(&NanostackRfPhy::get_default_instance());
return thread;
return &thread;
}
#endif

View File

@ -902,3 +902,8 @@ void NanostackRfPhyNcs36510::set_mac_address(uint8_t *mac)
platform_exit_critical();
}
NanostackRfPhy &NanostackRfPhy::get_default_instance()
{
static NanostackRfPhyNcs36510 rf_phy;
return rf_phy;
}

View File

@ -9,7 +9,10 @@
"default-cellular-apn": null,
"default-cellular-username": null,
"default-cellular-password": null,
"default-mesh-type": "THREAD",
"default-mesh-type": {
"help": "Configuration type for MeshInterface::get_default_instance(). [LOWPAN/THREAD]",
"value": "THREAD"
},
"dns-response-wait-time": {
"help": "How long the DNS translator waits for a reply from a server in milliseconds",
"value": 5000

View File

@ -4101,7 +4101,7 @@
"post_binary_hook": {"function": "NCS36510TargetCode.ncs36510_addfib"},
"macros": ["CM3", "CPU_NCS36510", "TARGET_NCS36510", "LOAD_ADDRESS=0x3000"],
"supported_toolchains": ["GCC_ARM", "ARM", "IAR"],
"device_has": ["ANALOGIN", "SERIAL", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "TRNG", "SPISLAVE"],
"device_has": ["ANALOGIN", "SERIAL", "I2C", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SERIAL_FC", "SLEEP", "SPI", "TRNG", "SPISLAVE", "802_15_4_PHY"],
"release_versions": ["2", "5"]
},
"NUMAKER_PFM_M453": {

View File

@ -0,0 +1,27 @@
{
"config": {
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
},
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
}
},
"target_overrides": {
"*": {
"target.network-default-interface-type": "MESH",
"nsapi.default-stack": "NANOSTACK",
"nsapi.default-mesh-type": "LOWPAN",
"nanostack.configuration": "lowpan_host",
"mbed-mesh-api.heap-size": 14000,
"mbed-mesh-api.6lowpan-nd-device-type": "NET_6LOWPAN_HOST",
"mbed-mesh-api.6lowpan-nd-panid-filter": "0xffff",
"mbed-mesh-api.6lowpan-nd-channel-page": 0,
"mbed-mesh-api.6lowpan-nd-channel": 12,
"mbed-mesh-api.6lowpan-nd-channel-mask": "(1<<12)",
"mbed-trace.enable": false
}
}
}

View File

@ -0,0 +1,27 @@
{
"config": {
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
},
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
}
},
"target_overrides": {
"*": {
"target.network-default-interface-type": "MESH",
"nsapi.default-stack": "NANOSTACK",
"nsapi.default-mesh-type": "LOWPAN",
"nanostack.configuration": "lowpan_router",
"mbed-mesh-api.heap-size": 14000,
"mbed-mesh-api.6lowpan-nd-device-type": "NET_6LOWPAN_ROUTER",
"mbed-mesh-api.6lowpan-nd-panid-filter": "0xffff",
"mbed-mesh-api.6lowpan-nd-channel-page": 0,
"mbed-mesh-api.6lowpan-nd-channel": 12,
"mbed-mesh-api.6lowpan-nd-channel-mask": "(1<<12)",
"mbed-trace.enable": false
}
}
}

View File

@ -0,0 +1,25 @@
{
"config": {
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
},
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
}
},
"target_overrides": {
"*": {
"target.network-default-interface-type": "MESH",
"nsapi.default-stack": "NANOSTACK",
"nsapi.default-mesh-type": "THREAD",
"nanostack.configuration": "thread_end_device",
"mbed-mesh-api.thread-device-type": "MESH_DEVICE_TYPE_THREAD_MINIMAL_END_DEVICE",
"mbed-mesh-api.thread-config-panid": "0x0700",
"mbed-mesh-api.thread-master-key": "{0x10, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}",
"mbed-mesh-api.thread-config-channel": 22,
"mbed-trace.enable": false
}
}
}

View File

@ -0,0 +1,25 @@
{
"config": {
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
},
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
}
},
"target_overrides": {
"*": {
"target.network-default-interface-type": "MESH",
"nsapi.default-stack": "NANOSTACK",
"nsapi.default-mesh-type": "THREAD",
"nanostack.configuration": "thread_router",
"mbed-mesh-api.thread-device-type": "MESH_DEVICE_TYPE_THREAD_ROUTER",
"mbed-mesh-api.thread-config-panid": "0x0700",
"mbed-mesh-api.thread-master-key": "{0x10, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}",
"mbed-mesh-api.thread-config-channel": 22,
"mbed-trace.enable": false
}
}
}

View File

@ -5,5 +5,9 @@
"HEAPBLOCKDEVICE_AND_WIFI": "HeapBlockDeviceAndWifiInterface.json",
"ESP8266_WIFI" : "ESP8266Interface.json",
"ISM43362_WIFI" : "ISM43362Interface.json",
"IDW0XX1_WIFI" : "SpwfSAInterface.json"
"IDW0XX1_WIFI" : "SpwfSAInterface.json",
"6LOWPAN_HOST" : "6lowpanInterface_host.json",
"6LOWPAN_ROUTER" : "6lowpanInterface_router.json",
"THREAD_END_DEVICE" : "ThreadInterface_end_device.json",
"THREAD_ROUTER" : "ThreadInterface_router.json"
}