qmodem: use new at tool
This commit is contained in:
parent
fb355ce04e
commit
9057ede3b6
@ -599,7 +599,7 @@ class ModemSMS {
|
|||||||
var content = this.message_content.value;
|
var content = this.message_content.value;
|
||||||
var is_ascii = /^[\x00-\x7F]*$/.test(content);
|
var is_ascii = /^[\x00-\x7F]*$/.test(content);
|
||||||
if (is_ascii) {
|
if (is_ascii) {
|
||||||
this.send_gsm();
|
this.send_raw_pdu();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.send_raw_pdu();
|
this.send_raw_pdu();
|
||||||
@ -782,12 +782,15 @@ class ModemSMS {
|
|||||||
let at,bt
|
let at,bt
|
||||||
at = a.timestamp;
|
at = a.timestamp;
|
||||||
bt = b.timestamp;
|
bt = b.timestamp;
|
||||||
at = at.replace(/ /g,"");
|
if (typeof at == "string") {
|
||||||
bt = bt.replace(/ /g,"");
|
at = at.replace(/ /g,"");
|
||||||
at = at.replace(/\//g,"");
|
bt = bt.replace(/ /g,"");
|
||||||
bt = bt.replace(/\//g,"");
|
at = at.replace(/\//g,"");
|
||||||
at = at.replace(/:/g,"");
|
bt = bt.replace(/\//g,"");
|
||||||
bt = bt.replace(/:/g,"");
|
at = at.replace(/:/g,"");
|
||||||
|
bt = bt.replace(/:/g,"");
|
||||||
|
}
|
||||||
|
|
||||||
return bt - at;
|
return bt - at;
|
||||||
});
|
});
|
||||||
this.view = messages;
|
this.view = messages;
|
||||||
@ -831,7 +834,12 @@ class ModemSMS {
|
|||||||
for (let msg of msgs){
|
for (let msg of msgs){
|
||||||
let sender,timestamp,content,part,total,index;
|
let sender,timestamp,content,part,total,index;
|
||||||
sender = msg.sender;
|
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;
|
content = msg.content;
|
||||||
part = msg.part;
|
part = msg.part;
|
||||||
total = msg.total;
|
total = msg.total;
|
||||||
|
@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
PKG_NAME:=luci-app-qmodem
|
PKG_NAME:=luci-app-qmodem
|
||||||
LUCI_TITLE:=LuCI support for QWRT Modem
|
LUCI_TITLE:=LuCI support for QWRT Modem
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
PKG_VERSION:=2.3.2
|
PKG_VERSION:=2.4
|
||||||
PKG_LICENSE:=GPLv3
|
PKG_LICENSE:=GPLv3
|
||||||
PKG_LINCESE_FILES:=LICENSE
|
PKG_LINCESE_FILES:=LICENSE
|
||||||
PKG_MAINTAINER:=Tom <fjrcn@outlook.com>
|
PKG_MAINTAINER:=Tom <fjrcn@outlook.com>
|
||||||
@ -25,7 +25,7 @@ LUCI_DEPENDS:=+luci-compat \
|
|||||||
+kmod-pcie_mhi \
|
+kmod-pcie_mhi \
|
||||||
+pciutils \
|
+pciutils \
|
||||||
+quectel-CM-5G \
|
+quectel-CM-5G \
|
||||||
+sms-tool_q \
|
+tom_modem \
|
||||||
+jq +bc\
|
+jq +bc\
|
||||||
+coreutils +coreutils-stat
|
+coreutils +coreutils-stat
|
||||||
|
|
||||||
|
@ -52,7 +52,8 @@ get_sms(){
|
|||||||
[ -z "$file_time" ] && file_time=0
|
[ -z "$file_time" ] && file_time=0
|
||||||
if [ ! -f $cache_file ] || [ $(($current_time - $file_time)) -gt $cache_timeout ]; then
|
if [ ! -f $cache_file ] || [ $(($current_time - $file_time)) -gt $cache_timeout ]; then
|
||||||
touch $cache_file
|
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
|
cat $cache_file
|
||||||
else
|
else
|
||||||
cat $cache_file
|
cat $cache_file
|
||||||
@ -147,11 +148,12 @@ case $method in
|
|||||||
"send_raw_pdu")
|
"send_raw_pdu")
|
||||||
cmd=$3
|
cmd=$3
|
||||||
[ -n "$sms_at_port" ] && at_port=$sms_at_port
|
[ -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
|
json_select result
|
||||||
if [ "$?" == 0 ]; then
|
if [ "$?" == 0 ]; then
|
||||||
json_add_string status "1"
|
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"
|
json_add_string "res" "$res"
|
||||||
else
|
else
|
||||||
json_add_string status "0"
|
json_add_string status "0"
|
||||||
@ -162,11 +164,12 @@ case $method in
|
|||||||
index=$3
|
index=$3
|
||||||
[ -n "$sms_at_port" ] && at_port=$sms_at_port
|
[ -n "$sms_at_port" ] && at_port=$sms_at_port
|
||||||
for i in $index; do
|
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
|
touch /tmp/cache_sms_$2
|
||||||
if [ "$?" == 0 ]; then
|
if [ "$?" == 0 ]; then
|
||||||
json_add_string status "1"
|
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
|
else
|
||||||
json_add_string status "0"
|
json_add_string status "0"
|
||||||
fi
|
fi
|
||||||
|
@ -7,7 +7,8 @@ at()
|
|||||||
local new_str="${2/[$]/$}"
|
local new_str="${2/[$]/$}"
|
||||||
local atcmd="${new_str/\"/\"}"
|
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()
|
fastat()
|
||||||
@ -16,7 +17,8 @@ fastat()
|
|||||||
local new_str="${2/[$]/$}"
|
local new_str="${2/[$]/$}"
|
||||||
local atcmd="${new_str/\"/\"}"
|
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()
|
log2file()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user