5.4 AT API

The AT API is launched on the 2N® SmartCom Server and requires a licence. You have to enable its use in the 2N® SmartCom Control Panel. Refer to the figure below for the basic function.

Figure: 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. After connection, 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.

Basic Commands

Basic commands for the 2N® SmartCom AT API 

at
  • Enter the command to check the interface function. No action is executed and the OK reply is always sent.
ate 
  • Enter the command to disable echo (to display just replies, not commands).
ate0
  • Enter the command to disable echo.
ate1
  • Enter the command to enable echo.
ati
  • Enter the command to display the device model – 2N® SmartCom AT API.
ati3
  • Enter the command to display the current server version: x.x.x.x.x
ati4
  • Enter the command to display the serial number of the 2N® SmartCOM Server
at+cgmi
  • Enter the command to display the device manufacturer – 2N Telekomunikace a.s.
at+cgmm
  • Enter the command to display the device model – 2N® SmartCom AT API.
at+cgmr
  • Enter the command to display the current server version: x.x.x.x.x
at+gmi
  • Enter the command to display the device manufacturer – 2N Telekomunikace a.s.
at+gmm
  • Enter the command to display the device model – 2N® SmartCom AT API.
at+gmr
  • Enter the command to display the current server version: x.x.x.x.x
at+gsn
  • Enter the command to display the GSM module IMEI.
atz
  • Enter the command to log out the current user and terminate the TCP connection.

Server Settings

at^sccfg?
  • Enter the command to read out and display 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
  • Enter the command to set the server listening port to 1560.
at^sccfg="http_port",8080 
  • Enter the command to set the web server http port to 8080.
at^sccfg="http_enabled",1
  • Enter the command to enable/disable the use of the http interface: 0 – disabled, 1 – enabled.
at^sccfg="at_port",1562
  • Enter the command to set the AT API port to 1562. 
at^sccfg="server_restart"
  • Enter the command to restart 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> 
  • Enter the command to establish 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
+++
  • Enter the command to switch on the command mode for you to enter the basic AT commands for server information and the ATH command for connection termination.
ato
  • Enter the command to switch back to the data mode. 
ath
  • Enter the command to terminate 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> 
  • Enter the command to know the terminal state. The reply 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>?
  • Enter the command to know the state of the relay on the selected terminal.
at^screl<ser_no>#<relay>=<state>
  • Enter the command to set the relay contact position.
at^screl<ser_no>#<relay>=<state>,<state_after_term_restart>
  • Enter the command to set the relay contact position and define the contact behaviour after the terminal restart. 
at^scdin<ser_no>#<input>="get_value"
  • Enter the command to read the value from the digital input.
at^scadc<ser_no>#<input>="get_value" 
  • Enter the command to read the value from the analogue input.

Port Settings

at^scport<ser_no>#<port>?
  • Enter the command to know the current port configuration. The reply is as follows:
  • ^SCPORT1, "BAUDRATE",115200<br> 
  • ^SCPORT1, "DATA BITS",8<br> 
  • ^SCPORT1, "PARITY",0<br> 
  • ^SCPORT1, "STOP BITS",1<br> 
  • ^SCPORT1, "FLOWCONTROL",0
at^scport<ser_no>#[port]=<BAR>,<DB>,<P>,<SB>,<FC>
  • Enter the command to set 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 enter all the port parameters or omit them sequentially 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 No. 50–0295–0562, enter the following command into API: 
ATD5002950562#0.

Firmware Management

Enter the command to control and set terminal upgrades.

at^scupg<ser_no>? 
  • The current upgrade state reply is received. 
at^scupg<ser_no>="<version>"[<timestamp>] 
  • The FW version and timestamp are set for the terminal upgrade.

Note

  •  Enter time as UNIX TIME. Enter 1357055424 for 1.1.2013 15:50:24.
at^scupg<ser_no>="CANCEL"
  • Enter the command to cancel 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.
  • The user without the Admin rights is not allowed to add, edit or delete the objects.
at^scuser? 
  • Enter the command to return the list of all SC Server users.
at^scuser="add","<login>","<full_name>","<password>",<user_flags> ["<description>"] 
  •  Enter the command to add a user to the database. 
at^scuser="edit",<user_id>,"<login>","<full_name>","<password>",<user_flags>["<description>"]
  • Enter the command to edit a user with the selected User ID. Always enter all parameters.
at^scuser="remove",<user_id>
  • Enter the command to delete a user with the selected User ID.
at^scgroup? 
  • Enter the command to return the list of all SC Server groups.
at^scgroup="add","<name>"["<description>"] 
  • Enter the command to add a group to the database.
at^scgroup="edit",<group_id>,"<name>"["<description>"]
  • Enter the command to edit a group with the selected Group ID. Always enter all parameters. 
at^scgroup="remove",<group_id>
  • Enter the command to delete a group with the selected Group ID. 
at^scgroup="list_user",<group_id>
  • Enter the command to list users assigned to a group.
at^scgroup="list_terminal",<group_id>
  •  Enter the command to list terminals assigned to a group.
at^scgroup="list_right",<group_id>
  • Enter the command to list all group rights.
at^scgroup="add_user",<group_id>,<user_id>
  •  Enter the command to assign a user to the specified group.
at^scgroup="add_terminal",<group_id>,<terminal_id>
  •  Enter the command to assign a terminal to the specified group.
at^scgroup="remove_user",<group_id>,<user_id>
  • Enter the command to remove a user from the specified group.
at^scgroup="remove_terminal",<group_id>,<terminal_id>
  • Enter the command to remove a terminal from the specified group.
at^scgroup="set_right",<group_id>,READ,<0|1>
  • Enter the command to assign or remove READ right to/from the specified group.
at^scgroup="set_right",<group_id>,CONN,<0|1>
  • Enter the command to assign or remove CONNECT right to/from the specified group.
at^scgroup="set_right",<group_id>,CONF,<0|1>
  • Enter the command to assign or remove CONFIGURE right to/from the specified group. 
at^scgroup="set_right",<group_id>,MONI,<0|1>
  • Enter the command to assign or remove MONITOR right to/from the specified group.
at^scterminal? 
  • Enter the command to return the list of all SC Server terminals.
at^scterminal="add","<name>","<serial_number>","<password>" ,"<description>"]
  • Enter the command to add a terminal to the database.
at^scterminal="edit",<terminal_id>,"<name>","<serial_number>","<password>"["<description>"]
  • Enter the command to edit a terminal with the selected Terminal ID. Always enter all parameters. 
at^scterminal="remove",<terminal_id>
  • Enter the command to delete a terminal with the selected Terminal ID.  

URC

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

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

Note

  • To log in to the terminal URC, enter the following command into 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>"