takashi kadono
/
Nucleo_446
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/TESTS/network/wifi/main.cpp@3:f3764f852aa8, 2018-10-11 (annotated)
- Committer:
- kadonotakashi
- Date:
- Thu Oct 11 02:27:46 2018 +0000
- Revision:
- 3:f3764f852aa8
- Parent:
- 0:8fdf9a60065b
Nucreo 446 + SSD1331 test version;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /* |
kadonotakashi | 0:8fdf9a60065b | 2 | * Copyright (c) 2017, ARM Limited, All Rights Reserved |
kadonotakashi | 0:8fdf9a60065b | 3 | * SPDX-License-Identifier: Apache-2.0 |
kadonotakashi | 0:8fdf9a60065b | 4 | * |
kadonotakashi | 0:8fdf9a60065b | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
kadonotakashi | 0:8fdf9a60065b | 6 | * not use this file except in compliance with the License. |
kadonotakashi | 0:8fdf9a60065b | 7 | * You may obtain a copy of the License at |
kadonotakashi | 0:8fdf9a60065b | 8 | * |
kadonotakashi | 0:8fdf9a60065b | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
kadonotakashi | 0:8fdf9a60065b | 10 | * |
kadonotakashi | 0:8fdf9a60065b | 11 | * Unless required by applicable law or agreed to in writing, software |
kadonotakashi | 0:8fdf9a60065b | 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
kadonotakashi | 0:8fdf9a60065b | 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kadonotakashi | 0:8fdf9a60065b | 14 | * See the License for the specific language governing permissions and |
kadonotakashi | 0:8fdf9a60065b | 15 | * limitations under the License. |
kadonotakashi | 0:8fdf9a60065b | 16 | */ |
kadonotakashi | 0:8fdf9a60065b | 17 | |
kadonotakashi | 0:8fdf9a60065b | 18 | #define WIFI 2 |
kadonotakashi | 0:8fdf9a60065b | 19 | #if !defined(MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE) || \ |
kadonotakashi | 0:8fdf9a60065b | 20 | MBED_CONF_TARGET_NETWORK_DEFAULT_INTERFACE_TYPE != WIFI |
kadonotakashi | 0:8fdf9a60065b | 21 | #error [NOT_SUPPORTED] No network configuration found for this target. |
kadonotakashi | 0:8fdf9a60065b | 22 | #endif |
kadonotakashi | 0:8fdf9a60065b | 23 | |
kadonotakashi | 0:8fdf9a60065b | 24 | #include "mbed.h" |
kadonotakashi | 0:8fdf9a60065b | 25 | #include "greentea-client/test_env.h" |
kadonotakashi | 0:8fdf9a60065b | 26 | #include "unity.h" |
kadonotakashi | 0:8fdf9a60065b | 27 | #include "utest.h" |
kadonotakashi | 0:8fdf9a60065b | 28 | #include "wifi_tests.h" |
kadonotakashi | 0:8fdf9a60065b | 29 | |
kadonotakashi | 0:8fdf9a60065b | 30 | // Test for parameters |
kadonotakashi | 0:8fdf9a60065b | 31 | #if defined(MBED_CONF_APP_WIFI_SECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 32 | #if !defined(MBED_CONF_APP_AP_MAC_SECURE) || \ |
kadonotakashi | 0:8fdf9a60065b | 33 | !defined(MBED_CONF_APP_MAX_SCAN_SIZE) || \ |
kadonotakashi | 0:8fdf9a60065b | 34 | !defined(MBED_CONF_APP_WIFI_CH_SECURE) || \ |
kadonotakashi | 0:8fdf9a60065b | 35 | !defined(MBED_CONF_APP_WIFI_PASSWORD) || \ |
kadonotakashi | 0:8fdf9a60065b | 36 | !defined(MBED_CONF_APP_WIFI_SECURE_SSID) || \ |
kadonotakashi | 0:8fdf9a60065b | 37 | !defined MBED_CONF_APP_WIFI_SECURE_PROTOCOL |
kadonotakashi | 0:8fdf9a60065b | 38 | #error [NOT_SUPPORTED] Requires parameters from mbed_app.json (for secure connections) |
kadonotakashi | 0:8fdf9a60065b | 39 | #endif |
kadonotakashi | 0:8fdf9a60065b | 40 | #endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 41 | |
kadonotakashi | 0:8fdf9a60065b | 42 | #if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 43 | #if !defined(MBED_CONF_APP_AP_MAC_UNSECURE) || \ |
kadonotakashi | 0:8fdf9a60065b | 44 | !defined(MBED_CONF_APP_MAX_SCAN_SIZE) || \ |
kadonotakashi | 0:8fdf9a60065b | 45 | !defined(MBED_CONF_APP_WIFI_CH_UNSECURE) || \ |
kadonotakashi | 0:8fdf9a60065b | 46 | !defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 47 | #error [NOT_SUPPORTED] Requires parameters from mbed_app.json (for unsecure connections) |
kadonotakashi | 0:8fdf9a60065b | 48 | #endif |
kadonotakashi | 0:8fdf9a60065b | 49 | #endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 50 | |
kadonotakashi | 0:8fdf9a60065b | 51 | using namespace utest::v1; |
kadonotakashi | 0:8fdf9a60065b | 52 | |
kadonotakashi | 0:8fdf9a60065b | 53 | utest::v1::status_t test_setup(const size_t number_of_cases) |
kadonotakashi | 0:8fdf9a60065b | 54 | { |
kadonotakashi | 0:8fdf9a60065b | 55 | GREENTEA_SETUP(240, "default_auto"); |
kadonotakashi | 0:8fdf9a60065b | 56 | return verbose_test_setup_handler(number_of_cases); |
kadonotakashi | 0:8fdf9a60065b | 57 | } |
kadonotakashi | 0:8fdf9a60065b | 58 | |
kadonotakashi | 0:8fdf9a60065b | 59 | // Test cases |
kadonotakashi | 0:8fdf9a60065b | 60 | Case cases[] = { |
kadonotakashi | 0:8fdf9a60065b | 61 | Case("WIFI-CONSTRUCTOR", wifi_constructor), |
kadonotakashi | 0:8fdf9a60065b | 62 | Case("WIFI-CONNECT-NOCREDENTIALS", wifi_connect_nocredentials), |
kadonotakashi | 0:8fdf9a60065b | 63 | Case("WIFI-SET-CREDENTIAL", wifi_set_credential), |
kadonotakashi | 0:8fdf9a60065b | 64 | Case("WIFI-SET-CHANNEL", wifi_set_channel), |
kadonotakashi | 0:8fdf9a60065b | 65 | #if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 66 | Case("WIFI-GET-RSSI", wifi_get_rssi), |
kadonotakashi | 0:8fdf9a60065b | 67 | #endif |
kadonotakashi | 0:8fdf9a60065b | 68 | Case("WIFI-CONNECT-PARAMS-NULL", wifi_connect_params_null), |
kadonotakashi | 0:8fdf9a60065b | 69 | #if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 70 | Case("WIFI-CONNECT-PARAMS-VALID-UNSECURE", wifi_connect_params_valid_unsecure), |
kadonotakashi | 0:8fdf9a60065b | 71 | #endif |
kadonotakashi | 0:8fdf9a60065b | 72 | #if defined(MBED_CONF_APP_WIFI_SECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 73 | Case("WIFI-CONNECT-PARAMS-VALID-SECURE", wifi_connect_params_valid_secure), |
kadonotakashi | 0:8fdf9a60065b | 74 | Case("WIFI-CONNECT-PARAMS-CHANNEL", wifi_connect_params_channel), |
kadonotakashi | 0:8fdf9a60065b | 75 | Case("WIFI-CONNECT-PARAMS-CHANNEL-FAIL", wifi_connect_params_channel_fail), |
kadonotakashi | 0:8fdf9a60065b | 76 | #endif |
kadonotakashi | 0:8fdf9a60065b | 77 | #if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 78 | Case("WIFI-CONNECT", wifi_connect), |
kadonotakashi | 0:8fdf9a60065b | 79 | #endif |
kadonotakashi | 0:8fdf9a60065b | 80 | #if defined(MBED_CONF_APP_WIFI_SECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 81 | Case("WIFI-CONNECT-SECURE", wifi_connect_secure), |
kadonotakashi | 0:8fdf9a60065b | 82 | Case("WIFI-CONNECT-SECURE-FAIL", wifi_connect_secure_fail), |
kadonotakashi | 0:8fdf9a60065b | 83 | #endif |
kadonotakashi | 0:8fdf9a60065b | 84 | #if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 85 | Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat), |
kadonotakashi | 0:8fdf9a60065b | 86 | #endif |
kadonotakashi | 0:8fdf9a60065b | 87 | Case("WIFI-SCAN-NULL", wifi_scan_null), |
kadonotakashi | 0:8fdf9a60065b | 88 | #if defined(MBED_CONF_APP_WIFI_SECURE_SSID) && defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) |
kadonotakashi | 0:8fdf9a60065b | 89 | Case("WIFI-SCAN", wifi_scan), |
kadonotakashi | 0:8fdf9a60065b | 90 | #endif |
kadonotakashi | 0:8fdf9a60065b | 91 | }; |
kadonotakashi | 0:8fdf9a60065b | 92 | |
kadonotakashi | 0:8fdf9a60065b | 93 | Specification specification(test_setup, cases); |
kadonotakashi | 0:8fdf9a60065b | 94 | |
kadonotakashi | 0:8fdf9a60065b | 95 | // Entry point into the tests |
kadonotakashi | 0:8fdf9a60065b | 96 | int main() |
kadonotakashi | 0:8fdf9a60065b | 97 | { |
kadonotakashi | 0:8fdf9a60065b | 98 | return !Harness::run(specification); |
kadonotakashi | 0:8fdf9a60065b | 99 | } |