-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Icetea support #7745
Merged
Merged
Icetea support #7745
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
e27a26e
Icetea support
9f3704e
Add icetea in requirements
75400ed
Fix mbed-client-cli part
fbbbc0d
Move mbed-client-cli in right place
db1b53e
Limit mbed-ls less than 2 because of icetea and mbed-flashed support
1e883c5
removed mbed-client-cli tests folder from root
2ddaed3
Changes needed for abstract socket interface
6091187
Icetea version update
3b3bed2
Small fixes based on github comments
bf1781b
Remove autoformatting
b35aea2
Roll back initialization with super because it does not work with ice…
e4e6ddc
Fix doxygen from ns_cmdline.h
664d98a
Remove startuml doxygen-command
7739040
Update copyright texts
912c4f5
Remove not needed test_suite.json
54ff956
Autoformatting files
49f842b
Use icetea random string generator
ccf4416
Move test_suite.json ignore in project level
c38769b
review corrections
d2c736b
Added nanostack mac tester and testcases
5eb3456
Added test config for mac tester
a508896
Use NanostackRfPhy::get_default_instance() for finding the driver (#2)
e4f4e64
Use nanostack-libservice stoip4 to check if address is ipv4
bf7dc1b
Fix copyrights in python scripts
8a107ac
Remove unused aliases
449ef92
Update licenses
b4822c8
Fix typo
cae3d1d
update example
2d787c5
Autoformatted mac tests
564fdd5
Astyle for test applications
dddac58
Fix readme based on comments in pull request
2f01555
Fix typo
b41d215
Update to icetea 1.* version
1209e73
Fix issues coming from network default interface
4e38f73
Fix after rebase
7014905
Remove MAC tests because not completely ready yet
b433687
Skip the example app
2edc5f0
Readme and help fixes
a58aa58
Remove MAC tester related code
6609faa
Update icetea
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (c) 2018 ARM Limited. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Licensed under the Apache License, Version 2.0 (the License); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include <stdio.h> | ||
#include <stdarg.h> | ||
#include "mbed.h" | ||
#include "mbed-client-cli/ns_cmdline.h" | ||
|
||
#ifndef ICETEA_EXAMPLE_ENABLED | ||
#error [NOT_SUPPORTED] Skipping example application. | ||
#endif | ||
/** | ||
* Macros for setting console flow control. | ||
*/ | ||
#define CONSOLE_FLOWCONTROL_RTS 1 | ||
#define CONSOLE_FLOWCONTROL_CTS 2 | ||
#define CONSOLE_FLOWCONTROL_RTSCTS 3 | ||
#define mbed_console_concat_(x) CONSOLE_FLOWCONTROL_##x | ||
#define mbed_console_concat(x) mbed_console_concat_(x) | ||
#define CONSOLE_FLOWCONTROL mbed_console_concat(MBED_CONF_TARGET_CONSOLE_UART_FLOW_CONTROL) | ||
|
||
#define SERIAL_CONSOLE_BAUD_RATE 115200 | ||
|
||
void cmd_ready_cb(int retcode) | ||
{ | ||
cmd_next(retcode); | ||
} | ||
|
||
void wrap_printf(const char *f, va_list a) | ||
{ | ||
vprintf(f, a); | ||
} | ||
|
||
int main() | ||
{ | ||
cmd_init(&wrap_printf); | ||
|
||
int c; | ||
while ((c = getchar()) != EOF) { | ||
cmd_char_input(c); | ||
} | ||
return 0; | ||
} | ||
|
||
FileHandle *mbed::mbed_override_console(int) | ||
{ | ||
static UARTSerial console(STDIO_UART_TX, STDIO_UART_RX, SERIAL_CONSOLE_BAUD_RATE); | ||
#if CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTS | ||
console.set_flow_control(SerialBase::RTS, STDIO_UART_RTS, NC); | ||
#elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_CTS | ||
console.set_flow_control(SerialBase::CTS, NC, STDIO_UART_CTS); | ||
#elif CONSOLE_FLOWCONTROL == CONSOLE_FLOWCONTROL_RTSCTS | ||
console.set_flow_control(SerialBase::RTSCTS, STDIO_UART_RTS, STDIO_UART_CTS); | ||
#endif | ||
return &console; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
/* | ||
* Copyright (c) 2018 ARM Limited. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Licensed under the Apache License, Version 2.0 (the License); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include "NetworkStack.h" | ||
#include "NetworkInterface.h" | ||
|
||
#include "mbed-client-cli/ns_cmdline.h" | ||
#include "mbed-trace/mbed_trace.h" | ||
|
||
#include "ip4string.h" | ||
|
||
#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 | ||
|
||
#include <string.h> | ||
|
||
#define TRACE_GROUP "Aifc" | ||
|
||
NetworkInterface *net; | ||
|
||
NetworkInterface *get_interface(void) | ||
{ | ||
return net; | ||
} | ||
|
||
int cmd_ifup(int argc, char *argv[]); | ||
int cmd_ifdown(int argc, char *argv[]); | ||
int cmd_ifconfig(int argc, char *argv[]); | ||
|
||
const char *MAN_IFCONFIG = " ifup interface up\r\n"\ | ||
" ifdown interface down\r\n"; | ||
|
||
static void ifconfig_print() | ||
{ | ||
if (!net) { | ||
cmd_printf("No interface configured\r\n"); | ||
return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe here should be print that no interface configured etc |
||
} | ||
const char *str = net->get_ip_address(); | ||
if (str) { | ||
uint8_t buf[4]; | ||
if (stoip4(str, strlen(str), buf)) { | ||
cmd_printf("IPv4 if addr: %s\r\n", str); | ||
} else { | ||
cmd_printf("IPv6 if addr:\r\n [0]: %s\r\n", str); | ||
} | ||
} else { | ||
cmd_printf("No IP address\r\n"); | ||
} | ||
str = net->get_mac_address(); | ||
if (str) { | ||
cmd_printf("MAC-48: %s\r\n", str); | ||
} else { | ||
cmd_printf("MAC-48: unknown\r\n"); | ||
} | ||
} | ||
|
||
|
||
void cmd_ifconfig_init(void) | ||
{ | ||
cmd_add("ifup", cmd_ifup, "ifconfig up", MAN_IFCONFIG); | ||
cmd_add("ifdown", cmd_ifdown, "ifconfig down", MAN_IFCONFIG); | ||
cmd_add("ifconfig", cmd_ifconfig, "ifconfig", MAN_IFCONFIG); | ||
} | ||
|
||
int cmd_ifconfig(int argc, char *argv[]) | ||
{ | ||
ifconfig_print(); | ||
return CMDLINE_RETCODE_SUCCESS; | ||
} | ||
|
||
int cmd_ifup(int argc, char *argv[]) | ||
{ | ||
if (!net) { | ||
net = NetworkInterface::get_default_instance(); | ||
} | ||
int err = net->connect(); | ||
if (err != NSAPI_ERROR_OK) { | ||
return CMDLINE_RETCODE_FAIL; | ||
} | ||
|
||
ifconfig_print(); | ||
return CMDLINE_RETCODE_SUCCESS; | ||
} | ||
|
||
int cmd_ifdown(int argc, char *argv[]) | ||
{ | ||
if (!net) { | ||
return CMDLINE_RETCODE_FAIL; | ||
} | ||
int err = net->disconnect(); | ||
if (err != NSAPI_ERROR_OK) { | ||
return CMDLINE_RETCODE_FAIL; | ||
} | ||
|
||
return CMDLINE_RETCODE_SUCCESS; | ||
} | ||
|
||
|
||
|
||
const char *networkstack_error_to_str(int errorcode) | ||
{ | ||
switch (errorcode) { | ||
case NSAPI_ERROR_OK: | ||
return "NSAPI_ERROR_OK"; | ||
case NSAPI_ERROR_WOULD_BLOCK: | ||
return "NSAPI_ERROR_WOULD_BLOCK"; | ||
case NSAPI_ERROR_UNSUPPORTED: | ||
return "NSAPI_ERROR_UNSUPPORTED"; | ||
case NSAPI_ERROR_PARAMETER: | ||
return "NSAPI_ERROR_PARAMETER"; | ||
case NSAPI_ERROR_NO_CONNECTION: | ||
return "NSAPI_ERROR_NO_CONNECTION"; | ||
case NSAPI_ERROR_NO_SOCKET: | ||
return "NSAPI_ERROR_NO_SOCKET"; | ||
case NSAPI_ERROR_NO_ADDRESS: | ||
return "NSAPI_ERROR_NO_ADDRESS"; | ||
case NSAPI_ERROR_NO_MEMORY: | ||
return "NSAPI_ERROR_NO_MEMORY"; | ||
case NSAPI_ERROR_NO_SSID: | ||
return "NSAPI_ERROR_NO_SSID"; | ||
case NSAPI_ERROR_DNS_FAILURE: | ||
return "NSAPI_ERROR_DNS_FAILURE"; | ||
case NSAPI_ERROR_DHCP_FAILURE: | ||
return "NSAPI_ERROR_DHCP_FAILURE"; | ||
case NSAPI_ERROR_AUTH_FAILURE: | ||
return "NSAPI_ERROR_AUTH_FAILURE"; | ||
case NSAPI_ERROR_DEVICE_ERROR: | ||
return "NSAPI_ERROR_DEVICE_ERROR"; | ||
case NSAPI_ERROR_IN_PROGRESS: | ||
return "NSAPI_ERROR_IN_PROGRESS"; | ||
case NSAPI_ERROR_ALREADY: | ||
return "NSAPI_ERROR_ALREADY"; | ||
case NSAPI_ERROR_IS_CONNECTED: | ||
return "NSAPI_ERROR_IS_CONNECTED"; | ||
case NSAPI_ERROR_CONNECTION_LOST: | ||
return "NSAPI_ERROR_CONNECTION_LOST"; | ||
case NSAPI_ERROR_CONNECTION_TIMEOUT: | ||
return "NSAPI_ERROR_CONNECTION_TIMEOUT"; | ||
default: | ||
return "unknown error code"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2018 ARM Limited. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Licensed under the Apache License, Version 2.0 (the License); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#ifndef CMD_IFCONFIG_H | ||
#define CMD_IFCONFIG_H | ||
|
||
#include "NetworkInterface.h" | ||
#include "NetworkStack.h" | ||
|
||
/** Get a pointer to a network interface instance | ||
* | ||
* Allowed interface types (depend on application configurations): | ||
* cell0, wlan0, eth0, mesh0 | ||
* | ||
* @return pointer to the network interface, or NULL if unrecognized or ambiguous | ||
*/ | ||
NetworkInterface *get_interface(void); | ||
|
||
void cmd_ifconfig_init(void); | ||
const char *networkstack_error_to_str(int errorcode); | ||
|
||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: wrong indent - check whole file