Merge pull request #7812 from mikaleppanen/greentea_def_interf

Update greentea tests to use default interface
pull/7635/merge
Cruz Monrreal 2018-08-24 19:31:00 -05:00 committed by GitHub
commit 5ffcc01be1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 161 additions and 473 deletions

View File

@ -15,7 +15,9 @@
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#define WIFI 2
#if !defined(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE) || \
(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI && !defined(MBED_CONF_NSAPI_DEFAULT_WIFI_SSID))
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
@ -27,8 +29,6 @@
#include "EventQueue.h"
#include "dns_tests.h"
#include MBED_CONF_APP_HEADER_FILE
using namespace utest::v1;
namespace {
@ -116,12 +116,10 @@ static void net_bringup()
{
MBED_ASSERT(MBED_CONF_APP_DNS_TEST_HOSTS_NUM >= MBED_CONF_NSAPI_DNS_CACHE_SIZE && MBED_CONF_APP_DNS_TEST_HOSTS_NUM >= MBED_CONF_APP_DNS_SIMULT_QUERIES + 1);
net = MBED_CONF_APP_OBJECT_CONSTRUCTION;
int err = MBED_CONF_APP_CONNECT_STATEMENT;
TEST_ASSERT_EQUAL(0, err);
printf("MBED: Connected to network\n");
printf("MBED: IP Address: %s\n", net->get_ip_address());
net = NetworkInterface::get_default_instance();
nsapi_error_t err = net->connect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
printf("MBED: IP address is '%s'\n", net->get_ip_address());
}
// Test setup

View File

@ -15,12 +15,16 @@
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#define WIFI 2
#if !defined(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE) || \
(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI && !defined(MBED_CONF_NSAPI_DEFAULT_WIFI_SSID))
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#ifndef MBED_CONF_APP_ECHO_SERVER_ADDR
#error [NOT_SUPPORTED] Requires parameters from mbed_app.json
#endif
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "greentea-client/test_env.h"
#include "unity/unity.h"
#include "utest.h"
@ -57,8 +61,8 @@ void drop_bad_packets(TCPSocket &sock, int orig_timeout)
static void _ifup()
{
net = MBED_CONF_APP_OBJECT_CONSTRUCTION;
nsapi_error_t err = MBED_CONF_APP_CONNECT_STATEMENT;
net = NetworkInterface::get_default_instance();
nsapi_error_t err = net->connect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
printf("MBED: TCPClient IP address is '%s'\n", net->get_ip_address());
}

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "TCPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "TCPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "TCPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "TCPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -17,7 +17,6 @@
#include "greentea-client/test_env.h"
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "tcp_tests.h"
#include "TCPSocket.h"
#include "unity/unity.h"

View File

@ -17,7 +17,6 @@
#include "greentea-client/test_env.h"
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "tcp_tests.h"
#include "TCPSocket.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "TCPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "TCPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "TCPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "TCPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "TCPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -15,12 +15,16 @@
* limitations under the License.
*/
#ifndef MBED_CONF_APP_CONNECT_STATEMENT
#define WIFI 2
#if !defined(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE) || \
(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI && !defined(MBED_CONF_NSAPI_DEFAULT_WIFI_SSID))
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#ifndef MBED_CONF_APP_ECHO_SERVER_ADDR
#error [NOT_SUPPORTED] Requires parameters from mbed_app.json
#endif
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "greentea-client/test_env.h"
#include "unity/unity.h"
#include "utest.h"
@ -40,8 +44,8 @@ NetworkInterface *get_interface()
static void _ifup()
{
net = MBED_CONF_APP_OBJECT_CONSTRUCTION;
nsapi_error_t err = MBED_CONF_APP_CONNECT_STATEMENT;
net = NetworkInterface::get_default_instance();
nsapi_error_t err = net->connect();
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
printf("MBED: UDPClient IP address is '%s'\n", net->get_ip_address());
}

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "UDPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "UDPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -17,7 +17,6 @@
#include "greentea-client/test_env.h"
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "udp_tests.h"
#include "UDPSocket.h"
#include "unity/unity.h"

View File

@ -17,7 +17,6 @@
#include "greentea-client/test_env.h"
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "udp_tests.h"
#include "UDPSocket.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "UDPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "UDPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "UDPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -16,7 +16,6 @@
*/
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "UDPSocket.h"
#include "greentea-client/test_env.h"
#include "unity/unity.h"

View File

@ -8,7 +8,34 @@ To configure a device to be a CTP echo server, you need to enable the `echo-serv
## Other configuration options
Default configuration files included with tests are configured for ethernet. For Wi-Fi, set `test-ethernet` to 0 and `test-wifi` to 1. You also need to configure Wi-Fi SSID and security options to the configuration file.
Targets with connectivity set the target.network-default-interface-type configuration variable appropriately, either to their only interface or their most-commonly-used one. For targets that provide more than one type of connectivity, you may choose the default by overriding the target.network-default-interface-type configuration variable.
For Ethernet, if you want to overrride the default, set the `json` configuration to:
```
"target_overrides": {
"*": {
"target.network-default-interface-type": "ETHERNET",
"nsapi.default-stack": "TEST"
}
}
```
For Wi-Fi set the `json` configuration to:
```
"target_overrides": {
"*": {
"target.network-default-interface-type": "WIFI",
"nsapi.default-wifi-ssid": "\"WIFI_SSID\"",
"nsapi.default-wifi-password": "\"WIFI_PASSWORD\"",
"nsapi.default-wifi-security": "WIFI_SECURITY",
"nsapi.default-stack": "TEST"
}
}
```
For Wi-Fi you also need to configure Wi-Fi SSID and security options to the configuration file.
## Example commands

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
@ -556,4 +554,3 @@ EmacTestMemoryManager &EmacTestMemoryManager::get_instance()
return test_memory_manager;
}
#endif

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#ifndef EMAC_TEST_MEMORY_MANAGER_H
#define EMAC_TEST_MEMORY_MANAGER_H
@ -115,7 +113,7 @@ public:
* If memory buffer is chained must point to the start of the chain. Frees all buffers
* from the chained list.
*
* @param mem Memory buffer chain to be freed.
* @param buf Memory buffer chain to be freed.
*/
virtual void free(emac_mem_buf_t *buf);
@ -124,7 +122,7 @@ public:
*
* Returns a total length of this buffer and any following buffers in the chain.
*
* @param mem Memory buffer chain
* @param buf Memory buffer chain
* @return Total length in bytes
*/
virtual uint32_t get_total_len(const emac_mem_buf_t *buf) const;
@ -157,7 +155,7 @@ public:
*
* Returns the next buffer from the memory buffer chain.
*
* @param mem Memory buffer
* @param buf Memory buffer
* @return The next memory buffer, or NULL if last
*/
virtual emac_mem_buf_t *get_next(const emac_mem_buf_t *buf) const;
@ -165,7 +163,7 @@ public:
/**
* Return pointer to the payload of the buffer
*
* @param mem Memory buffer
* @param buf Memory buffer
* @return Pointer to the payload
*/
virtual void *get_ptr(const emac_mem_buf_t *buf) const;
@ -173,7 +171,7 @@ public:
/**
* Return payload size of the buffer
*
* @param mem Memory buffer
* @param buf Memory buffer
* @return Size in bytes
*/
virtual uint32_t get_len(const emac_mem_buf_t *buf) const;
@ -184,7 +182,7 @@ public:
* The allocated payload size will not change. It is not permitted
* to change the length of a buffer that is not the first (or only) in a chain.
*
* @param mem Memory buffer
* @param buf Memory buffer
* @param len Payload size, must be less or equal allocated size
*/
virtual void set_len(emac_mem_buf_t *buf, uint32_t len);
@ -229,4 +227,3 @@ private:
};
#endif /* EMAC_TEST_MEMORY_MANAGER_H */
#endif

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "unity.h"
#include "EMACMemoryManager.h"
@ -205,5 +203,3 @@ OnboardNetworkStack &OnboardNetworkStack::get_default_instance()
return EmacTestNetworkStack::get_instance();
}
#endif
#endif

View File

@ -15,8 +15,6 @@
* limitations under the License.
*/
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#ifndef EMAC_TEST_NETWORK_STACK_H
#define EMAC_TEST_NETWORK_STACK_H
@ -90,7 +88,6 @@ public:
/** Copies IP address of the network interface to user supplied buffer
*
* @param emac EMAC HAL implementation for this network interface
* @param buf buffer to which IP address will be copied as "W:X:Y:Z"
* @param buflen size of supplied buffer
* @return Pointer to a buffer, or NULL if the buffer is too small
@ -392,5 +389,3 @@ private:
};
#endif /* EMAC_TEST_NETWORK_STACK_H */
#endif

View File

@ -19,8 +19,6 @@
#include "unity/unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "mbed.h"
#include "EMAC.h"
@ -152,5 +150,4 @@ void emac_if_ctp_msg_build(int eth_frame_len, const unsigned char *dest_addr, co
emac_if_check_memory(false);
}
#endif

View File

@ -20,10 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "lwip/opt.h" /* ETH_PAD_SIZE */
#include "mbed.h"
#include "EMAC.h"
@ -79,5 +75,3 @@ void emac_if_memory_buffer_write(void *buf, unsigned char *eth_frame, bool write
}
}
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -101,4 +99,3 @@ void test_emac_broadcast(void)
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -22,30 +22,11 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "EthernetInterface.h"
#include "NetworkInterface.h"
#include "EMAC.h"
#include "EMACMemoryManager.h"
#include "emac_TestMemoryManager.h"
#include "emac_TestNetworkStack.h"
#if MBED_CONF_APP_TEST_WIFI
#if defined(TARGET_UBLOX_EVK_ODIN_W2) || defined(TARGET_MTB_UBLOX_ODIN_W2)
#include "OdinWiFiInterface.h"
#endif
#ifdef TARGET_REALTEK_RTL8195AM
#include "RTWInterface.h"
#endif
#if defined(TARGET_MTB_ADV_WISE_1530) || \
defined(TARGET_MTB_USI_WM_BN_BM_22) || \
defined(TARGET_MTB_MXCHIP_EMW3166)
#include "WicedInterface.h"
#endif
#endif
#include "emac_initialize.h"
#include "emac_tests.h"
#include "emac_util.h"
@ -59,29 +40,14 @@ void test_emac_initialize()
{
worker_loop_init();
#if MBED_CONF_APP_TEST_ETHERNET
static EthernetInterface *network_interface = new EthernetInterface;
#elif MBED_CONF_APP_TEST_WIFI
// Add wifi classes here
#if defined(TARGET_UBLOX_EVK_ODIN_W2) || defined(TARGET_MTB_UBLOX_ODIN_W2)
static WiFiInterface *network_interface = new OdinWiFiInterface;
#elif defined(TARGET_REALTEK_RTL8195AM)
static WiFiInterface *network_interface = new RTWInterface;
#elif defined(TARGET_MTB_ADV_WISE_1530) || \
defined(TARGET_MTB_USI_WM_BN_BM_22) || \
defined(TARGET_MTB_MXCHIP_EMW3166)
static WiFiInterface *network_interface = new WicedInterface;
#else
static WiFiInterface *network_interface = new WiFiInterface;
#endif
static NetworkInterface *network_interface = NetworkInterface::get_default_instance();
#define WIFI 2
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI
#if MBED_CONF_APP_WIFI_SCAN
WiFiAccessPoint ap[30];
int size = network_interface->scan(ap, 30);
int size = network_interface->wifiInterface()->scan(ap, 30);
for (int i = 0; i < size; i++) {
const char *ssid = ap[i].get_ssid();
@ -96,9 +62,6 @@ void test_emac_initialize()
printf("ch %i\r\n\r\n", ch);
}
#endif
network_interface->set_credentials(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, MBED_CONF_APP_WIFI_SECURITY);
#endif
// Power up the interface and emac driver
@ -154,5 +117,3 @@ bool emac_if_init(EMAC *emac)
return true;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -163,5 +161,3 @@ void test_emac_memory()
TEST_ASSERT_FALSE(ERROR_FLAGS);
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -166,5 +164,3 @@ void test_emac_multicast_filter()
TEST_ASSERT_FALSE(ERROR_FLAGS);
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -78,4 +76,3 @@ void test_emac_unicast()
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -86,5 +84,3 @@ void test_emac_unicast_burst()
TEST_ASSERT_FALSE(ERROR_FLAGS);
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -81,5 +79,3 @@ void test_emac_unicast_frame_len()
TEST_ASSERT_FALSE(ERROR_FLAGS);
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "emac_tests.h"
#include "emac_util.h"
#include "emac_ctp.h"
@ -83,5 +81,3 @@ void test_emac_unicast_long()
TEST_ASSERT_FALSE(ERROR_FLAGS);
RESET_OUTGOING_MSG_DATA;
}
#endif

View File

@ -20,8 +20,6 @@
#include "unity.h"
#include "utest.h"
#if MBED_CONF_APP_TEST_WIFI || MBED_CONF_APP_TEST_ETHERNET
#include "mbed.h"
#include "EMAC.h"
@ -584,5 +582,3 @@ void emac_if_set_mtu_size(int mtu_size)
{
eth_mtu_size = mtu_size;
}
#endif

View File

@ -15,24 +15,21 @@
* limitations under the License.
*/
#if !defined(MBED_CONF_APP_TEST_WIFI) || \
!defined(MBED_CONF_APP_TEST_ETHERNET) || \
!defined(MBED_CONF_APP_ECHO_SERVER) || \
#if !defined(MBED_CONF_APP_ECHO_SERVER) || \
!defined(MBED_CONF_APP_ECHO_SERVER_TRACE) || \
!defined(MBED_CONF_APP_WIFI_SCAN) || \
!defined(MBED_CONF_APP_WIFI_SSID ) || \
!defined(MBED_CONF_APP_WIFI_SECURITY) || \
!defined(MBED_CONF_APP_WIFI_PASSWORD)
!defined(MBED_CONF_APP_WIFI_SCAN)
#error [NOT_SUPPORTED] Requires parameters from mbed_app.json
#endif
#if !MBED_CONF_APP_TEST_WIFI && !MBED_CONF_APP_TEST_ETHERNET
#define ETHERNET 1
#define WIFI 2
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE != ETHERNET && \
MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE != WIFI
#error [NOT_SUPPORTED] Either wifi or ethernet testing need to be enabled
#endif
#if MBED_CONF_APP_TEST_WIFI && MBED_CONF_APP_TEST_ETHERNET
#error [NOT_SUPPORTED] Both wifi and ethernet testing cannot be enabled
#endif
#if MBED_CONF_APP_TEST_WIFI
#if MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE == WIFI
#if !defined(TARGET_UBLOX_EVK_ODIN_W2) && \
!defined(TARGET_REALTEK_RTL8195AM) && \
!defined(TARGET_MTB_ADV_WISE_1530) && \

View File

@ -1,13 +1,5 @@
{
"config": {
"test-ethernet": {
"help": "Enable ethernet testing",
"value": 1
},
"test-wifi": {
"help": "Enable wifi testing",
"value": 0
},
"echo-server": {
"help": "Build test to be echo server",
"value": 0
@ -19,22 +11,13 @@
"wifi-scan": {
"help": "Scan and list access points",
"value": 0
},
"wifi-ssid": {
"help": "WiFi SSID for network",
"value": "\"SSID\""
},
"wifi-security": {
"help": "WiFi Security",
"value": "NSAPI_SECURITY_WPA_WPA2"
},
"wifi-password": {
"help": "WiFi Password",
"value": "\"PASSWORD\""
}
},
"target_overrides": {
"*": {
"nsapi.default-wifi-ssid": "\"WIFI_SSID\"",
"nsapi.default-wifi-password": "\"WIFI_PASSWORD\"",
"nsapi.default-wifi-security": "WIFI_SECURITY",
"nsapi.default-stack": "TEST"
}
}

View File

@ -1,13 +1,5 @@
{
"config": {
"test-ethernet": {
"help": "Enable ethernet testing",
"value": 1
},
"test-wifi": {
"help": "Enable wifi testing",
"value": 0
},
"echo-server": {
"help": "Build test to be echo server",
"value": 1
@ -19,22 +11,13 @@
"wifi-scan": {
"help": "Scan and list access points",
"value": 0
},
"wifi-ssid": {
"help": "WiFi SSID for network",
"value": "\"SSID\""
},
"wifi-security": {
"help": "WiFi Security",
"value": "NSAPI_SECURITY_WPA_WPA2"
},
"wifi-password": {
"help": "WiFi Password",
"value": "\"PASSWORD\""
}
},
"target_overrides": {
"*": {
"nsapi.default-wifi-ssid": "\"WIFI_SSID\"",
"nsapi.default-wifi-password": "\"WIFI_PASSWORD\"",
"nsapi.default-wifi-security": "WIFI_SECURITY",
"nsapi.default-stack": "TEST"
}
}

View File

@ -15,16 +15,17 @@
* limitations under the License.
*/
#ifndef MBED_CONF_APP_OBJECT_CONSTRUCTION
#error [NOT_SUPPORTED] No network interface found for this target.
#define WIFI 2
#if !defined(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE) || \
MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE != WIFI
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#if !defined(MBED_CONF_APP_WIFI_SECURE_SSID) && !defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
#error [NOT_SUPPORTED] Requires parameters from mbed_app.json
#endif
#include "mbed.h"
#include MBED_CONF_APP_HEADER_FILE
#include "WiFiInterface.h"
WiFiInterface *get_interface()
{
@ -35,7 +36,7 @@ WiFiInterface *get_interface()
return interface;
}
interface = MBED_CONF_APP_OBJECT_CONSTRUCTION;
interface = WiFiInterface::get_default_instance();
return interface;
}

View File

@ -15,8 +15,10 @@
* limitations under the License.
*/
#ifndef MBED_CONF_APP_OBJECT_CONSTRUCTION
#error [NOT_SUPPORTED] No network interface found for this target.
#define WIFI 2
#if !defined(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE) || \
MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE != WIFI
#error [NOT_SUPPORTED] No network configuration found for this target.
#endif
#include "mbed.h"

View File

@ -24,13 +24,6 @@
"help": "Channel number of unsecure SSID",
"value": 2
},
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"WIFI_INTERFACE.h\""
},
"object-construction" : {
"value" : "new WIFI_INTERFACE()"
},
"ap-mac-secure": {
"help": "BSSID of secure AP in form of AA:BB:CC:DD:EE:FF",
"value": "\"AA:AA:AA:AA:AA:AA\""
@ -43,5 +36,10 @@
"help": "How many networks may appear in Wifi scan result",
"value": 10
}
},
"target_overrides": {
"*": {
"target.network-default-interface-type": "WIFI"
}
}
}

View File

@ -36,6 +36,8 @@ void wifi_connect_params_channel(void)
nsapi_error_t error = wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security(), MBED_CONF_APP_WIFI_CH_SECURE);
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, error);
wifi->set_channel(0);
}
#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID)

View File

@ -36,6 +36,8 @@ void wifi_connect_params_channel_fail(void)
nsapi_error_t error = wifi->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, get_security(), MBED_CONF_APP_WIFI_CH_UNSECURE);
TEST_ASSERT(error == NSAPI_ERROR_CONNECTION_TIMEOUT || error == NSAPI_ERROR_NO_CONNECTION);
wifi->set_channel(0);
}
#endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID)

View File

@ -1,16 +1,5 @@
{
"config": {
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"ESP8266Interface.h\""
},
"object-construction" : {
"value" : "new ESP8266Interface( D1, D0, false )"
},
"connect-statement" : {
"help" : "Must use 'net' variable name, replace WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY with your WiFi settings",
"value" : "((ESP8266Interface *)net)->connect(WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY)"
},
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
@ -18,20 +7,15 @@
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
},
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : null
},
"tcp-client-echo-buffer-size" : {
"help" : "Number of bytes to be send to echo server",
"value" : "200"
},
"ESP8266-TX": {
"value":"D1"
},
"ESP8266-RX": {
"value":"D0"
}
},
"target_overrides": {
"*": {
"target.network-default-interface-type": "WIFI",
"nsapi.default-wifi-ssid": "\"WIFI_SSID\"",
"nsapi.default-wifi-password": "\"WIFI_PASSWORD\"",
"nsapi.default-wifi-security": "WIFI_SECURITY",
"esp8266.provide-default": true
}
}
}

View File

@ -1,16 +1,5 @@
{
"config": {
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"EthernetInterface.h\""
},
"object-construction" : {
"value" : "new EthernetInterface()"
},
"connect-statement" : {
"help" : "Must use 'net' variable name",
"value" : "net->connect()"
},
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
@ -18,16 +7,11 @@
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
},
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : null
}
},
"target_overrides": {
"*": {
"target.features_add": ["LWIP"],
"nsapi.default-stack": "LWIP"
"target.network-default-interface-type": "ETHERNET"
}
}
}

View File

@ -1,16 +1,5 @@
{
"config": {
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"EthernetInterface.h\""
},
"object-construction" : {
"value" : "new EthernetInterface()"
},
"connect-statement" : {
"help" : "Must use 'net' variable name",
"value" : "net->connect()"
},
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
@ -19,10 +8,6 @@
"help" : "Port of echo server",
"value" : "7"
},
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : null
},
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
@ -31,8 +16,7 @@
},
"target_overrides": {
"*": {
"target.features_add": ["LWIP"],
"nsapi.default-stack": "LWIP"
"target.network-default-interface-type": "ETHERNET"
}
}
}

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"
},
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
"value": "HeapBlockDevice"
}
},
"target_overrides": {
"*": {
"target.network-default-interface-type": "WIFI",
"nsapi.default-wifi-ssid": "\"WIFI_SSID\"",
"nsapi.default-wifi-password": "\"WIFI_PASSWORD\"",
"nsapi.default-wifi-security": "WIFI_SECURITY"
}
}
}

View File

@ -1,16 +1,5 @@
{
"config": {
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"ISM43362Interface.h\""
},
"object-construction" : {
"value" : "new ISM43362Interface()"
},
"connect-statement" : {
"help" : "Must use 'net' variable name",
"value" : "net->wifiInterface()->connect(MBED_CONF_APP_WIFI_SECURE_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2)"
},
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
@ -19,14 +8,6 @@
"help" : "Port of echo server",
"value" : "7"
},
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : null
},
"tcp-client-echo-buffer-size" : {
"help" : "Number of bytes to be send to echo server",
"value" : "200"
},
"wifi-secure-ssid": {
"help": "WiFi SSID for WPA2 secured network",
"value": "\"SSID-SECURE\""
@ -66,7 +47,12 @@
},
"target_overrides": {
"*": {
"platform.stdio-convert-newlines": true
"platform.stdio-convert-newlines": true,
"target.network-default-interface-type": "WIFI",
"nsapi.default-wifi-ssid": "\"WIFI_SSID\"",
"nsapi.default-wifi-password": "\"WIFI_PASSWORD\"",
"nsapi.default-wifi-security": "WIFI_SECURITY",
"ism43362.provide-default": true
}
}
}

View File

@ -1,38 +0,0 @@
{
"config": {
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"OdinWiFiInterface.h\""
},
"object-construction" : {
"value" : "new OdinWiFiInterface()"
},
"connect-statement" : {
"help" : "Must use 'net' variable name",
"value" : "net->wifiInterface()->connect(WIFI_SSID, WIFI_PASSWORD)"
},
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
},
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
},
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : null
},
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
"value": "HeapBlockDevice"
}
},
"target_overrides": {
"*": {
"target.features_add": ["LWIP"],
"nsapi.default-stack": "LWIP"
}
}
}

View File

@ -1,38 +0,0 @@
{
"config": {
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"EthernetInterface.h\""
},
"object-construction" : {
"value" : "new EthernetInterface()"
},
"connect-statement" : {
"help" : "Must use 'net' variable name",
"value" : "net->connect()"
},
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
},
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
},
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : null
},
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
"value": "HeapBlockDevice"
}
},
"target_overrides": {
"*": {
"target.features_add": ["LWIP"],
"nsapi.default-stack": "LWIP"
}
}
}

View File

@ -1,38 +0,0 @@
{
"config": {
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"RTWInterface.h\""
},
"object-construction" : {
"value" : "new RTWInterface()"
},
"connect-statement" : {
"help" : "Must use 'net' variable name, replace WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY, WIFI_CHANNEL with your WiFi settings",
"value" : "net->wifiInterface()->connect(WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY, WIFI_CHANNEL)"
},
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
},
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
},
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : null
},
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
"value": "HeapBlockDevice"
}
},
"target_overrides": {
"*": {
"target.features_add": ["LWIP"],
"nsapi.default-stack": "LWIP"
}
}
}

View File

@ -1,16 +1,5 @@
{
"config": {
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"SpwfSAInterface.h\""
},
"object-construction" : {
"value" : "new SpwfSAInterface( D8, D2 )"
},
"connect-statement" : {
"help" : "Must use 'net' variable name, replace WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY with your WiFi settings",
"value" : "((SpwfSAInterface *)net)->connect(WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY)"
},
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
@ -19,9 +8,22 @@
"help" : "Port of echo server",
"value" : "7"
},
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : null
"WIFI-TX" : {
"help" : "Wifi TX pin",
"value" : "D8"
},
"WIFI-RX" : {
"help" : "Wifi RX pin",
"value" : "D2"
}
},
"target_overrides": {
"*": {
"target.network-default-interface-type": "WIFI",
"nsapi.default-wifi-ssid": "\"WIFI_SSID\"",
"nsapi.default-wifi-password": "\"WIFI_PASSWORD\"",
"nsapi.default-wifi-security": "WIFI_SECURITY",
"idw0xx1.provide-default": true
}
}
}

View File

@ -1,49 +0,0 @@
{
"config": {
"header-file": {
"help" : "String for including your driver header file",
"value" : "\"WicedInterface.h\""
},
"object-construction" : {
"value" : "new WicedInterface()"
},
"connect-statement" : {
"help" : "Must use 'net' variable name, replace WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY with your WiFi settings",
"value" : "net->wifiInterface()->connect(WIFI_SSID, WIFI_PASSWORD, WIFI_SECURITY)"
},
"echo-server-addr" : {
"help" : "IP address of echo server",
"value" : "\"echo.mbedcloudtesting.com\""
},
"echo-server-port" : {
"help" : "Port of echo server",
"value" : "7"
},
"tcp-echo-prefix" : {
"help" : "Some servers send a prefix before echoed message",
"value" : null
},
"sim-blockdevice": {
"help": "Simulated block device, requires sufficient heap",
"macro_name": "MBED_TEST_SIM_BLOCKDEVICE",
"value": "HeapBlockDevice"
}
},
"target_overrides": {
"*": {
"nsapi.default-stack": "LWIP"
},
"MTB_ADV_WISE_1530": {
"target.extra_labels_add": ["WICED"],
"target.features_add": ["BLE", "LWIP"]
},
"MTB_USI_WM_BN_BM_22": {
"target.extra_labels_add": ["WICED"],
"target.features_add": ["BLE", "LWIP"]
},
"MTB_MXCHIP_EMW3166": {
"target.extra_labels_add": ["WICED"],
"target.features_add": ["LWIP"]
}
}
}

View File

@ -2,11 +2,8 @@
"ETHERNET" : "EthernetInterface.json",
"HEAPBLOCKDEVICE": "HeapBlockDevice.json",
"HEAPBLOCKDEVICE_AND_ETHERNET": "HeapBlockDeviceAndEthernetInterface.json",
"ODIN_WIFI" : "OdinInterface.json",
"ODIN_ETHERNET" : "Odin_EthernetInterface.json",
"REALTEK_WIFI" : "RealtekInterface.json",
"HEAPBLOCKDEVICE_AND_WIFI": "HeapBlockDeviceAndWifiInterface.json",
"ESP8266_WIFI" : "ESP8266Interface.json",
"WICED_WIFI" : "WicedInterface.json",
"ISM43362_WIFI" : "ISM43362Interface.json",
"IDW0XX1_WIFI" : "SpwfSAInterface.json"
}

View File

@ -1,11 +1,11 @@
{
"UBLOX_EVK_ODIN_W2": {
"default_test_configuration": "NONE",
"test_configurations": ["ODIN_WIFI", "ODIN_ETHERNET"]
"test_configurations": ["HEAPBLOCKDEVICE_AND_WIFI", "HEAPBLOCKDEVICE_AND_ETHERNET"]
},
"REALTEK_RTL8195AM": {
"default_test_configuration": "NONE",
"test_configurations": ["REALTEK_WIFI"]
"test_configurations": ["HEAPBLOCKDEVICE_AND_WIFI"]
},
"K64F": {
"default_test_configuration": "HEAPBLOCKDEVICE_AND_ETHERNET",
@ -25,19 +25,19 @@
},
"MTB_UBLOX_ODIN_W2": {
"default_test_configuration": "NONE",
"test_configurations": ["ODIN_WIFI"]
"test_configurations": ["HEAPBLOCKDEVICE_AND_WIFI"]
},
"MTB_ADV_WISE_1530": {
"default_test_configuration": "NONE",
"test_configurations": ["WICED_WIFI"]
"test_configurations": ["HEAPBLOCKDEVICE_AND_WIFI"]
},
"MTB_USI_WM_BN_BM_22": {
"default_test_configuration": "NONE",
"test_configurations": ["WICED_WIFI"]
"test_configurations": ["HEAPBLOCKDEVICE_AND_WIFI"]
},
"MTB_MXCHIP_EMW3166": {
"default_test_configuration": "NONE",
"test_configurations": ["WICED_WIFI"]
"test_configurations": ["HEAPBLOCKDEVICE_AND_WIFI"]
},
"NUCLEO_F401RE": {
"default_test_configuration": "NONE",