From e9ffd2b2ef1f0d75f184be10c32c7b3e54679d18 Mon Sep 17 00:00:00 2001 From: armink Date: Fri, 12 Oct 2018 15:47:20 +0800 Subject: [PATCH 1/3] [component][at] Move at module version number definition to Kconfig file. --- components/net/at/Kconfig | 8 +++++++- components/net/at/include/at.h | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/net/at/Kconfig b/components/net/at/Kconfig index 84d7e094ad..9a464de9ec 100644 --- a/components/net/at/Kconfig +++ b/components/net/at/Kconfig @@ -76,7 +76,13 @@ if RT_USING_AT default n endif - + + config AT_SW_VERSION_NUM + int + default 0x10100 + help + sfotware module version number + endif endmenu diff --git a/components/net/at/include/at.h b/components/net/at/include/at.h index 4bb378583a..e63799d356 100644 --- a/components/net/at/include/at.h +++ b/components/net/at/include/at.h @@ -33,7 +33,6 @@ extern "C" { #endif #define AT_SW_VERSION "1.1.0" -#define AT_SW_VERSION_NUM 0x10100 #define DBG_ENABLE #define DBG_SECTION_NAME "AT" From 405fce917a4ce555ea2a20df28582af01f146211 Mon Sep 17 00:00:00 2001 From: armink Date: Fri, 12 Oct 2018 15:54:09 +0800 Subject: [PATCH 2/3] [component][at] Move at log from at.h to at_log.h . --- components/net/at/Kconfig | 2 +- components/net/at/at_socket/at_socket.c | 6 ++-- components/net/at/include/at.h | 17 +--------- components/net/at/include/at_log.h | 44 +++++++++++++++++++++++++ components/net/at/src/at_base_cmd.c | 4 +++ components/net/at/src/at_client.c | 6 ++++ components/net/at/src/at_server.c | 7 ++++ 7 files changed, 65 insertions(+), 21 deletions(-) create mode 100644 components/net/at/include/at_log.h diff --git a/components/net/at/Kconfig b/components/net/at/Kconfig index 9a464de9ec..568a0301b5 100644 --- a/components/net/at/Kconfig +++ b/components/net/at/Kconfig @@ -79,7 +79,7 @@ if RT_USING_AT config AT_SW_VERSION_NUM int - default 0x10100 + default 0x10200 help sfotware module version number diff --git a/components/net/at/at_socket/at_socket.c b/components/net/at/at_socket/at_socket.c index 6f12c1d22a..512fdcab68 100644 --- a/components/net/at/at_socket/at_socket.c +++ b/components/net/at/at_socket/at_socket.c @@ -34,10 +34,8 @@ #include #endif -#ifdef DBG_SECTION_NAME -#undef DBG_SECTION_NAME -#define DBG_SECTION_NAME "AT_SOC" -#endif +#define LOG_TAG "at.skt" +#include #define HTONS_PORT(x) ((((x) & 0x00ffUL) << 8) | (((x) & 0xff00UL) >> 8)) #define NIPQUAD(addr) \ diff --git a/components/net/at/include/at.h b/components/net/at/include/at.h index e63799d356..3555582174 100644 --- a/components/net/at/include/at.h +++ b/components/net/at/include/at.h @@ -32,17 +32,7 @@ extern "C" { #endif -#define AT_SW_VERSION "1.1.0" - -#define DBG_ENABLE -#define DBG_SECTION_NAME "AT" -#ifdef AT_DEBUG -#define DBG_LEVEL DBG_LOG -#else -#define DBG_LEVEL DBG_INFO -#endif /* AT_DEBUG */ -#define DBG_COLOR -#include +#define AT_SW_VERSION "1.2.0" #define AT_CMD_NAME_LEN 16 #define AT_END_MARK_LEN 4 @@ -51,11 +41,6 @@ extern "C" { #define AT_CMD_MAX_LEN 128 #endif -/* client receive idle timeout, client will wait this timeout when send data, unit: ms */ -#ifndef AT_CLIENT_RECV_IDEL -#define AT_CLIENT_RECV_IDEL 50 -#endif - /* the server AT commands new line sign */ #if defined(AT_CMD_END_MARK_CRLF) #define AT_CMD_END_MARK "\r\n" diff --git a/components/net/at/include/at_log.h b/components/net/at/include/at_log.h new file mode 100644 index 0000000000..bc97c45d0a --- /dev/null +++ b/components/net/at/include/at_log.h @@ -0,0 +1,44 @@ +/* + * File : at_log.h + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Change Logs: + * Date Author Notes + * 2018-10-12 armink first version + */ + +/* + * NOTE: DO NOT include this file on the header file. + */ + +#define DBG_ENABLE +#define DBG_COLOR + +#ifndef LOG_TAG +#define DBG_SECTION_NAME "at" +#else +#define DBG_SECTION_NAME LOG_TAG +#endif /* LOG_TAG */ + +#ifdef AT_DEBUG +#define DBG_LEVEL DBG_LOG +#else +#define DBG_LEVEL DBG_INFO +#endif /* AT_DEBUG */ + +#include diff --git a/components/net/at/src/at_base_cmd.c b/components/net/at/src/at_base_cmd.c index b334b1dba4..12fe864839 100644 --- a/components/net/at/src/at_base_cmd.c +++ b/components/net/at/src/at_base_cmd.c @@ -29,6 +29,8 @@ #include +#ifdef AT_USING_SERVER + #define AT_ECHO_MODE_CLOSE 0 #define AT_ECHO_MODE_OPEN 1 @@ -129,3 +131,5 @@ static at_result_t at_uart_setup(const char *args) } AT_CMD_EXPORT("AT+UART", "=,,,,", RT_NULL, at_uart_query, at_uart_setup, RT_NULL); + +#endif /* AT_USING_SERVER */ diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index c35336a7c3..705d500f07 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -29,6 +29,11 @@ #include #include +#define LOG_TAG "at.clnt" +#include + +#ifdef AT_USING_CLIENT + #define AT_RESP_END_OK "OK" #define AT_RESP_END_ERROR "ERROR" #define AT_RESP_END_FAIL "FAIL" @@ -924,3 +929,4 @@ __exit: return result; } +#endif /* AT_USING_CLIENT */ diff --git a/components/net/at/src/at_server.c b/components/net/at/src/at_server.c index 2c26fa2e8c..64420ffc6e 100644 --- a/components/net/at/src/at_server.c +++ b/components/net/at/src/at_server.c @@ -30,6 +30,11 @@ #include +#define LOG_TAG "at.svr" +#include + +#ifdef AT_USING_SERVER + #define AT_CMD_CHAR_0 '0' #define AT_CMD_CHAR_9 '9' #define AT_CMD_QUESTION_MARK '?' @@ -565,3 +570,5 @@ RT_WEAK void at_port_factory_reset(void) { LOG_E("The factory reset for AT server is not implement."); } + +#endif /* AT_USING_SERVER */ From 4e578b004270b7a3ec9dff93a3c03fa4254671d4 Mon Sep 17 00:00:00 2001 From: armink Date: Fri, 12 Oct 2018 16:02:20 +0800 Subject: [PATCH 3/3] [component][at] Change the license to Apache-2.0. --- components/net/at/at_socket/at_socket.c | 18 ++---------------- components/net/at/at_socket/at_socket.h | 18 ++---------------- components/net/at/include/at.h | 18 ++---------------- components/net/at/include/at_log.h | 18 ++---------------- components/net/at/src/at_base_cmd.c | 18 ++---------------- components/net/at/src/at_cli.c | 18 ++---------------- components/net/at/src/at_client.c | 18 ++---------------- components/net/at/src/at_server.c | 18 ++---------------- components/net/at/src/at_utils.c | 18 ++---------------- 9 files changed, 18 insertions(+), 144 deletions(-) diff --git a/components/net/at/at_socket/at_socket.c b/components/net/at/at_socket/at_socket.c index 512fdcab68..16c8c1d712 100644 --- a/components/net/at/at_socket/at_socket.c +++ b/components/net/at/at_socket/at_socket.c @@ -1,21 +1,7 @@ /* - * File : at_socket.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/at/at_socket/at_socket.h b/components/net/at/at_socket/at_socket.h index f6e2a69d5b..73368d28ca 100644 --- a/components/net/at/at_socket/at_socket.h +++ b/components/net/at/at_socket/at_socket.h @@ -1,21 +1,7 @@ /* - * File : at_socket.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/at/include/at.h b/components/net/at/include/at.h index 3555582174..9a2630203f 100644 --- a/components/net/at/include/at.h +++ b/components/net/at/include/at.h @@ -1,21 +1,7 @@ /* - * File : at.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/at/include/at_log.h b/components/net/at/include/at_log.h index bc97c45d0a..278763d30e 100644 --- a/components/net/at/include/at_log.h +++ b/components/net/at/include/at_log.h @@ -1,21 +1,7 @@ /* - * File : at_log.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/at/src/at_base_cmd.c b/components/net/at/src/at_base_cmd.c index 12fe864839..b182477f9b 100644 --- a/components/net/at/src/at_base_cmd.c +++ b/components/net/at/src/at_base_cmd.c @@ -1,21 +1,7 @@ /* - * File : at_base_cmd.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/at/src/at_cli.c b/components/net/at/src/at_cli.c index 39bc0265f6..60e3b4d868 100644 --- a/components/net/at/src/at_cli.c +++ b/components/net/at/src/at_cli.c @@ -1,21 +1,7 @@ /* - * File : at_cli.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index 705d500f07..9cdc7ec3d1 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -1,21 +1,7 @@ /* - * File : at_client.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/at/src/at_server.c b/components/net/at/src/at_server.c index 64420ffc6e..31f1bec96f 100644 --- a/components/net/at/src/at_server.c +++ b/components/net/at/src/at_server.c @@ -1,21 +1,7 @@ /* - * File : at_server.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/at/src/at_utils.c b/components/net/at/src/at_utils.c index 25ee705ee6..73a25da04e 100644 --- a/components/net/at/src/at_utils.c +++ b/components/net/at/src/at_utils.c @@ -1,21 +1,7 @@ /* - * File : at_utils.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2018, RT-Thread Development Team + * Copyright (c) 2006-2018, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes