5.4 AT API

AT API Description

The AT API is launched on the 2N® SmartCom Server and requires a licence. Enable it in the Server Settings menu in the 2N® SmartCom Control Panel to use it. Refer to the figure below for the AT API basic function diagram.

AT API

AT API Use

Having logged in, get connected via Telnet to the 2N® SmartCom Server address on the port selected for the AT API. Once connected, you will be asked to enter the user name and password. You can use any login available on the server. The login dialogue looks as follows:

2N® SmartCom AT API

Login:
Admin
Password:
2n
OK

Now you are in the AT API environment in the standby mode and can enter the supported commands. Enter the ATZ command or close the terminal application to log out. All the AT commands to be used in the AT API command channel are described below including precise formats and function details.

Basic Commands

Basic commands for the 2N® SmartCom AT API

at
  • The command checks the interface function. No action is executed and the OK response is always sent.
ate
  • The command disables echo (to display just responses, not commands).
ate0
  • The command disables echo.
ate1
  • The command enables echo.
ati
  • The command displays the device model – 2N® SmartCom AT API.
ati3
  • The command displays the current server version: x.x.x.x.x
ati4
  • The command displays the serial number of the selected 2N® SmartCom Server.
at+cgmi
  • The command displays the device manufacturer – 2N Telekomunikace a.s. 
at+cgmm
  • The command display the device model – – 2N® SmartCom AT API.
at+cgmr
  • The command displays the current server version: x.x.x.x.x
at+gmi
  • The command displays the device manufacturer – 2N Telekomunikace a.s.
at+gmm
  • The command display the device model – 2N® SmartCom AT API
at+gmr
  • The command displays the current server version: x.x.x.x.x
at+gsn
  • The command displays the GSM module IMEI.
atz
  • The command logs out the current user and terminates the TCP connection. 

Server Settings

at^sccfg?
  • The command reads out and displays the current server settings.
  • ^SCCFG: "LISTEN PORT",50505 
  • ^SCCFG: "HTTP PORT",93
  • ^SCCFG: "HTTP ENABLED",1 
  • ^SCCFG: "AT API PORT",1562
  • ^SCCFG: "AT API ENABLED",1
  • ^SCCFG: "LOG LEVEL",3
  • ^SCCFG: "MAX USER TCP CONNECTIONS",100
  • ^SCCFG: "MAX TERMINAL TCP CONNECTIONS",100
  • ^SCCFG: "KEEPALIVE TIMEOUT",60
  • ^SCCFG: "KEEPALIVE SENDING PERIOD",180
  • ^SCCFG: "TERMINAL FW URL","http://$(SERVER_IP):93/firmware/1.4.0.4.2.bin"
at^sccfg="listen_port",1560
  • The command sets the server listening port to 1560.
at^sccfg="http_port",8080
  • The command set the web server http port to 8080.
at^sccfg="http_enabled",1
  • The command enables/disables the use of the http interface: 0 – disabled, 1 – enabled.
at^sccfg="at_port",1562
  • The command sets the AT API port to 1562. 
at^sccfg="server_restart"
  • The command restarts the 2N® SmartCom Server.

Caution

  • All the above parameters are saved into the server database but will not become effective until the new database is loaded into the server memory after restart.

Terminal Connection

atd<ser_no>#<port>
  • The command establishes connection to the selected terminal and selected port.

Note

  • Suppose you want to establish connection to terminal 50–0295–0562 and its RS 232 port. Enter the following command into the API: ATD5002950562#1
+++
  • The command switches the connection into the command mode for you to enter the basic AT commands for server information and the ATH command for connection termination.
ato
  • The command switches the connection back to the data mode. 
ath
  • The command terminates connection with the currently connected terminal without leaving the API environment. You can go on entering commands and establish new connections.

Terminal Communication

at^scstate<ser_no>
  • The command identifies the state of the terminal with the given serial number. The response is as follows.
Terminal state:<br>
imei: 355915030753263<br>
operator name: T-Mobile CZ (23001)<br>
signal: 21<br>
iccid: 8942001105088009270<br>
imsi: 230015001013627<br>
terminal serial number: 50-0369-0075<br>
terminal firmware: 1.4.0.4.0<br>
module firmware: L23_00gg.WISMO228 140711<br>
module manufacturer: WAVECOM MODEM<br>
module type: WISMO228
at^screl<ser_no>#<relay>?
  • The command identifies the state of the relay on the selected terminal.
at^screl<ser_no>#<relay>=<state>
  • The command sets the relay contact position.
at^screl<ser_no>#<relay>=<state>,<state_after_term_restart>
  • The command sets the relay contact position and defines the contact behaviour after the terminal restart.
at^scdin<ser_no>#<input>="get_value"
  • The command reads the value from the digital input.
at^scadc<ser_no>#<input>="get_value"
  • The command reads the value from the analogue input. 

Port Settings

at^scport<ser_no>#<port>?
  • The command identifies the current port configuration. The response is as follows.
  • ^SCPORT1, "BAUDRATE",115200
  • ^SCPORT1, "DATA BITS",8
  • ^SCPORT1, "PARITY",0
  • ^SCPORT1, "STOP BITS",1
  • ^SCPORT1, "FLOWCONTROL",0 
at^scport<ser_no>#<port>=<BAR>,<DB>,<P>,<SB>,<FC>
  • The command sets the selected port configuration. Enter the parameters in a sequence. The setting options are as follows.
BAR - "BAUDRATE",110-230400<br>
DB - "DATA_BITS",5-8<br>
P - "PARITY",0-4<br>
SB - "STOP_BITS",1-2<br>
FC - "FLOWCONTROL",0-1

Caution

  • You can either enter all the port parameters or omit them sequentially starting from the last one. This means that to change the communication baud rate only, enter the following:
at^scport5002961583#1=57600
  • To set all the port parameters at once, send the following command:
at^scport5002961583#1=57600,5,0,1,0

Access to Terminal Configuration Port

Configure the terminal via AT API in the same manner as if you configured the terminal via the RS232 port or TCP port 10000 in the Standalone mode. The configuration port is accessible under number zero. Enter the ATD command as if you accessed the terminal physical ports. Upon connection, you can set even the functions that are inaccessible via the Control Panel or AT API commands such as the user-defined functions (UDF) described below.

Note

  • Therefore, to configure terminal serial No. 50–0295–0562, enter the following command into API.
ATD5002950562#0.

Firmware Management

The command controls and sets terminal upgrades.

at^scupg<ser_no>?
  • The command returns the current upgrade state value.
at^scupg<ser_no>="<version>"[<timestamp>]
  • The command sets the FW version and timestamp for the terminal upgrade.

Note

  • Time is set in the UNIX TIME format. Enter 1357055424 for 1.1.2013 15:50:24.
at^scupg<ser_no>="CANCEL"
  • The command cancels the terminal upgrade.

User, Group and Terminal Management

These commands help you set, edit and delete users, groups and terminals. Log in as a user with administrator rights for this purpose.

Note

  • If the logged-in user has no Admin rights, the users, group and terminals that are accessible to such user will only be displayed.
  • A user without the Admin rights is not allowed to add, edit or delete the objects.
at^scuser?
  • The command returns the list of all SC Server users.
at^scuser="add","<login>","<full_name>","<password>",<user_flags> ["<description>"]
  • The command adds a user to the database.
at^scuser="edit",<user_id>,"<login>","<full_name>","<password>",<user_flags>["<description>"]
  • The command helps edit a user with the selected User ID. Always enter all the parameters.
at^scuser="remove",<user_id>
  • The command deletes a user with the selected User ID.
at^scgroup?
  • The command returns the list of all SC Server groups.
at^scgroup="add","<name>"["<description>"]
  • The command adds a group to the database.
at^scgroup="edit",<group_id>,"<name>"["<description>"]
  • The command helps edit a group with the selected Group ID. Always enter all the parameters.
at^scgroup="remove",<group_id>
  • The command deletes a group with the selected Group ID.
at^scgroup="list_user",<group_id>
  • The command writes out the users assigned to a group.
at^scgroup="list_terminal",<group_id>
  • The command writes out the terminals assigned to a group.
at^scgroup="list_right",<group_id>
  • The command writes out all the group rights.
at^scgroup="add_user",<group_id>,<user_id>
  • The command adds a user to the selected group.
at^scgroup="add_terminal",<group_id>,<terminal_id>
  • The command adds a terminal to the selected group. 
at^scgroup="remove_user",<group_id>,<user_id>
  • The command removes a user from the selected group.
at^scgroup="remove_terminal",<group_id>,<terminal_id>
  • The command removes a terminal from the selected group.
at^scgroup="set_right",<group_id>,READ,<0|1>
  • The command adds/removes the READ right to/from the selected group.
at^scgroup="set_right",<group_id>,CONN,<0|1>
  • The command adds/removes the CONNECT right to/from the selected group.
at^scgroup="set_right",<group_id>,CONF,<0|1>
  • The command adds/removes the CONFIGURE right to/from the selected group.
at^scgroup="set_right",<group_id>,MONI,<0|1>
  • The command adds/removes the MONITOR right to/from the selected group.
at^scterminal?
  • The command returns the list of all SC Server terminals.
at^scterminal="add","<name>","<serial_number>","<password>" ,"<description>"]
  • The command adds a terminal to the database.
at^scterminal="edit",<terminal_id>,"<name>","<serial_number>","<password>"["<description>"]
  • The command helps edit the terminal with the selected Terminal ID. Always enter all the parameters.
at^scterminal="remove",<terminal_id>
  • The command deletes the terminal with the selected Terminal ID.

URC

 URC (Unsolicited Result Codes) notifies state changes of the objects to be monitored: users, terminals and connections.

at^scind?
  • The command writes out to which URC the user is logged in.
at^scind="<type>",<value>
  • The command helps log in/out a user to/from URC.
    • <type> URC type selection (user / terminal / connection / all)
    • <value> 0 = disabled / 1 = enabled

Note

  • To log in to the terminal URC, enter the following command into the AT API: at^scind="terminal",1

 URC format

  • User connection state change (like in response to at^scuser?): ^SCUSER: <user_id>, "<login>", "<full_name>", "<user_flags>", "<connection_state>", "<description>"
  • Terminal connection state change (like in response to at^scterminal?): ^SCTERMINAL: <terminal_id>, "<name>", "<serial_number>", "<connection_state>", "<description>"
  • Connection state change at terminal port: ^SCLINK: <link_id>, "<terminal_name>", "<serial_number>", "<port_name>", "<user_name>", "<connection_state>"