fixed APN not showing, moved to generic branding, and added sms for testing
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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