update:
修改锁小区、频点接口 新增移远锁小区、锁频支持 修复部分页面原作者 xhr清除用户正在编辑配置的bug
This commit is contained in:
parent
08bcb35e69
commit
909730265e
@ -655,38 +655,21 @@ end
|
|||||||
function setLockCell()
|
function setLockCell()
|
||||||
local at_port = http.formvalue("port")
|
local at_port = http.formvalue("port")
|
||||||
local manufacturer = getManufacturer(at_port)
|
local manufacturer = getManufacturer(at_port)
|
||||||
local pci = http.formvalue("pci")
|
local func = http.formvalue("func")
|
||||||
local arfcn = http.formvalue("arfcn")
|
local pci = http.formvalue("pci") == nil and 0 or http.formvalue("pci")
|
||||||
local scs = http.formvalue("scs") --0:15KHz 1:30KHz 2:60KHz
|
local arfcn = http.formvalue("arfcn") == nil and 0 or http.formvalue("arfcn")
|
||||||
local nrband = http.formvalue("nrband")
|
local scs = http.formvalue("scs") == nil and 0 or http.formvalue("scs")
|
||||||
local celltype = http.formvalue("celltype") --0:LTE 1:NR
|
local nrband = http.formvalue("nrband") == nil and 0 or http.formvalue("nrband")
|
||||||
local lock = http.formvalue("lock") --0:unlock 1:lock_pci 2:lock_arfcn 3:lock_self
|
local celltype = http.formvalue("celltype") == nil and 0 or http.formvalue("celltype")
|
||||||
response={}
|
response={}
|
||||||
if (lock == "0") then
|
|
||||||
local command="source "..script_path..manufacturer..".sh && "..manufacturer.."_unlockcell "..at_port
|
local command="source "..script_path..manufacturer..".sh && "..manufacturer.."_setlockcell "..at_port.." "..func .." "..celltype.." "..arfcn.." "..pci.." "..scs.." "..nrband
|
||||||
local result=shell(command)
|
local command=string.format("source %s%s.sh && %s_setlockcell \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"",script_path,manufacturer,manufacturer,at_port,func,celltype,arfcn,pci,scs,nrband)
|
||||||
response["response"]=result
|
|
||||||
response["time"]=os.date("%Y-%m-%d %H:%M:%S")
|
|
||||||
response["lock"]=0
|
|
||||||
elseif (lock == "1") then
|
|
||||||
local command="source "..script_path..manufacturer..".sh && "..manufacturer.."_lockpci "..at_port.." "..celltype.." "..arfcn.." "..pci.." "..scs.." "..nrband
|
|
||||||
local result=shell(command)
|
local result=shell(command)
|
||||||
response["response"]=result
|
response["response"]=result
|
||||||
response["time"]=os.date("%Y-%m-%d %H:%M:%S")
|
response["time"]=os.date("%Y-%m-%d %H:%M:%S")
|
||||||
response["lock"]="pci"
|
response["lock"]="pci"
|
||||||
elseif (lock == "2") then
|
|
||||||
local command="source "..script_path..manufacturer..".sh && "..manufacturer.."_lockarfcn "..at_port.." "..celltype.." "..arfcn
|
|
||||||
local result=shell(command)
|
|
||||||
response["response"]=result
|
|
||||||
response["time"]=os.date("%Y-%m-%d %H:%M:%S")
|
|
||||||
response["lock"]="arfcn"
|
|
||||||
elseif (lock == "3") then
|
|
||||||
local command="source "..script_path..manufacturer..".sh && "..manufacturer.."_lockcurrent "..at_port
|
|
||||||
local result=shell(command)
|
|
||||||
response["response"]=result
|
|
||||||
response["time"]=os.date("%Y-%m-%d %H:%M:%S")
|
|
||||||
response["lock"]="self"
|
|
||||||
end
|
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(response)
|
luci.http.write_json(response)
|
||||||
end
|
end
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//设置标签菜单事件
|
//设置标签菜单事件
|
||||||
function set_tab_event(parent_element) {
|
function set_tab_event(parent_element) {
|
||||||
|
|
||||||
@ -55,6 +56,8 @@
|
|||||||
for (var i = 0; i < childElements.length; i++) {
|
for (var i = 0; i < childElements.length; i++) {
|
||||||
childElements[i].addEventListener('click', function (event) {
|
childElements[i].addEventListener('click', function (event) {
|
||||||
tab_event(this);
|
tab_event(this);
|
||||||
|
//remove_dont_edit_flag
|
||||||
|
document.getElementById("tab_menu").removeAttribute("dont_edit");
|
||||||
var debug_params = { first_cache: true };
|
var debug_params = { first_cache: true };
|
||||||
get_modem_debug_info(debug_params);
|
get_modem_debug_info(debug_params);
|
||||||
});
|
});
|
||||||
@ -399,8 +402,9 @@
|
|||||||
|
|
||||||
//设置当前拨号模式
|
//设置当前拨号模式
|
||||||
document.getElementById('current_mode').innerHTML = current_mode_view;
|
document.getElementById('current_mode').innerHTML = current_mode_view;
|
||||||
|
dont_edit_flag = document.getElementById("tab_menu").getAttribute("dont_edit");
|
||||||
if (first_cache) {
|
if (dont_edit_flag == null) {
|
||||||
|
document.getElementById("tab_menu").setAttribute("dont_edit", "true");
|
||||||
//设置支持的拨号模式
|
//设置支持的拨号模式
|
||||||
var mode_option_view = '';
|
var mode_option_view = '';
|
||||||
for (mode of modes) {
|
for (mode of modes) {
|
||||||
@ -416,8 +420,6 @@
|
|||||||
//设置拨号模式选项
|
//设置拨号模式选项
|
||||||
element = document.getElementById('mode_option_' + current_mode).checked = true;
|
element = document.getElementById('mode_option_' + current_mode).checked = true;
|
||||||
|
|
||||||
//设置第一次获取数据标志
|
|
||||||
first_cache = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -469,10 +471,9 @@
|
|||||||
|
|
||||||
//获取偏好视图
|
//获取偏好视图
|
||||||
var current_prefer_view = get_current_prefer_view(network_prefer);
|
var current_prefer_view = get_current_prefer_view(network_prefer);
|
||||||
|
dont_edit_flag = document.getElementById("tab_menu").getAttribute("dont_edit");
|
||||||
//设置偏好选项和复选框
|
if (dont_edit_flag == null) {
|
||||||
if (first_cache) {
|
document.getElementById("tab_menu").setAttribute("dont_edit", "true");
|
||||||
//更新偏好配置
|
|
||||||
for (key in network_prefer) {
|
for (key in network_prefer) {
|
||||||
//设置偏好配置
|
//设置偏好配置
|
||||||
var prefer_config_element = document.getElementById('prefer_config_' + key.toLowerCase());
|
var prefer_config_element = document.getElementById('prefer_config_' + key.toLowerCase());
|
||||||
@ -480,10 +481,8 @@
|
|||||||
prefer_config_element.checked = network_prefer[key];
|
prefer_config_element.checked = network_prefer[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//设置第一次获取数据标志
|
}
|
||||||
first_cache = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_lockband_info(lockband_info, first_cache) {
|
function set_lockband_info(lockband_info, first_cache) {
|
||||||
@ -495,7 +494,8 @@
|
|||||||
|
|
||||||
//设置偏好选项和复选框
|
//设置偏好选项和复选框
|
||||||
if (first_cache) {
|
if (first_cache) {
|
||||||
for (key in avalible_lockband) {
|
sortted_keys = Object.keys(avalible_lockband).sort();
|
||||||
|
for (key of sortted_keys) {
|
||||||
id = "lockband_config_" + key;
|
id = "lockband_config_" + key;
|
||||||
checkbox_get = document.getElementById(id);
|
checkbox_get = document.getElementById(id);
|
||||||
if (checkbox_get == null) {
|
if (checkbox_get == null) {
|
||||||
@ -595,6 +595,7 @@
|
|||||||
// 设置网络偏好
|
// 设置网络偏好
|
||||||
function set_network_prefer() {
|
function set_network_prefer() {
|
||||||
//禁用功能
|
//禁用功能
|
||||||
|
|
||||||
disabled_function("network_prefer", true);
|
disabled_function("network_prefer", true);
|
||||||
|
|
||||||
//获取选中的模组
|
//获取选中的模组
|
||||||
@ -603,6 +604,7 @@
|
|||||||
//获取偏好配置
|
//获取偏好配置
|
||||||
var network_prefer_config = {};
|
var network_prefer_config = {};
|
||||||
var checkboxes = document.getElementById('prefer_custom_config').querySelectorAll('input[type="checkbox"]');
|
var checkboxes = document.getElementById('prefer_custom_config').querySelectorAll('input[type="checkbox"]');
|
||||||
|
|
||||||
for (checkbox of checkboxes) {
|
for (checkbox of checkboxes) {
|
||||||
network_prefer_config[checkbox.value.toUpperCase()] = Number(checkbox.checked);
|
network_prefer_config[checkbox.value.toUpperCase()] = Number(checkbox.checked);
|
||||||
}
|
}
|
||||||
@ -650,7 +652,6 @@
|
|||||||
if (checkbox_get == null) {
|
if (checkbox_get == null) {
|
||||||
checkbox_span = document.createElement('span');
|
checkbox_span = document.createElement('span');
|
||||||
checkbox_span.className = "cbi-checkbox";
|
checkbox_span.className = "cbi-checkbox";
|
||||||
|
|
||||||
checkbox = document.createElement('input');
|
checkbox = document.createElement('input');
|
||||||
checkbox.id = "lockband_config_" + key;
|
checkbox.id = "lockband_config_" + key;
|
||||||
checkbox.name = "lockband_option";
|
checkbox.name = "lockband_option";
|
||||||
@ -711,7 +712,6 @@
|
|||||||
if (Object.keys(network_prefer_info).length == 0) {
|
if (Object.keys(network_prefer_info).length == 0) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置网络偏好信息
|
//设置网络偏好信息
|
||||||
set_network_prefer_info(network_prefer_info, debug_params.first_cache);
|
set_network_prefer_info(network_prefer_info, debug_params.first_cache);
|
||||||
}
|
}
|
||||||
@ -744,57 +744,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function unlock_cell() {
|
|
||||||
var at_port = document.getElementById("modem_select").value;
|
|
||||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_lock_cell")%>', { "port": at_port, "lock": "0" },
|
|
||||||
function (x, data) {
|
|
||||||
console.log(data["response"]);
|
|
||||||
update_cell_config();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function lock_current_cell() {
|
|
||||||
var at_port = document.getElementById("modem_select").value;
|
|
||||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_lock_cell")%>', { "port": at_port, "lock": "3" },
|
|
||||||
function (x, data) {
|
|
||||||
console.log(data["response"]);
|
|
||||||
update_cell_config();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function lock_pci() {
|
|
||||||
var at_port = document.getElementById("modem_select").value;
|
|
||||||
var pci = document.getElementById("pci_input").value;
|
|
||||||
var arfcn = document.getElementById("arfcn_input").value;
|
|
||||||
var rat = document.getElementById("rat_select").value;
|
|
||||||
var scs = document.getElementById("scs_select").value;
|
|
||||||
var nrband = document.getElementById("nrband_input").value;
|
|
||||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_lock_cell")%>', { "port": at_port, "lock": "1", "pci": pci, "arfcn": arfcn, "celltype": rat , "scs": scs, "nrband": nrband},
|
|
||||||
function (x, data) {
|
|
||||||
console.log(data["response"]);
|
|
||||||
update_cell_config();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function lock_arfcn() {
|
|
||||||
var at_port = document.getElementById("modem_select").value;
|
|
||||||
var arfcn = document.getElementById("arfcn_input").value;
|
|
||||||
var rat = document.getElementById("rat_select").value;
|
|
||||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_lock_cell")%>', { "port": at_port, "lock": "2", "arfcn": arfcn, "celltype": rat },
|
|
||||||
function (x, data) {
|
|
||||||
console.log(data["response"]);
|
|
||||||
update_cell_config();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新neighbor cell信息
|
// 更新neighbor cell信息
|
||||||
function update_cell_config() {
|
function update_cell_config() {
|
||||||
function onclick_copy_fun_gen(cellinfo) {
|
function onclick_copy_fun_gen(cellinfo) {
|
||||||
@ -819,16 +768,61 @@
|
|||||||
neighbor_cell_info.removeChild(neighbor_cell_info.firstChild);
|
neighbor_cell_info.removeChild(neighbor_cell_info.firstChild);
|
||||||
}
|
}
|
||||||
//add new child nodes
|
//add new child nodes
|
||||||
lte_cell = data["LTE"];
|
lockcell_feature = data["Feature"];
|
||||||
nr_cell = data["NR"];
|
//render feature button
|
||||||
|
lockcell_feature_div = document.getElementById('lockcell_feature');
|
||||||
|
for (key in lockcell_feature) {
|
||||||
|
v = lockcell_feature[key];
|
||||||
|
feature_button_id = "lockcell_feature_" + v;
|
||||||
|
if (document.getElementById(feature_button_id) != null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
feature_button = document.createElement('input');
|
||||||
|
feature_button.type = "button";
|
||||||
|
feature_button.id = feature_button_id;
|
||||||
|
feature_button.value = key;
|
||||||
|
feature_button.className = "cbi-button-apply";
|
||||||
|
console.log("key:" + key + " feature:" + v)
|
||||||
|
feature_button.onclick = function () {
|
||||||
|
var at_port = document.getElementById("modem_select").value;
|
||||||
|
var pci = document.getElementById("pci_input").value;
|
||||||
|
var arfcn = document.getElementById("arfcn_input").value;
|
||||||
|
var rat = document.getElementById("rat_select").value;
|
||||||
|
var scs = document.getElementById("scs_select").value;
|
||||||
|
var nrband = document.getElementById("nrband_input").value;
|
||||||
|
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_lock_cell")%>', { "port": at_port, "func": this.id.replace("lockcell_feature_",""), "pci": pci, "arfcn": arfcn, "celltype": rat, "scs": scs, "nrband": nrband},
|
||||||
|
function (x, data) {
|
||||||
|
console.log(data["response"]);
|
||||||
|
update_cell_config();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
lockcell_feature_div.appendChild(feature_button);
|
||||||
|
}
|
||||||
|
|
||||||
lockcell_status = data["lockcell_status"];
|
lockcell_status = data["lockcell_status"];
|
||||||
for (cell of lte_cell) {
|
neighbor_cells = {
|
||||||
cell['rat'] = "0";
|
"LTE" : data["LTE"],
|
||||||
|
"NR" : data["NR"]
|
||||||
|
}
|
||||||
|
for (type in neighbor_cells) {
|
||||||
|
for (cell_info of neighbor_cells[type]) {
|
||||||
|
|
||||||
|
rat = type == "LTE" ? 0 : 1;
|
||||||
|
cell_info["rat"] = rat;
|
||||||
|
innerHTML = `RAT:${type} `
|
||||||
|
console.log(innerHTML)
|
||||||
|
for (cell_info_key in cell_info){
|
||||||
|
if (cell_info[cell_info_key] == "") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
innerHTML += `${cell_info_key}:${cell_info[cell_info_key]} `
|
||||||
|
}
|
||||||
cell_tr = document.createElement('tr');
|
cell_tr = document.createElement('tr');
|
||||||
cell_tr.className = "tr";
|
cell_tr.className = "tr";
|
||||||
cell_td_left = document.createElement('td');
|
cell_td_left = document.createElement('td');
|
||||||
cell_td_left.className = "td";
|
cell_td_left.className = "td";
|
||||||
cell_td_left.innerHTML = `RAT: LTE PCI:${cell['pci']} ARFCN:${cell['arfcn']} RSRP:${cell['rsrp']} RSRQ:${cell['rsrq']} `;
|
cell_td_left.innerHTML = innerHTML;
|
||||||
cell_td_right = document.createElement('td');
|
cell_td_right = document.createElement('td');
|
||||||
cell_td_right.className = "td";
|
cell_td_right.className = "td";
|
||||||
copy_botton = document.createElement('input');
|
copy_botton = document.createElement('input');
|
||||||
@ -837,33 +831,14 @@
|
|||||||
copy_botton.className = "cbi-button";
|
copy_botton.className = "cbi-button";
|
||||||
copy_botton.value = "Copy";
|
copy_botton.value = "Copy";
|
||||||
|
|
||||||
copy_botton.onclick = onclick_copy_fun_gen(cell);
|
copy_botton.onclick = onclick_copy_fun_gen(cell_info);
|
||||||
cell_td_right.appendChild(copy_botton);
|
cell_td_right.appendChild(copy_botton);
|
||||||
cell_tr.appendChild(cell_td_left);
|
cell_tr.appendChild(cell_td_left);
|
||||||
cell_tr.appendChild(cell_td_right);
|
cell_tr.appendChild(cell_td_right);
|
||||||
neighbor_cell_info.appendChild(cell_tr);
|
neighbor_cell_info.appendChild(cell_tr);
|
||||||
}
|
}
|
||||||
for (cell of nr_cell) {
|
}
|
||||||
cell['rat'] = "1";
|
|
||||||
cell_tr = document.createElement('tr');
|
|
||||||
cell_tr.className = "tr";
|
|
||||||
cell_td_left = document.createElement('td');
|
|
||||||
cell_td_left.className = "td";
|
|
||||||
cell_td_left.innerHTML = `RAT: LTE PCI:${cell['pci']} ARFCN:${cell['arfcn']} RSRP:${cell['rsrp']} RSRQ:${cell['rsrq']} `;
|
|
||||||
cell_td_right = document.createElement('td');
|
|
||||||
cell_td_right.className = "td";
|
|
||||||
copy_botton = document.createElement('input');
|
|
||||||
copy_botton.type = "button";
|
|
||||||
copy_botton.innerHTML = "Copy";
|
|
||||||
copy_botton.className = "cbi-button";
|
|
||||||
copy_botton.value = "Copy";
|
|
||||||
|
|
||||||
copy_botton.onclick = onclick_fun_gen(cell);
|
|
||||||
cell_td_right.appendChild(copy_botton);
|
|
||||||
cell_tr.appendChild(cell_td_left);
|
|
||||||
cell_tr.appendChild(cell_td_right);
|
|
||||||
neighbor_cell_info.appendChild(cell_tr);
|
|
||||||
}
|
|
||||||
lockcell_status_div = document.getElementById('current_cell_status');
|
lockcell_status_div = document.getElementById('current_cell_status');
|
||||||
childElements = lockcell_status_div.childNodes;
|
childElements = lockcell_status_div.childNodes;
|
||||||
keys = Object.keys(lockcell_status);
|
keys = Object.keys(lockcell_status);
|
||||||
@ -1341,15 +1316,15 @@
|
|||||||
<%:Submit%>
|
<%:Submit%>
|
||||||
</td>
|
</td>
|
||||||
<td class="td left">
|
<td class="td left">
|
||||||
<div>
|
<div id="lockcell_feature">
|
||||||
<input class="cbi-button cbi-button-apply" type="button" value="<%:Unlock Cell%>"
|
<!-- <input class="cbi-button cbi-button-apply" type="button" value="<%:Unlock Cell%>"
|
||||||
onclick="unlock_cell()" alt="<%:Unlock Cell%>" title="<%:Unlock Cell%>">
|
onclick="unlock_cell()" alt="<%:Unlock Cell%>" title="<%:Unlock Cell%>">
|
||||||
<input class="cbi-button cbi-button-apply" type="button" value="<%:Lock Current%>"
|
<input class="cbi-button cbi-button-apply" type="button" value="<%:Lock Current%>"
|
||||||
onclick="lock_current_cell()" alt="<%:Lock Current%>" title="<%:Lock Current%>">
|
onclick="lock_current_cell()" alt="<%:Lock Current%>" title="<%:Lock Current%>">
|
||||||
<input class="cbi-button cbi-button-reset" type="button" value="<%:Lock PCI%>"
|
<input class="cbi-button cbi-button-reset" type="button" value="<%:Lock PCI%>"
|
||||||
onclick="lock_pci()" alt="<%:Lock PCI%>" title="<%:Lock PCI%>">
|
onclick="lock_pci()" alt="<%:Lock PCI%>" title="<%:Lock PCI%>">
|
||||||
<input class="cbi-button cbi-button-reset" type="button" value="<%:Lock ARFCN%>"
|
<input class="cbi-button cbi-button-reset" type="button" value="<%:Lock ARFCN%>"
|
||||||
onclick="lock_arfcn()" alt="<%:Lock ARFCN%>" title="<%:Lock ARFCN%>">
|
onclick="lock_arfcn()" alt="<%:Lock ARFCN%>" title="<%:Lock ARFCN%>"> -->
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -247,3 +247,12 @@ config custom-commands
|
|||||||
config custom-commands
|
config custom-commands
|
||||||
option description '重置模组 > AT+CFUN=15'
|
option description '重置模组 > AT+CFUN=15'
|
||||||
option command 'AT+CFUN=15'
|
option command 'AT+CFUN=15'
|
||||||
|
|
||||||
|
|
||||||
|
config dial-config 'defa0'
|
||||||
|
option network_bridge '0'
|
||||||
|
option enable '1'
|
||||||
|
option network 'wwan0'
|
||||||
|
option pdp_type 'ipv4v6'
|
||||||
|
option auth 'none'
|
||||||
|
option id 'defa0'
|
||||||
|
@ -636,6 +636,13 @@ fibocom_get_neighborcell()
|
|||||||
get_lockcell_command="AT+GTCELLLOCK?"
|
get_lockcell_command="AT+GTCELLLOCK?"
|
||||||
cell_type="undefined"
|
cell_type="undefined"
|
||||||
json_init
|
json_init
|
||||||
|
json_add_object "Feature"
|
||||||
|
json_add_string "unlockcell" "1"
|
||||||
|
json_add_string "lockpci" "2"
|
||||||
|
json_add_string "lockarfcn" "3"
|
||||||
|
json_add_string "lockcurrent" "4"
|
||||||
|
json_add_string "reboot modem" "5"
|
||||||
|
json_close_object
|
||||||
json_add_array "NR"
|
json_add_array "NR"
|
||||||
json_close_array
|
json_close_array
|
||||||
json_add_array "LTE"
|
json_add_array "LTE"
|
||||||
@ -752,6 +759,39 @@ fibocom_get_neighborcell()
|
|||||||
json_dump
|
json_dump
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fibocom_setlockcell(){
|
||||||
|
#at_port,func,celltype,arfcn,pci,scs,nrband
|
||||||
|
# "unlockcell" "1"
|
||||||
|
# "lockpci" "2"
|
||||||
|
# "lockarfcn" "3"
|
||||||
|
# "lockcurrent" "4"
|
||||||
|
# "reboot modem" "5"
|
||||||
|
local at_port="$1"
|
||||||
|
local func="$2"
|
||||||
|
local cell_type="$3"
|
||||||
|
local arfcn="$4"
|
||||||
|
local pci="$5"
|
||||||
|
local scs="$6"
|
||||||
|
local nrband="$7"
|
||||||
|
case $func in
|
||||||
|
"1")
|
||||||
|
fibocom_unlockcell $at_port
|
||||||
|
;;
|
||||||
|
"2")
|
||||||
|
fibocom_lockpci $at_port $cell_type $arfcn $pci $scs $nrband
|
||||||
|
;;
|
||||||
|
"3")
|
||||||
|
fibocom_lockarfcn $at_port $cell_type $arfcn
|
||||||
|
;;
|
||||||
|
"4")
|
||||||
|
fibocom_lockcurrent $at_port
|
||||||
|
;;
|
||||||
|
"5")
|
||||||
|
sh ${SCRIPT_DIR}/modem_reboot.sh $at_port at+cfun=1,1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
fibocom_unlockcell()
|
fibocom_unlockcell()
|
||||||
{
|
{
|
||||||
local at_port="$1"
|
local at_port="$1"
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#脚本目录
|
#脚本目录
|
||||||
SCRIPT_DIR="/usr/share/modem"
|
SCRIPT_DIR="/usr/share/modem"
|
||||||
|
source /usr/share/libubox/jshn.sh
|
||||||
#预设
|
#预设
|
||||||
quectel_presets()
|
quectel_presets()
|
||||||
{
|
{
|
||||||
@ -534,6 +534,333 @@ quectel_get_band()
|
|||||||
echo "$band"
|
echo "$band"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quectel_get_lockband_qualcomm()
|
||||||
|
{
|
||||||
|
local at_port="$1"
|
||||||
|
debug "Quectel sdx55 get lockband info"
|
||||||
|
get_wcdma_config_command='AT+QNWPREFCFG="gw_band"'
|
||||||
|
get_lte_config_command='AT+QNWPREFCFG="lte_band"'
|
||||||
|
get_nsa_nr_config_command='AT+QNWPREFCFG="nsa_nr5g_band"'
|
||||||
|
get_sa_nr_config_command='AT+QNWPREFCFG="nr5g_band"'
|
||||||
|
wcdma_avalible_band="1,2,3,4,5,6,7,8,9,19"
|
||||||
|
lte_avalible_band="1,2,3,4,5,7,8,12,13,14,17,18,19,20,25,26,28,29,30,32,34,38,39,40,41,42,66,71"
|
||||||
|
nsa_nr_avalible_band="1,2,3,5,7,8,12,20,25,28,38,40,41,48,66,71,77,78,79,257,258,260,261"
|
||||||
|
sa_nr_avalible_band="1,2,3,5,7,8,12,20,25,28,38,40,41,48,66,71,77,78,79"
|
||||||
|
gw_band=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $get_wcdma_config_command |grep -e "+QNWPREFCFG: " )
|
||||||
|
lte_band=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $get_lte_config_command|grep -e "+QNWPREFCFG: ")
|
||||||
|
nsa_nr_band=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $get_nsa_nr_config_command|grep -e "+QNWPREFCFG: ")
|
||||||
|
sa_nr_band=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $get_sa_nr_config_command|grep -e "+QNWPREFCFG: ")
|
||||||
|
json_init
|
||||||
|
json_add_object "available_band"
|
||||||
|
for i in $(echo "$wcdma_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||||
|
json_add_string "UMTS_$i" "UMTS_$i"
|
||||||
|
done
|
||||||
|
for i in $(echo "$lte_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||||
|
json_add_string "LTE_B$i" "LTE_B$i"
|
||||||
|
done
|
||||||
|
for i in $(echo "$nsa_nr_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||||
|
json_add_string "NSA_NR_N$i" "NSA_NR_N$i"
|
||||||
|
done
|
||||||
|
for i in $(echo "$sa_nr_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
|
||||||
|
json_add_string "SA_NR_N$i" "SA_NR_N$i"
|
||||||
|
done
|
||||||
|
json_close_object
|
||||||
|
json_add_array "lock_band"
|
||||||
|
#+QNWPREFCFG: "nr5g_band",1:3:7:20:28:40:41:71:77:78:79
|
||||||
|
for i in $(echo "$gw_band" | cut -d, -f2 |tr -d '\r' | awk -F":" '{for(j=1; j<=NF; j++) print $j}'); do
|
||||||
|
if [ -n "$i" ]; then
|
||||||
|
json_add_string "" "UMTS_$i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for i in $(echo "$lte_band" | cut -d, -f2|tr -d '\r' | awk -F":" '{for(j=1; j<=NF; j++) print $j}'); do
|
||||||
|
if [ -n "$i" ]; then
|
||||||
|
json_add_string "" "LTE_B$i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for i in $(echo "$nsa_nr_band" | cut -d, -f2|tr -d '\r' | awk -F":" '{for(j=1; j<=NF; j++) print $j}'); do
|
||||||
|
if [ -n "$i" ]; then
|
||||||
|
json_add_string "" "NSA_NR_N$i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for i in $(echo "$sa_nr_band" | cut -d, -f2|tr -d '\r' | awk -F":" '{for(j=1; j<=NF; j++) print $j}'); do
|
||||||
|
if [ -n "$i" ]; then
|
||||||
|
json_add_string "" "SA_NR_N$i"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
json_close_array
|
||||||
|
json_result=`json_dump`
|
||||||
|
echo "$json_result"
|
||||||
|
}
|
||||||
|
|
||||||
|
quectel_get_lockband()
|
||||||
|
{
|
||||||
|
local at_port="$1"
|
||||||
|
|
||||||
|
local platform
|
||||||
|
local modem_number=$(uci -q get modem.@global[0].modem_number)
|
||||||
|
for i in $(seq 0 $((modem_number-1))); do
|
||||||
|
local at_port_tmp=$(uci -q get modem.modem$i.at_port)
|
||||||
|
if [ "$at_port" = "$at_port_tmp" ]; then
|
||||||
|
platform=$(uci -q get modem.modem$i.platform)
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
case "$platform" in
|
||||||
|
"qualcomm")
|
||||||
|
quectel_get_lockband_qualcomm $at_port
|
||||||
|
;;
|
||||||
|
"unisoc")
|
||||||
|
quectel_get_lockband_unisoc $at_port
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "unknown"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
quectel_set_lockband_qualcomm(){
|
||||||
|
local at_port="$1"
|
||||||
|
local lock_band="$2"
|
||||||
|
gw_band=""
|
||||||
|
lte_band=""
|
||||||
|
nsa_nr_band=""
|
||||||
|
sa_nr_band=""
|
||||||
|
for i in $(echo $2 | awk -F"," '{for(j=1; j<=NF; j++) print $j}' );do
|
||||||
|
num_match=$(echo $i | grep -o "[0-9]\+")
|
||||||
|
case "$i" in
|
||||||
|
UMTS_*)
|
||||||
|
if [ -z "$gw_band" ]; then
|
||||||
|
gw_band=$num_match
|
||||||
|
else
|
||||||
|
gw_band=$gw_band:$num_match
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
LTE_B*)
|
||||||
|
if [ -z "$lte_band" ]; then
|
||||||
|
lte_band=$num_match
|
||||||
|
else
|
||||||
|
lte_band=$lte_band:$num_match
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
NSA_NR_N*)
|
||||||
|
if [ -z "$nsa_nr_band" ]; then
|
||||||
|
nsa_nr_band=$num_match
|
||||||
|
else
|
||||||
|
nsa_nr_band=$nsa_nr_band:$num_match
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
SA_NR_N*)
|
||||||
|
if [ -z "$sa_nr_band" ]; then
|
||||||
|
sa_nr_band=$num_match
|
||||||
|
else
|
||||||
|
sa_nr_band=$sa_nr_band:$num_match
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
if [ -n "$gw_band" ]; then
|
||||||
|
at_command="AT+QNWPREFCFG=\"gw_band\",$gw_band"
|
||||||
|
res1=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||||
|
fi
|
||||||
|
if [ -n "$lte_band" ]; then
|
||||||
|
at_command="AT+QNWPREFCFG=\"lte_band\",$lte_band"
|
||||||
|
res2=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||||
|
fi
|
||||||
|
if [ -n "$nsa_nr_band" ]; then
|
||||||
|
at_command="AT+QNWPREFCFG=\"nsa_nr5g_band\",$nsa_nr_band"
|
||||||
|
res3=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||||
|
fi
|
||||||
|
if [ -n "$sa_nr_band" ]; then
|
||||||
|
at_command="AT+QNWPREFCFG=\"nr5g_band\",$sa_nr_band"
|
||||||
|
res4=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
|
||||||
|
fi
|
||||||
|
json_init
|
||||||
|
json_add_string result1 "$res1"
|
||||||
|
json_add_string result2 "$res2"
|
||||||
|
json_add_string result3 "$res3"
|
||||||
|
json_add_string result4 "$res4"
|
||||||
|
json_result=`json_dump`
|
||||||
|
echo "$json_result"
|
||||||
|
}
|
||||||
|
#设置锁频
|
||||||
|
quectel_set_lockband()
|
||||||
|
{
|
||||||
|
debug "quectel set lockband info"
|
||||||
|
local at_port="$1"
|
||||||
|
local platform
|
||||||
|
local modem_number=$(uci -q get modem.@global[0].modem_number)
|
||||||
|
for i in $(seq 0 $((modem_number-1))); do
|
||||||
|
local at_port_tmp=$(uci -q get modem.modem$i.at_port)
|
||||||
|
if [ "$at_port" = "$at_port_tmp" ]; then
|
||||||
|
platform=$(uci -q get modem.modem$i.platform)
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
case "$platform" in
|
||||||
|
"qualcomm")
|
||||||
|
quectel_set_lockband_qualcomm $at_port $2
|
||||||
|
;;
|
||||||
|
"unisoc")
|
||||||
|
quectel_set_lockband_unisoc $at_port $2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "unknown"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
quectel_get_neighborcell_qualcomm(){
|
||||||
|
local at_port="$1"
|
||||||
|
local at_command='AT+QENG="neighbourcell"'
|
||||||
|
sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command > /tmp/quectel_neighborcell
|
||||||
|
json_init
|
||||||
|
json_add_object "Feature"
|
||||||
|
json_add_string "lockpci" "1"
|
||||||
|
json_add_string "unlockcell" "2"
|
||||||
|
json_add_string "manually search" "3"
|
||||||
|
json_add_string "reboot modem" "4"
|
||||||
|
json_close_object
|
||||||
|
json_add_array "NR"
|
||||||
|
json_close_array
|
||||||
|
json_add_array "LTE"
|
||||||
|
json_close_array
|
||||||
|
while read line; do
|
||||||
|
if [ -n "$(echo $line | grep "+QENG:")" ]; then
|
||||||
|
# +QENG: "neighbourcell intra","LTE",<earfcn>,<PCID>,<
|
||||||
|
# RSRQ>,<RSRP>,<RSSI>,<SINR>,<srxlev>,<cell_resel_pri
|
||||||
|
# ority>,<s_non_intra_search>,<thresh_serving_low>,<s_i
|
||||||
|
# ntra_search>
|
||||||
|
# …]
|
||||||
|
# [+QENG: "neighbourcell inter","LTE",<earfcn>,<PCID>,<
|
||||||
|
# RSRQ>,<RSRP>,<RSSI>,<SINR>,<srxlev>,<cell_resel_pri
|
||||||
|
# ority>,<threshX_low>,<threshX_high>
|
||||||
|
# …]
|
||||||
|
# [+QENG:"neighbourcell","WCDMA",<uarfcn>,<cell_resel
|
||||||
|
# _priority>,<thresh_Xhigh>,<thresh_Xlow>,<PSC>,<RSC
|
||||||
|
# P><eccno>,<srxlev>
|
||||||
|
# …]
|
||||||
|
line=$(echo $line | sed 's/+QENG: //g')
|
||||||
|
case $line in
|
||||||
|
*WCDMA*)
|
||||||
|
type="WCDMA"
|
||||||
|
|
||||||
|
arfcn=$(echo $line | awk -F',' '{print $3}')
|
||||||
|
pci=$(echo $line | awk -F',' '{print $4}')
|
||||||
|
rscp=$(echo $line | awk -F',' '{print $6}')
|
||||||
|
ecno=$(echo $line | awk -F',' '{print $7}')
|
||||||
|
;;
|
||||||
|
*LTE*)
|
||||||
|
type="LTE"
|
||||||
|
neighbourcell=$(echo $line | awk -F',' '{print $1}' | tr -d '"')
|
||||||
|
arfcn=$(echo $line | awk -F',' '{print $3}')
|
||||||
|
pci=$(echo $line | awk -F',' '{print $4}')
|
||||||
|
rsrp=$(echo $line | awk -F',' '{print $5}')
|
||||||
|
rsrq=$(echo $line | awk -F',' '{print $6}')
|
||||||
|
|
||||||
|
;;
|
||||||
|
*NR*)
|
||||||
|
type="NR"
|
||||||
|
arfcn=$(echo $line | awk -F',' '{print $3}')
|
||||||
|
pci=$(echo $line | awk -F',' '{print $4}')
|
||||||
|
rsrp=$(echo $line | awk -F',' '{print $5}')
|
||||||
|
rsrq=$(echo $line | awk -F',' '{print $6}')
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
json_select $type
|
||||||
|
json_add_object ""
|
||||||
|
json_add_string "neighbourcell" "$neighbourcell"
|
||||||
|
json_add_string "arfcn" "$arfcn"
|
||||||
|
json_add_string "pci" "$pci"
|
||||||
|
json_add_string "rscp" "$rscp"
|
||||||
|
json_add_string "ecno" "$ecno"
|
||||||
|
json_add_string "rsrp" "$rsrp"
|
||||||
|
json_add_string "rsrq" "$rsrq"
|
||||||
|
json_close_object
|
||||||
|
json_select ".."
|
||||||
|
fi
|
||||||
|
done < /tmp/quectel_neighborcell
|
||||||
|
json_result=`json_dump`
|
||||||
|
echo "$json_result"
|
||||||
|
}
|
||||||
|
|
||||||
|
quectel_get_neighborcell(){
|
||||||
|
debug "quectel set lockband info"
|
||||||
|
local at_port="$1"
|
||||||
|
local platform
|
||||||
|
local modem_number=$(uci -q get modem.@global[0].modem_number)
|
||||||
|
for i in $(seq 0 $((modem_number-1))); do
|
||||||
|
local at_port_tmp=$(uci -q get modem.modem$i.at_port)
|
||||||
|
if [ "$at_port" = "$at_port_tmp" ]; then
|
||||||
|
platform=$(uci -q get modem.modem$i.platform)
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
case "$platform" in
|
||||||
|
"qualcomm")
|
||||||
|
quectel_get_neighborcell_qualcomm $at_port $2
|
||||||
|
;;
|
||||||
|
"unisoc")
|
||||||
|
quectel_get_neighborcell_unisoc $at_port $2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "unknown"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
quectel_setlockcell(){
|
||||||
|
#at_port,func,celltype,arfcn,pci,scs,nrband
|
||||||
|
# "lockpci" "1"
|
||||||
|
# "unlockcell" "2"
|
||||||
|
# "manually search" "3"
|
||||||
|
# "reboot modem" "4"
|
||||||
|
local at_port="$1"
|
||||||
|
local func="$2"
|
||||||
|
local cell_type="$3"
|
||||||
|
local arfcn="$4"
|
||||||
|
local pci="$5"
|
||||||
|
local scs="$6"
|
||||||
|
local nrband="$7"
|
||||||
|
case $func in
|
||||||
|
"1")
|
||||||
|
quectel_lockpci $at_port
|
||||||
|
;;
|
||||||
|
"2")
|
||||||
|
quectel_unlockcell $at_port $cell_type $arfcn $pci $scs $nrband
|
||||||
|
;;
|
||||||
|
|
||||||
|
"4")
|
||||||
|
sh ${SCRIPT_DIR}/modem_reboot.sh $at_port at+cfun=1,1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
quectel_unlockcell(){
|
||||||
|
unlocklte="AT+QNWLOCK=\"common/4g\",0"
|
||||||
|
unlocknr="AT+QNWLOCK=\"common/5g\",0"
|
||||||
|
res1=$(sh ${SCRIPT_DIR}/modem_at.sh $1 $unlocklte)
|
||||||
|
res2=$(sh ${SCRIPT_DIR}/modem_at.sh $1 $unlocknr)
|
||||||
|
}
|
||||||
|
|
||||||
|
quectel_lockpci(){
|
||||||
|
local at_port="$1"
|
||||||
|
local cell_type="$2"
|
||||||
|
local arfcn="$3"
|
||||||
|
local pci="$4"
|
||||||
|
local scs="$5"
|
||||||
|
local nrband="$6"
|
||||||
|
if [ "$cell_type" = "LTE" ]; then
|
||||||
|
locklte="AT+QNWLOCK=\"common/4g\",1,$arfcn,$pci"
|
||||||
|
res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $locklte)
|
||||||
|
elif [ "$cell_type" = "NR" ]; then
|
||||||
|
locknr="AT+QNWLOCK=\"common/5g\",1,$arfcn,$pci,$scs,$nrband"
|
||||||
|
res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $locknr)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#UL_bandwidth
|
#UL_bandwidth
|
||||||
# $1:上行带宽数字
|
# $1:上行带宽数字
|
||||||
quectel_get_lte_ul_bandwidth()
|
quectel_get_lte_ul_bandwidth()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user