Small C++ command-line tool for talking to an A7682E modem over its AT command control port.
The current goal is manual configuration and monitoring from a terminal. The code is split into a reusable serial/AT layer so it can later grow into a DBus-backed modem manager.
From doc/A76XX Series_Linux_USB_Application Note_V1.00.pdf:
/dev/ttyUSB0: diagnostic output/dev/ttyUSB1: AT command control port/dev/ttyUSB2: PPP modem/data port/dev/ttyUSB3: NMEA port when GNSS is enabled
This tool defaults to /dev/ttyUSB1.
makeThe binary is written to bin/simcom_cli.
High-level commands:
./bin/simcom_cli info
./bin/simcom_cli get signal
./bin/simcom_cli get operator
./bin/simcom_cli get network-mode
./bin/simcom_cli set cmee 2
./bin/simcom_cli set apn 1 internet
./bin/simcom_cli set operator auto
./bin/simcom_cli set network-mode lte
./bin/simcom_cli set reset
./bin/simcom_cli set usbnetmode 1Raw AT mode still works:
./bin/simcom_cli AT+CSQ
./bin/simcom_cli +CPIN?
./bin/simcom_cli raw AT+COPS?Interactive shell:
./bin/simcom_cli --interactiveInteractive shell notes:
- high-level commands such as
info,get signal, andset cmee 2work in the shell - raw AT commands such as
AT,ATI,AT+CSQ, andAT+CEREG?also work - commands starting with
+,$,&, or*are automatically prefixed withAT - local shell commands use a leading
: :helpshows interactive help:raw onor:raw offtoggles raw line printing:timeout 5000changes the per-command timeout:quitexits
Monitor unsolicited modem output:
./bin/simcom_cli --monitorThis mode just prints incoming modem lines with timestamps until Ctrl-C.
info runs a small status bundle:
- manufacturer
- model
- firmware
- IMEI
- SIM state
- signal quality
- operator
- EPS registration
- packet attach state
- PDP contexts
- modem functionality state
get <name> currently supports these aliases:
id,identitymanufacturer,model,firmwareimei,imsisim,pinsignal,csqoperator,copsreg,network,eps-reg,ceregps-reg,cgregcs-reg,cregattach,cgattpdp,contexts,apn,cgdcontactive-contexts,cgactclock,cclkerrors,cmeefunctionality,fun,cfunactivity,cpasnetwork-mode,netmode,cnmp
set <name> <value...> supports:
- generic AT setters such as
set cmee 2->AT+CMEE=2 set apn <cid> <apn> [pdp_type]set operator auto->AT+COPS=0set network-mode <auto|gsm|lte>->AT+CNMP=<...>set reset->AT+CFUN=1,1set usbnetmode <0|1>->AT$MYCONFIG="usbnetmode",<value>set dialmode <0|1>->AT+DIALMODE=<value>
For unusual commands or exact quoting requirements, use raw AT mode directly.
The CLI currently decodes these common status/configuration commands:
ATIAT+CGMIAT+CGMMAT+CGMRAT+CGSNAT+CIMIAT+CPIN?AT+CSQAT+CREG?AT+CGREG?AT+CEREG?AT+COPS?AT+CGATT?AT+CGACT?AT+CGDCONT?AT+CCLK?AT+CMEE?AT+CFUN?AT+CPASAT+CNMP?
Unknown commands still work; the CLI falls back to printing the modem's raw response lines.
- The tool currently handles classic line-oriented AT responses ending in
OK,ERROR,+CME ERROR,+CMS ERROR,CONNECT,NO CARRIER,NO ANSWER, orBUSY. - It is not yet a full URC-aware modem manager. That is the next logical step once the manual CLI workflow is stable.
- For clearer errors,
AT+CMEE=2is useful during manual sessions.