Merge pull request #10 from dr-dolomite/main
Added Minor Fixes and Dynamic Wait Time for AT Command Page
This commit is contained in:
@@ -8,7 +8,6 @@ Please PR to this branch instead of main :)
|
|||||||
Fork development, and PR development to development :)
|
Fork development, and PR development to development :)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### [JUMP TO HOW TO USE](#how-to-use)
|
#### [JUMP TO HOW TO USE](#how-to-use)
|
||||||
**Currently:** This will allow you to install or if already installed, update, remove, or modify:
|
**Currently:** This will allow you to install or if already installed, update, remove, or modify:
|
||||||
- Simple Admin: A simple web interface for managing your Quectel m.2 modem through it's gateway address
|
- Simple Admin: A simple web interface for managing your Quectel m.2 modem through it's gateway address
|
||||||
@@ -147,6 +146,8 @@ Thank You to:
|
|||||||
|
|
||||||
[dr-dolomite](https://github.com/dr-dolomite) for some major stat page improvements and this repos first approved external PR!
|
[dr-dolomite](https://github.com/dr-dolomite) for some major stat page improvements and this repos first approved external PR!
|
||||||
|
|
||||||
|
[tarunVreddy](https://github.com/tarunVreddy) for helping with the SA band aggregation parse
|
||||||
|
|
||||||
### Existing projects:
|
### Existing projects:
|
||||||
Simpleadmin heavily uses the AT Command Parsing Scripts (Basically a copy with new changes and tweaks) of Dairyman's Rooter Source https://github.com/ofmodemsandmen/ROOterSource2203
|
Simpleadmin heavily uses the AT Command Parsing Scripts (Basically a copy with new changes and tweaks) of Dairyman's Rooter Source https://github.com/ofmodemsandmen/ROOterSource2203
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,16 @@ while true; do
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# Run AT+CGCONTRDP once then proceed to while loop
|
# Run AT+CGCONTRDP once then proceed to while loop
|
||||||
echo -en "AT+CGCONTRDP\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/apn.txt
|
echo -en "AT+CGCONTRDP=1\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/apn.txt
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# Run AT+QUIMSLOT? to get the current sim slot
|
# Run AT+QUIMSLOT? to get the current sim slot
|
||||||
echo -en "AT+QUIMSLOT?\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/simslot.txt
|
echo -en "AT+QUIMSLOT?\r\n" | microcom -t 1000 /dev/ttyOUT > /tmp/simslot.txt
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# Send request to modem and wait 5 seconds for data
|
# Send request to modem and wait 3 seconds for data
|
||||||
echo -en "AT+QSPN;+CEREG=2;+CEREG?;+CEREG=0;+C5GREG=2;+C5GREG?;+C5GREG=0;+CSQ;+QENG=\"servingcell\";+QRSRP;+QCAINFO;+QNWPREFCFG=\"mode_pref\";+QTEMP\r\n" \
|
echo -en "AT+QSPN;+CEREG=2;+CEREG?;+CEREG=0;+C5GREG=2;+C5GREG?;+C5GREG=0;+CSQ;+QENG=\"servingcell\";+QRSRP;+QCAINFO;+QNWPREFCFG=\"mode_pref\";+QTEMP\r\n" \
|
||||||
| microcom -t 5000 /dev/ttyOUT > /tmp/modemstatus.txt
|
| microcom -t 3000 /dev/ttyOUT > /tmp/modemstatus.txt
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
# Parse
|
# Parse
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ nr_bw() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to get the secondary LTE bands
|
# Function to get the secondary LTE & NR5G bands
|
||||||
get_secondary_bands() {
|
get_secondary_bands() {
|
||||||
# Extract LTE BANDs from SCC lines
|
# Extract LTE BANDs from SCC lines
|
||||||
SCC_BANDS=$(echo "$OX" | grep '+QCAINFO: "SCC"' | grep -o '"LTE BAND [0-9]\+"' | tr -d '"' | sed '1d')
|
SCC_BANDS=$(echo "$OX" | grep '+QCAINFO: "SCC"' | grep -o '"LTE BAND [0-9]\+"' | tr -d '"' | sed '1d')
|
||||||
@@ -52,9 +52,6 @@ get_secondary_bands() {
|
|||||||
# Set SC_BANDS to the non-empty variable or empty if both are empty
|
# Set SC_BANDS to the non-empty variable or empty if both are empty
|
||||||
SC_BANDS="${SCC_BANDS}${NR_BAND}"
|
SC_BANDS="${SCC_BANDS}${NR_BAND}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the PCI value. For example: 264 based on this +QCAINFO: "PCC",1775,75,"LTE BAND 3",1,264,-103,-13,-71,0
|
|
||||||
MAIN_PCI=$(echo "$OX" | grep '+QCAINFO: "PCC"' | grep -o ',[0-9]\{1,5\},' | tr -d ',')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get the modem model from /tmp/modemmodel.txt and parse it
|
# Get the modem model from /tmp/modemmodel.txt and parse it
|
||||||
@@ -516,4 +513,4 @@ MODEZ=$(echo $MODE | tr -d '"')
|
|||||||
} > /tmp/signal.txt
|
} > /tmp/signal.txt
|
||||||
|
|
||||||
# Pregenerate JSON File
|
# Pregenerate JSON File
|
||||||
/usrdata/simpleadmin/scripts/tojson.sh /tmp/signal.txt > /tmp/modemstatus.json
|
/usrdata/simpleadmin/scripts/tojson.sh /tmp/signal.txt > /tmp/modemstatus.json
|
||||||
@@ -19,6 +19,13 @@ while IFS='=' read -r key value || [[ -n "$key" ]]; do
|
|||||||
key=$(echo "$key" | awk '{$1=$1};1')
|
key=$(echo "$key" | awk '{$1=$1};1')
|
||||||
value=$(echo "$value" | awk '{$1=$1};1')
|
value=$(echo "$value" | awk '{$1=$1};1')
|
||||||
|
|
||||||
|
# Check if value includes double quotes inside it like: "value,"value"". If there is, remove the inner double quotes.
|
||||||
|
if [[ "$value" == *\"* ]]; then
|
||||||
|
value=$(echo "$value" | sed 's/\"//g')
|
||||||
|
# enclose the value in double quotes again
|
||||||
|
value="\"$value\""
|
||||||
|
fi
|
||||||
|
|
||||||
# Print key-value pair in JSON format without surrounding double quotes on value
|
# Print key-value pair in JSON format without surrounding double quotes on value
|
||||||
printf ' "%s" : %s' "$key" "$value"
|
printf ' "%s" : %s' "$key" "$value"
|
||||||
|
|
||||||
|
|||||||
@@ -1,179 +1,303 @@
|
|||||||
|
<!-- !Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc. -->
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
<head>
|
||||||
<head>
|
<meta charset="utf-8" />
|
||||||
<meta charset="utf-8">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<title>RM5xxx AT Commands</title>
|
<title>RM5xxx AT Commands</title>
|
||||||
|
|
||||||
<script src="/js/alpinejs.min.js" defer></script>
|
<script src="/js/alpinejs.min.js" defer></script>
|
||||||
<link rel="stylesheet" href="/css/bulma.css">
|
<link rel="stylesheet" href="/css/bulma.css" />
|
||||||
<link rel="stylesheet" type="text/css" href="/css/admin.css">
|
<link rel="stylesheet" type="text/css" href="/css/admin.css" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
|
<body>
|
||||||
<!-- START NAV -->
|
<!-- START NAV -->
|
||||||
<nav class="navbar is-black" x-data="{ isOpen: false }">
|
<nav class="navbar is-black" x-data="{ isOpen: false }">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="navbar-brand">
|
<div class="navbar-brand">
|
||||||
<a class="navbar-item brand-text" href="/">
|
<a class="navbar-item brand-text" href="/"> Simple Admin </a>
|
||||||
Quectel Simple Admin
|
<a
|
||||||
</a>
|
role="button"
|
||||||
<a role="button" class="navbar-burger burger" @click="isOpen = !isOpen">
|
class="navbar-burger burger"
|
||||||
<span aria-hidden="true"></span>
|
@click="isOpen = !isOpen"
|
||||||
<span aria-hidden="true"></span>
|
>
|
||||||
<span aria-hidden="true"></span>
|
<span aria-hidden="true"></span>
|
||||||
</a>
|
<span aria-hidden="true"></span>
|
||||||
</div>
|
<span aria-hidden="true"></span>
|
||||||
<div id="navMenu" class="navbar-menu" :class="isOpen ? 'is-active' : ''">
|
</a>
|
||||||
<div class="navbar-start">
|
|
||||||
<a class="navbar-item" href="/">
|
|
||||||
Connection Info
|
|
||||||
</a>
|
|
||||||
<a class="navbar-item" href="/atcommander.html">
|
|
||||||
AT Commands
|
|
||||||
</a>
|
|
||||||
<a class="navbar-item" href="/ttl.html">
|
|
||||||
TTL Changer
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
id="navMenu"
|
||||||
|
class="navbar-menu"
|
||||||
|
:class="isOpen ? 'is-active' : ''"
|
||||||
|
>
|
||||||
|
<div class="navbar-start">
|
||||||
|
<a class="navbar-item" href="/"> Connection Info </a>
|
||||||
|
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
||||||
|
<a class="navbar-item" href="/sms.html"> SMS </a>
|
||||||
|
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
<!-- END NAV -->
|
<!-- END NAV -->
|
||||||
<div class="container" x-data="atCommands()">
|
<div class="container" x-data="atCommands()">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-12">
|
<div class="column is-12">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-4">
|
<div class="column is-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<header class="card-header">
|
<header class="card-header">
|
||||||
<p class="card-header-title">
|
<p class="card-header-title">AT Command</p>
|
||||||
AT Command
|
</header>
|
||||||
</p>
|
<div class="card-content">
|
||||||
</header>
|
<div class="content">
|
||||||
<div class="card-content">
|
<div class="field">
|
||||||
<div class="content">
|
<label class="label">AT Command</label>
|
||||||
<div class="field">
|
<div class="control">
|
||||||
<label class="label">AT Command</label>
|
<input
|
||||||
<div class="control">
|
class="input"
|
||||||
<input class="input" type="text" placeholder="ATI" x-model="atcmd">
|
type="text"
|
||||||
</div>
|
placeholder="ATI"
|
||||||
</div>
|
x-model="atcmd"
|
||||||
<div class="field">
|
/>
|
||||||
<p class="control">
|
</div>
|
||||||
<button class="button is-success" @click="sendAtCommand()">
|
|
||||||
Send AT Command
|
|
||||||
</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="column is-8">
|
<div class="field">
|
||||||
<div class="card">
|
<p class="control">
|
||||||
<header class="card-header">
|
<button
|
||||||
<p class="card-header-title">
|
class="button is-success"
|
||||||
ATI Response
|
@click="sendAtCommand()"
|
||||||
</p>
|
:disabled="isLoading"
|
||||||
</header>
|
>
|
||||||
<div class="card-content">
|
Send AT Command
|
||||||
<div class="content">
|
</button>
|
||||||
<textarea class="textarea" placeholder="ATI Responses Will Appear Here" rows="10"
|
|
||||||
x-text="atCommandResponse"></textarea>
|
<button
|
||||||
</div>
|
class="button is-danger"
|
||||||
</div>
|
@click="clearResponses()"
|
||||||
</div>
|
:disabled="atCommandResponse === ''"
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="column is-8">
|
||||||
|
<div class="card">
|
||||||
|
<header class="card-header">
|
||||||
|
<p class="card-header-title">ATI Response</p>
|
||||||
|
</header>
|
||||||
|
<div class="card-content">
|
||||||
|
<div class="content">
|
||||||
|
<textarea
|
||||||
|
class="textarea"
|
||||||
|
placeholder="Please send only 1 AT command at a time"
|
||||||
|
rows="10"
|
||||||
|
x-text="isLoading ? 'Fetching response, please wait...' : atCommandResponse"
|
||||||
|
></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- START Useful Commands Section -->
|
<!-- START Useful Commands Section -->
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
<div class="column is-12">
|
<div class="column is-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<header class="card-header">
|
<header class="card-header">
|
||||||
<p class="card-header-title">
|
<p class="card-header-title">Useful Commands</p>
|
||||||
Useful Commands
|
</header>
|
||||||
</p>
|
<div class="card-content">
|
||||||
</header>
|
<div class="content">
|
||||||
<div class="card-content">
|
<!-- <div class="field" style="margin-bottom: 1rem">
|
||||||
<div class="content">
|
<p class="control">
|
||||||
<!-- Add your useful commands content here -->
|
<button
|
||||||
<p>Here are some useful commands:</p>
|
class="button is-danger"
|
||||||
<ul>
|
click="sendRebootCommand()"
|
||||||
<li>See https://github.com/iamromulan/RM520N-GL#at-commands for more </li>
|
:disabled="isRebootClicked"
|
||||||
<li>AT+CFUN=1,1 (reboot)</li>
|
|
||||||
<li>AT+QMAPWAC? (get current status of auto connect, 0=disabled 1=enabled)</li>
|
>
|
||||||
<li>AT+QMAPWAC=1 (enable auto connect internet for ethernet)</li>
|
Reboot
|
||||||
<li>AT+QMAPWAC=0 (disable auto connect for ethernet; use when you want internet over usb to work; IPPT must be disabled)</li>
|
</button>
|
||||||
<li>AT+QUIMSLOT? (get active sim slot; 1=Slot 1; 2=Slot 2)</li>
|
</p>
|
||||||
<li>AT+QUIMSLOT=1 (switch to sim slot 1)</li>
|
</div> -->
|
||||||
<li>AT+QUIMSLOT=2 (switch to sim slot 2)</li>
|
<!-- Add your useful commands content here -->
|
||||||
<li>AT+CGDCONT? (Get active APN profle list 1 through 8)</li>
|
<p>Here are some useful commands:</p>
|
||||||
<li>AT+CGDCONT=1,"IPV4V6","APNHERE" (Sets APN profle 1 to APNHERE using both IPV4 and IPV6)</li>
|
<ul>
|
||||||
<li>AT+GSN (Show current IMEI)</li>
|
<li>
|
||||||
<li>AT+EGMR=1,7,"IMEIGOESHERE" (sets/repairs IMEI)</li>
|
See https://github.com/iamromulan/RM520N-GL#at-commands for
|
||||||
<li>AT+QCAINFO (Show all connected bands/CA info)</li>
|
more
|
||||||
<li>AT+QNWPREFCFG="mode_pref" (Check what the current network search mode is set to)</li>
|
</li>
|
||||||
<li>AT+QNWPREFCFG="mode_pref",AUTO (Set network search mode to automatic)</li>
|
<li>AT+CFUN=1,1 (reboot)</li>
|
||||||
<li>AT+QNWPREFCFG="mode_pref",NR5G:LTE (Set network search mode to 5G/NR and 4G/LTE only)</li>
|
<li>
|
||||||
<li>AT+QNWPREFCFG="mode_pref",NR5G (Set network search mode to 5G/NR only)</li>
|
AT+QMAPWAC? (get current status of auto connect, 0=disabled
|
||||||
<li>AT+QNWPREFCFG="mode_pref",LTE (Set network search mode to 4G/LTE only)</li>
|
1=enabled)
|
||||||
<li>AT+QNWPREFCFG="nr5g_disable_mode" (Check to see if SA or NSA NR5G is disabled)</li>
|
</li>
|
||||||
<li>AT+QNWPREFCFG="nr5g_disable_mode",0 (Enable Both SA and NSA 5G/NR)</li>
|
<li>
|
||||||
<li>AT+QNWPREFCFG="nr5g_disable_mode",1 (Disable SA 5G/NR only)</li>
|
AT+QMAPWAC=1 (enable auto connect internet for ethernet)
|
||||||
<li>AT+QNWPREFCFG="nr5g_disable_mode",2 (Disable NSA 5G/NR only)</li>
|
</li>
|
||||||
<li>AT+QNWPREFCFG="nr5g_band" (Get current 5G/NR bandlock settings)</li>
|
<li>
|
||||||
<li>AT+QNWPREFCFG="nr5g_band",1:2:3:4:5:6 (Example: Lock to 5G/NR bands n1,n2,n3,n4,n5, and n6)</li>
|
AT+QMAPWAC=0 (disable auto connect for ethernet; use when
|
||||||
<li>AT+QNWPREFCFG="lte_band" (Get current 4G/LTE bandlock settings)</li>
|
you want internet over usb to work; IPPT must be disabled)
|
||||||
<li>AT+QNWPREFCFG="lte_band",1:2:3:4:5:6 (Example: Lock to 4G/LTE bands 1,2,3,4,5, and 6)</li>
|
</li>
|
||||||
<li>AT+QMAP="WWAN" (Show currently assigned IPv4 and IPv6 from the provider)</li>
|
<li>
|
||||||
<li>AT+QMAP="LANIP" (Show current DHCP range and Gateway address for VLAN0)</li>
|
AT+QUIMSLOT? (get active sim slot; 1=Slot 1; 2=Slot 2)
|
||||||
<li>AT+QMAP="LANIP",IP_start_range,IP_end_range,Gateway_IP (Set IPv4 Start/End range and Gateway IP of DHCP for VLAN0)</li>
|
</li>
|
||||||
<li>AT+QMAP="DHCPV4DNS","disable" (disable the onboard DNS proxy; recommended for IPPT)</li>
|
<li>AT+QUIMSLOT=1 (switch to sim slot 1)</li>
|
||||||
<li>AT+QMAP="MPDN_rule",0,1,0,1,1,"FF:FF:FF:FF:FF:FF" (Turn on IP Passthrough for Ethernet)</li>
|
<li>AT+QUIMSLOT=2 (switch to sim slot 2)</li>
|
||||||
<li>AT+QMAP="MPDN_rule",0 (turn off IPPT/clear MPDN rule 0; Remember to run AT+QMAPWAC=1 and reboot after)</li>
|
<li>AT+CGDCONT? (Get active APN profle list 1 through 8)</li>
|
||||||
</ul>
|
<li>
|
||||||
</div>
|
AT+CGDCONT=1,"IPV4V6","APNHERE" (Sets APN profle 1 to
|
||||||
</div>
|
APNHERE using both IPV4 and IPV6)
|
||||||
</div>
|
</li>
|
||||||
|
<li>AT+GSN (Show current IMEI)</li>
|
||||||
|
<li>AT+EGMR=1,7,"IMEIGOESHERE" (sets/repairs IMEI)</li>
|
||||||
|
<li>AT+QCAINFO (Show all connected bands/CA info)</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="mode_pref" (Check what the current network
|
||||||
|
search mode is set to)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="mode_pref",AUTO (Set network search mode to
|
||||||
|
automatic)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="mode_pref",NR5G:LTE (Set network search mode
|
||||||
|
to 5G/NR and 4G/LTE only)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="mode_pref",NR5G (Set network search mode to
|
||||||
|
5G/NR only)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="mode_pref",LTE (Set network search mode to
|
||||||
|
4G/LTE only)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="nr5g_disable_mode" (Check to see if SA or NSA
|
||||||
|
NR5G is disabled)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="nr5g_disable_mode",0 (Enable Both SA and NSA
|
||||||
|
5G/NR)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="nr5g_disable_mode",1 (Disable SA 5G/NR only)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="nr5g_disable_mode",2 (Disable NSA 5G/NR only)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="nr5g_band" (Get current 5G/NR bandlock
|
||||||
|
settings)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="nr5g_band",1:2:3:4:5:6 (Example: Lock to
|
||||||
|
5G/NR bands n1,n2,n3,n4,n5, and n6)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="lte_band" (Get current 4G/LTE bandlock
|
||||||
|
settings)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QNWPREFCFG="lte_band",1:2:3:4:5:6 (Example: Lock to
|
||||||
|
4G/LTE bands 1,2,3,4,5, and 6)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QMAP="WWAN" (Show currently assigned IPv4 and IPv6 from
|
||||||
|
the provider)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QMAP="LANIP" (Show current DHCP range and Gateway address
|
||||||
|
for VLAN0)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QMAP="LANIP",IP_start_range,IP_end_range,Gateway_IP (Set
|
||||||
|
IPv4 Start/End range and Gateway IP of DHCP for VLAN0)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QMAP="DHCPV4DNS","disable" (disable the onboard DNS
|
||||||
|
proxy; recommended for IPPT)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QMAP="MPDN_rule",0,1,0,1,1,"FF:FF:FF:FF:FF:FF" (Turn on
|
||||||
|
IP Passthrough for Ethernet)
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
AT+QMAP="MPDN_rule",0 (turn off IPPT/clear MPDN rule 0;
|
||||||
|
Remember to run AT+QMAPWAC=1 and reboot after)
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- END Useful Commands Section -->
|
<!-- END Useful Commands Section -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function atCommands() {
|
||||||
|
return {
|
||||||
|
isLoading: false,
|
||||||
|
atcmd: null,
|
||||||
|
atCommandResponse: "",
|
||||||
|
sendAtCommand() {
|
||||||
|
this.isLoading = true;
|
||||||
|
fetch(
|
||||||
|
"/cgi-bin/get_atcommand?" +
|
||||||
|
new URLSearchParams({
|
||||||
|
atcmd: this.atcmd,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
return res.text();
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
this.atCommandResponse = data;
|
||||||
|
this.isLoading = false;
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.isLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
clearResponses() {
|
||||||
|
this.atCommandResponse = "";
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function atCommands() {
|
function sendRebootCommand() {
|
||||||
return {
|
var isRebootClicked = true;
|
||||||
isLoading: false,
|
console.log("Reboot command triggered");
|
||||||
atcmd: null,
|
var atcmd = "AT+CFUN=1,1";
|
||||||
atCommandResponse: null,
|
fetch(
|
||||||
sendAtCommand() {
|
"/cgi-bin/get_atcommand?" +
|
||||||
fetch('/cgi-bin/get_atcommand?' + new URLSearchParams({
|
new URLSearchParams({
|
||||||
atcmd: this.atcmd,
|
atcmd: atcmd,
|
||||||
}))
|
})
|
||||||
.then((res) => {
|
)
|
||||||
return res.text();
|
.then((res) => {
|
||||||
})
|
return res.text();
|
||||||
.then((data) => {
|
})
|
||||||
this.atCommandResponse = data;
|
.then((data) => {
|
||||||
this.isLoading = false;
|
console.log(data); // Logging the response for debugging purposes
|
||||||
})
|
})
|
||||||
},
|
.catch((error) => {
|
||||||
}
|
console.error("Error:", error);
|
||||||
}
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -3,24 +3,30 @@ QUERY_STRING=$(echo "${QUERY_STRING}" | sed 's/;//g')
|
|||||||
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
|
||||||
|
|
||||||
if [ "${QUERY_STRING}" ]; then
|
if [ "${QUERY_STRING}" ]; then
|
||||||
|
export IFS="&"
|
||||||
export IFS="&"
|
for cmd in ${QUERY_STRING}; do
|
||||||
for cmd in ${QUERY_STRING}; do
|
if [ "$(echo $cmd | grep '=')" ]; then
|
||||||
|
key=$(echo $cmd | awk -F '=' '{print $1}')
|
||||||
if [ "$(echo $cmd | grep '=')" ]; then
|
value=$(echo $cmd | awk -F '=' '{print $2}')
|
||||||
key=$(echo $cmd | awk -F '=' '{print $1}')
|
eval $key=$value
|
||||||
value=$(echo $cmd | awk -F '=' '{print $2}')
|
fi
|
||||||
eval $key=$value
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MYATCMD=$(printf '%b\n' "${atcmd//%/\\x}")
|
MYATCMD=$(printf '%b\n' "${atcmd//%/\\x}")
|
||||||
if [ -n "${MYATCMD}" ]; then
|
if [ -n "${MYATCMD}" ]; then
|
||||||
x=$(urldecode "$atcmd")
|
x=$(urldecode "$atcmd")
|
||||||
runcmd=$(echo -en "$x\r\n" | microcom -t 2000 /dev/ttyOUT2)
|
# Initialize wait time to 2 seconds
|
||||||
|
wait_time=2
|
||||||
|
while true; do
|
||||||
|
runcmd=$(echo -en "$x\r\n" | microcom -t $wait_time /dev/ttyOUT2)
|
||||||
|
# Check if "OK" or "ERROR" is present in the response
|
||||||
|
if [[ $runcmd =~ "OK" ]] || [[ $runcmd =~ "ERROR" ]]; then
|
||||||
|
break # Exit the loop if "OK" or "ERROR" is found
|
||||||
|
fi
|
||||||
|
# If neither "OK" nor "ERROR" is found, increment wait time by 1 second
|
||||||
|
((wait_time++))
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Content-type: text/plain"
|
echo "Content-type: text/plain"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<nav class="navbar is-black" x-data="{ isOpen: false }">
|
<nav class="navbar is-black" x-data="{ isOpen: false }">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="navbar-brand">
|
<div class="navbar-brand">
|
||||||
<a class="navbar-item brand-text" href="/"> Quectel Simple Admin </a>
|
<a class="navbar-item brand-text" href="/"> Simple Admin </a>
|
||||||
<a
|
<a
|
||||||
role="button"
|
role="button"
|
||||||
class="navbar-burger burger"
|
class="navbar-burger burger"
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
<div class="navbar-start">
|
<div class="navbar-start">
|
||||||
<a class="navbar-item" href="/"> Connection Info </a>
|
<a class="navbar-item" href="/"> Connection Info </a>
|
||||||
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
||||||
|
<a class="navbar-item" href="/sms.html"> SMS </a>
|
||||||
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -50,7 +51,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- Fetches the correct Model Name -->
|
<!-- Fetches the correct Model Name -->
|
||||||
<h1 class="title">
|
<h1 class="title">
|
||||||
Quectel <span x-text="csqData.MODEM_MODEL"></span> Connection
|
<span x-text="csqData.MODEM_MODEL"></span> Connection
|
||||||
Info
|
Info
|
||||||
</h1>
|
</h1>
|
||||||
<h2 class="subtitle">
|
<h2 class="subtitle">
|
||||||
|
|||||||
158
simpleadmin/www/sms.html
Normal file
158
simpleadmin/www/sms.html
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<!-- change to a much simpler tab title -->
|
||||||
|
<title>Simple Admin</title>
|
||||||
|
|
||||||
|
<script src="/js/alpinejs.min.js" defer></script>
|
||||||
|
<link rel="stylesheet" href="/css/bulma.css" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="/css/admin.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- START NAV -->
|
||||||
|
<nav class="navbar is-black" x-data="{ isOpen: false }">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-brand">
|
||||||
|
<a class="navbar-item brand-text" href="/"> Simple Admin </a>
|
||||||
|
<a
|
||||||
|
role="button"
|
||||||
|
class="navbar-burger burger"
|
||||||
|
@click="isOpen = !isOpen"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
<span aria-hidden="true"></span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
id="navMenu"
|
||||||
|
class="navbar-menu"
|
||||||
|
:class="isOpen ? 'is-active' : ''"
|
||||||
|
>
|
||||||
|
<div class="navbar-start">
|
||||||
|
<a class="navbar-item" href="/"> Connection Info </a>
|
||||||
|
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
||||||
|
<a class="navbar-item" href="/sms.html"> SMS </a>
|
||||||
|
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<!-- END NAV -->
|
||||||
|
<div class="container" x-data="atCommands()">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column is-12">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column is-8">
|
||||||
|
<div class="card">
|
||||||
|
<header class="card-header">
|
||||||
|
<p class="card-header-title">SMS Viewer</p>
|
||||||
|
<div class="field">
|
||||||
|
<p class="control">
|
||||||
|
<button
|
||||||
|
class="button is-success"
|
||||||
|
@click="sendAtCommand()"
|
||||||
|
:disabled="isLoading"
|
||||||
|
>
|
||||||
|
Refresh
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<p class="control">
|
||||||
|
<button
|
||||||
|
class="button is-danger"
|
||||||
|
@click="sendAtCommand()"
|
||||||
|
:disabled="isLoading"
|
||||||
|
>
|
||||||
|
Delete
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<div class="card-content">
|
||||||
|
<div class="content">
|
||||||
|
<textarea
|
||||||
|
class="textarea"
|
||||||
|
placeholder="SMS Viewer (Make sure to run: AT+CMGF=1 first)"
|
||||||
|
readonly
|
||||||
|
rows="10"
|
||||||
|
cols="50"
|
||||||
|
x-model="atCommandResponse"
|
||||||
|
:disabled="isLoading"
|
||||||
|
></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function atCommands() {
|
||||||
|
return {
|
||||||
|
isLoading: false,
|
||||||
|
atcmd: 'AT+CMGL="ALL"',
|
||||||
|
atCommandResponse: null,
|
||||||
|
sendAtCommand() {
|
||||||
|
this.isLoading = true; // Set loading state to true before fetching data
|
||||||
|
fetch(
|
||||||
|
"/cgi-bin/get_atcommand?" +
|
||||||
|
new URLSearchParams({
|
||||||
|
atcmd: this.atcmd,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.then((res) => {
|
||||||
|
return res.text();
|
||||||
|
})
|
||||||
|
.then((data) => {
|
||||||
|
this.atCommandResponse = data;
|
||||||
|
// Split the response into individual messages
|
||||||
|
const messages = data.trim().split("\n\n");
|
||||||
|
|
||||||
|
// Parse each message and construct an array of objects
|
||||||
|
const parsedMessages = messages.map((message) => {
|
||||||
|
const lines = message.split("\n");
|
||||||
|
const sender = decodeHexString(
|
||||||
|
lines[1].split(",")[2].slice(1, -1)
|
||||||
|
);
|
||||||
|
const time = lines[2].split(',"')[1];
|
||||||
|
const messageText = decodeHexString(lines[3]);
|
||||||
|
return {
|
||||||
|
"Người gửi": sender,
|
||||||
|
"Thời gian": time,
|
||||||
|
"Tin nhắn": messageText,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// Log the parsed messages array as JSON to the console
|
||||||
|
console.log(JSON.stringify(parsedMessages, null, 2));
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Không thể tìm thấy dữ liệu:", error);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.isLoading = false; // Set loading state to false after fetching data
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// Hàm giải mã chuỗi hex sang văn bản
|
||||||
|
function decodeHexString(hexString) {
|
||||||
|
let decodedString = "";
|
||||||
|
for (let i = 0; i < hexString.length; i += 4) {
|
||||||
|
let hex = hexString.substr(i, 4);
|
||||||
|
let intValue = parseInt(hex, 16);
|
||||||
|
decodedString += String.fromCharCode(intValue);
|
||||||
|
}
|
||||||
|
return decodedString;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="navbar-brand">
|
<div class="navbar-brand">
|
||||||
<a class="navbar-item brand-text" href="/">
|
<a class="navbar-item brand-text" href="/">
|
||||||
Quectel Simple Admin
|
Simple Admin
|
||||||
</a>
|
</a>
|
||||||
<a role="button" class="navbar-burger burger" @click="isOpen = !isOpen">
|
<a role="button" class="navbar-burger burger" @click="isOpen = !isOpen">
|
||||||
<span aria-hidden="true"></span>
|
<span aria-hidden="true"></span>
|
||||||
@@ -29,15 +29,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="navMenu" class="navbar-menu" :class="isOpen ? 'is-active' : ''">
|
<div id="navMenu" class="navbar-menu" :class="isOpen ? 'is-active' : ''">
|
||||||
<div class="navbar-start">
|
<div class="navbar-start">
|
||||||
<a class="navbar-item" href="/">
|
<a class="navbar-item" href="/"> Connection Info </a>
|
||||||
Connection Info
|
<a class="navbar-item" href="/atcommander.html"> AT Commands </a>
|
||||||
</a>
|
<a class="navbar-item" href="/sms.html"> SMS </a>
|
||||||
<a class="navbar-item" href="/atcommander.html">
|
<a class="navbar-item" href="/ttl.html"> TTL Changer </a>
|
||||||
AT Commands
|
|
||||||
</a>
|
|
||||||
<a class="navbar-item" href="/ttl.html">
|
|
||||||
TTL Changer
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user