Skip to content

AT Scripting GUI Control Macros (mcenter specific)

Hamza Mehboob edited this page Jul 18, 2023 · 3 revisions

1. Introduction

This document provides details about all the macros that can be used to control GUI features from AT scripting. e.g. open/close the serial port, start/stop tracing, etc.

2. COM Port Macros

MC_PORT_CONNECT

bool MC_PORT_CONNECT();
This macro connects the AT com port.

RETURN VALUE
Return type: bool
true = successfully connected/already connected
false = failed

EXAMPLE
MC_PORT_CONNECT();

SUPPORTED BY
m-center v02.06.00 (and onward)


MC_PORT_DISCONNECT

bool MC_PORT_DISCONNECT(); This macro disconnects the AT com port.

RETURN VALUE
Return type: bool
true = successfully disconnected/already disconnected
false = failed

EXAMPLE
MC_PORT_DISCONNECT();

SUPPORTED BY
m-center v02.06.00 (and onward)


SET_PORT_NAME

bool SET_PORT_NAME(string in)
This macro sets the AT port name.

PARAMETERS
in: string e.g. COM1, COM2, COM3 ...

RETURN VALUE
Return type: bool
true = if the requested feature is successful.
false = if the requested feature failed.

EXAMPLE
SET_PORT_NAME("COM1");

SUPPORTED BY
m-center v02.06.00 (and onward)


bool SET_PORT_BAUD(int baud)

This macro sets the AT port baud rate.

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. int type 9600, 115200, 230400, 460800, 921600, 3M

Example:

SET_PORT_BAUD(115200);

bool SET_PORT_STOP_BITS(int bits)

This macro sets the AT port stop bits.

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. int type 1 or 2

Example:

SET_PORT_STOP_BITS(1);

bool SET_PORT_DATA_BITS(int bits)

This macro sets the AT port data bits E.g.,

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. int type 8 or 7 or 6 or 5

Example:

SET_PORT_DATA_BITS(8);

bool SET_PORT_FLOW_CONTROL(int flow_control)

This macro sets the AT port flow control.

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. int type Input values(0:none, 1:hardware, 2:xon-xoff)

Example:

SET_PORT_FLOW_CONTROL(1);

bool SET_PORT_PARITY(int parity)

This macro sets the AT port parity.

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. int type 0:none, 1:even, 2:odd

Example:

SET_PORT_PARITY(0);

3. Tracing Macros

MC_TRACE_START

bool MC_TRACE_START(string file_name, bool trace_at_cmd, int trace_protocol, int trace_mode=0);

This macro starts the trace for the selected parameter.

PARAMETERS
file_name: string path of the trace file
trace_at_cmd: bool turn trace AT commands ON/OFF
TRUE: ON
FALSE: OFF
trace_protocol: int
0 = NONE
1 = LEON-G1/SARA-G3
2 = LISA-U2/SARA-U2
3 = TOBY-L2/MPCI-L2
4 = TOBY-R2/LARA-R2
5 = TOBY-L4
6 = SARA-G4/SARA-N3
7 = LENA-R8
8 = SARA-R5/LEXI-R5
9 = LARA-R3
trace_mode: int default=0
0 = default trace port
1 = Trace socket

RETURN VALUE
Return type: bool
true = if the requested feature successful
false = if the requested feature is failed

EXAMPLE

//Start tracing using trace port
MC_TRACE_START("C:\\traces\\trace_file", true, 0);

//Start tracing using the trace socket
MC_TRACE_START("C:\\traces\\trace_file", true, 0, 1);

MC_TRACE_STOP

bool MC_TRACE_STOP();

This macro stops tracing.

RETURN VALUE
Return type: bool
true = if the requested feature successful
false = if the requested feature is failed

EXAMPLE
MC_TRACE_STOP();

SET_TPORT_NAME

bool SET_TPORT_NAME(string tpName);

This macro sets the trace port name.

PARAMETERS
tpName: string e.g. "COM0"

