qmodem: use new at tool

This commit is contained in:
fujr 2024-10-21 22:22:27 +08:00
parent fb355ce04e
commit 9057ede3b6
4 changed files with 30 additions and 17 deletions

View File

@ -599,7 +599,7 @@ class ModemSMS {
var content = this.message_content.value;
var is_ascii = /^[\x00-\x7F]*$/.test(content);
if (is_ascii) {
this.send_gsm();
this.send_raw_pdu();
}
else{
this.send_raw_pdu();
@ -782,12 +782,15 @@ class ModemSMS {
let at,bt
at = a.timestamp;
bt = b.timestamp;
at = at.replace(/ /g,"");
bt = bt.replace(/ /g,"");
at = at.replace(/\//g,"");
bt = bt.replace(/\//g,"");
at = at.replace(/:/g,"");
bt = bt.replace(/:/g,"");
if (typeof at == "string") {
at = at.replace(/ /g,"");
bt = bt.replace(/ /g,"");
at = at.replace(/\//g,"");
bt = bt.replace(/\//g,"");
at = at.replace(/:/g,"");
bt = bt.replace(/:/g,"");
}
return bt - at;
});
this.view = messages;
@ -831,7 +834,12 @@ class ModemSMS {
for (let msg of msgs){
let sender,timestamp,content,part,total,index;
sender = msg.sender;
timestamp = msg.timestamp;
if (typeof(msg.timestamp) == "number") {
timestamp = new Date(msg.timestamp*1000).toLocaleString();
}
else{
timestamp = msg.timestamp;
}
content = msg.content;
part = msg.part;
total = msg.total;

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qmodem
LUCI_TITLE:=LuCI support for QWRT Modem
LUCI_PKGARCH:=all
PKG_VERSION:=2.3.2
PKG_VERSION:=2.4
PKG_LICENSE:=GPLv3
PKG_LINCESE_FILES:=LICENSE
PKG_MAINTAINER:=Tom <fjrcn@outlook.com>
@ -25,7 +25,7 @@ LUCI_DEPENDS:=+luci-compat \
+kmod-pcie_mhi \
+pciutils \
+quectel-CM-5G \
+sms-tool_q \
+tom_modem \
+jq +bc\
+coreutils +coreutils-stat

View File

@ -52,7 +52,8 @@ get_sms(){
[ -z "$file_time" ] && file_time=0
if [ ! -f $cache_file ] || [ $(($current_time - $file_time)) -gt $cache_timeout ]; then
touch $cache_file
sms_tool_q -d $at_port -j recv > $cache_file
#sms_tool_q -d $at_port -j recv > $cache_file
tom_modem -d $at_port -o r > $cache_file
cat $cache_file
else
cat $cache_file
@ -147,11 +148,12 @@ case $method in
"send_raw_pdu")
cmd=$3
[ -n "$sms_at_port" ] && at_port=$sms_at_port
res=$(sms_tool_q -d $at_port send_raw_pdu "$cmd" )
#res=$(sms_tool_q -d $at_port send_raw_pdu "$cmd" )
res=$(tom_modem -d $at_port -o s -p "$cmd")
json_select result
if [ "$?" == 0 ]; then
json_add_string status "1"
json_add_string cmd "sms_tool_q -d $at_port send_raw_pdu \"$cmd\""
json_add_string cmd "tom_modem -d $at_port -o s -p \"$cmd\""
json_add_string "res" "$res"
else
json_add_string status "0"
@ -162,11 +164,12 @@ case $method in
index=$3
[ -n "$sms_at_port" ] && at_port=$sms_at_port
for i in $index; do
sms_tool_q -d $at_port delete $i > /dev/null
# sms_tool_q -d $at_port delete $i > /dev/null
tom_modem -d $at_port -o d -i $i
touch /tmp/cache_sms_$2
if [ "$?" == 0 ]; then
json_add_string status "1"
json_add_string "index$i" "sms_tool_q -d $at_port delete $i"
json_add_string "index$i" "tom_modem -d $at_port -o d -i $i"
else
json_add_string status "0"
fi

View File

@ -7,7 +7,8 @@ at()
local new_str="${2/[$]/$}"
local atcmd="${new_str/\"/\"}"
#过滤空行
sms_tool_q -d $at_port at "$atcmd"
#sms_tool_q -d $at_port at "$atcmd"
tom_modem -d $at_port -o a -c "$atcmd"
}
fastat()
@ -16,7 +17,8 @@ fastat()
local new_str="${2/[$]/$}"
local atcmd="${new_str/\"/\"}"
#过滤空行
sms_tool_q -t 1 -d $at_port at "$atcmd"
# sms_tool_q -t 1 -d $at_port at "$atcmd"
tom_modem -d $at_port -o a -c "$atcmd" -t 1
}
log2file()