-
Notifications
You must be signed in to change notification settings - Fork 5
AT Scripting Formatting Guidelines
This document provides rules and recommendations that support the production of AT scripts. It is a reference document for script developers.
When editing a file, apply the referred coding convention and, follow the style within the file.
All the below-mentioned sections shall be followed.
File names shall start with the directory name in lowercase letters and an underscore. Followed by the supported modules (specific/all) in lowercase letters and an underscore, then followed by a short description in lowercase letters and an underscore and at the end followed by the complexity level (basic/advance) in lowercase letter.
Name a script as below:
<directory_name>_<supported module>_<short description>_<complexity level>
- directory_name: knowledge-based directory name (sub folder short name: audio, cell, debug, sec, fwUpdate, ipApp, con, location, mno, powerMng, sim, sys respectively for each folder).
- supported module: ALL for all modems or modem name in case of a specific script.
- short description: short description of script functionality.
- complexity_level: basis or advance.
E.g., GitHub directory path m-center/at_scripts/cell_modem/ contains script:
cell_all_readNameAndFirmware_basic.atl
All AT scripts shall begin with the following legal headers:
/******************************************************************************
* Copyright (c) 2020 u-blox AG, Thalwil, Switzerland.
*
* 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.
******************************************************************************
* Synopsis: cell_all_readNameAndFirmware_basic.atl
* Topic: cell_modem
* Version: 1.0
* Author:
* Description:
* This Script has a purpose to read modem name, firmware version
* and submodule series.
******************************************************************************
* Modules: All Products
* Tested on: [Module Name]
******************************************************************************/
This section provides the general naming rules that shall be used for identifiers. As a general rule when using compound words, the underscore character must be used to separate the single words.
For the script writer the scripting language follows the widely known syntax of C/C++, but without the need to worry about pointers and memory leaks. Contrary to most scripting languages, AngelScript uses the common C/C++ datatypes for more efficient communication with the host application.
Function names must be defined in lower-case, must use the underscore as a word separator, and shall contain: the module name, the feature name, optionally a verb, and optionally one or more nouns. The format shall be:
<module_name><feature_name><verb>_<nouns>
General rules for variables:
- All characters in variable names shall be lower_case
- Underscores shall be used to separate words
- Names shall have readability and understandability, but keep them short (< 32 chars)
- Variable names shall be nouns or noun phrases.
E.g., bool write_enable = true;
A consistent layout is important for promoting readability throughout the entire project and for helping new developers to quickly understand the code.
Code lines including comments or comments appended to the code line should not exceed a length of 120 characters. Keeping wherever possible the line length below 80 characters is a good practice. It is recommended to set your editor markers/rulers accordingly.
Each indentation consists of 4 blanks, TAB character is not allowed and must be replaced with 2 blanks (ASCII code 32, see your editor's configuration options).