RETURN VALUE
Return type: bool
true = if the requested feature successful
false = if the requested feature is failed

EXAMPLE
SET_TPORT_NAME("COM1");

SET_TPORT_BAUD

bool SET_TPORT_BAUD(int baud)

This macro sets the AT port baud rate.

PARAMETERS
baud: int e.g. 9600, 115200, 230400, 460800, 921600, 3000000

RETURN VALUE
Return type: bool
true = if the requested feature successful
false = if the requested feature is failed

EXAMPLE
SET_TPORT_BAUD(115200);

bool SET_TPORT_STOP_BITS(int bits)

This macro sets the AT port stop bits.

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. int type 1 or 2

Example:

SET_TPORT_STOP_BITS(1);

bool SET_TPORT_DATA_BITS(int bits)

This macro sets the AT port data bits E.g.,

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. int type 8 or 7 or 6 or 5

Example:

SET_TPORT_DATA_BITS(8);

bool SET_TPORT_FLOW_CONTROL(int flow_control)

This macro sets the AT port flow control.

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. int type Input values(0:none, 1:hardware, 2:xon-xoff)

Example:

SET_TPORT_FLOW_CONTROL(1);

bool SET_TPORT_PARITY(int parity)

This macro sets the AT port parity.

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. int type 0:none, 1:even, 2:odd

Example:

SET_TPORT_PARITY(0);

bool SET_TRACE_SOCKET_PARAM(string &ip, int port)

This macro sets the socket IP and port.

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. string type com port name E.g., "192.168.10.11"
  2. int value of port E.g., 8080

Example:

SET_TRACE_SOCKET_PARAM("192.168.10.1",50000);

4. File System Macros

bool MC_FFS_STORE(string in)

This macro sends a file to the modem FFS.

Return value:

true... if file write is successful

false... if file write is failed

Input Parameters:

  1. string type file path "C:\test_dir\testfile.txt" or "C:/test_dir/testfile.txt"

Note: If the path is relative e.g. "file.txt" or "data\file.txt" the file should be present where the running script is present or inside the data folder in case of the later example. The data folder should be present where the running script is present.

A sample hierarchy is as below.

Atscript folder/ 
    ├── test.atl 
    └── data/ 
        └── file.txt

Example:

MC_FFS_STORE("C:\\test_dir\\testfile.txt");

MC_FFS_STORE("data\\testfile.txt");

bool MC_FFS_RETRIEVE(string in, string in)

This macro retrieves a file from the modem FFS.

Return value:

true... if file retrieve is successful

false... if file retrieve is failed

Input Parameters:

  1. string type file name "xyz.txt"
  2. string type file path "C:\test_dir\testfile.txt" or "C:/test_dir/test_file.txt"

Example:

MC_FFS_RETRIEVE("test_file.txt","C:\\test_dir\\test_file.txt");

bool MC_FFS_DELETE(string in)

This macro deletes a file from the modem FFS.

Return value:

true... if file delete is successful

false... if file delete is failed

Input Parameters:

  1. string type filename "xyz.txt"

Example:

MC_FFS_DELETE("test_file.txt");

bool MC_FFS_DELETE_ALL();

This macro deletes all files from the modem FFS.

Return value:

true... if file delete is successful

false... if file delete is failed

Example:

MC_FFS_DELETE_ALL();

5. AT Terminal Macros

bool MC_TERMINAL_LOG(bool in)

This macro turns AT terminal's logging ON/OFF.

Return value:

true... if the requested feature successful

false... if the requested feature is failed

Input Parameters:

  1. bool type: (true:ON, false:OFF)

Example:

MC_TERMINAL_LOG(true);

void MC_TERMINAL_LOGCLEAR()

This macro clears AT terminal's logging.

Example:

MC_TERMINAL_LOGCLEAR();

6. AT Scripting Macros

string GETSCRIPTPATH()

This macro returns the location of AT scripts in the system in string format.

Example:

ECHO(GETSCRIPTPATH());

Clone this wiki locally