Skip to content

Instantly share code, notes, and snippets.

@olekstomek
Last active December 27, 2021 15:17
Show Gist options
  • Save olekstomek/1b2b7a17b9cbbf72a30b0e43b3d617ff to your computer and use it in GitHub Desktop.
Save olekstomek/1b2b7a17b9cbbf72a30b0e43b3d617ff to your computer and use it in GitHub Desktop.
skrypt do pokazywania parametrów sygnału w modemie mobilnym 4G
javascript:ftb();function getStatus(){$.ajax({type:"GET",url:"/goform/goform_get_cmd_process",data:{cmd:"network_type,mcc,mnc,rssi,rsrq,lte_rsrp,wan_lte_ca,lte_ca_pcell_band,lte_ca_pcell_bandwidth,lte_ca_scell_band,lte_ca_scell_bandwidth,lte_ca_pcell_arfcn,lte_ca_scell_arfcn,Z_SINR,Z_CELL_ID,Z_eNB_id,Z_rsrq,lte_ca_scell_info,wan_ipaddr,ipv6_wan_ipaddr,static_wan_ipaddr,opms_wan_mode,opms_wan_auto_mode,ppp_status,loginfo",multi_data:"1"},dataType:"json",success:function(l){for(signal=l,vars=["mcc","mnc","rssi","network_type","wan_lte_ca","lte_rsrp","Z_SINR","rsrq","Z_CELL_ID","Z_eNB_id","lte_ca_pcell_bandwidth","lte_ca_pcell_band","lte_ca_scell_info"],e=0;e<vars.length;e++)window[vars[e]]=l[vars[e]];if(setgraph("rsrp",lte_rsrp,-130,-70),setgraph("rsrq",rsrq,-16,-3),enbid=Math.trunc(Z_eNB_id/256),plmn=mcc.toString()+mnc.toString(),$("#enbid").html(enbid),"22201"==plmn&&(plmn="2221"),"22299"==plmn&&(plmn="22288"),"22250"==plmn&&6==enbid.length&&(plmn="22288"),link_lte="https://lteitaly.it/internal/map.php#bts="+plmn+"."+enbid,$("#lteitaly").attr("href",link_lte),ca="ca_activated"==wan_lte_ca?"CA":"",mode="LTE_A"==network_type?'<span style="color:red">LTE_A</span>':network_type,$("#mode").html(mode),""!=lte_ca_scell_info){ca_v=lte_ca_scell_info.slice(0,-1).split(";"),ca_txt="";for(var e=0;e<ca_v.length;e++)d=ca_v[e].split(","),b=d[2],w=d[4],ca_txt+='<span style="color:red;">B'+b+"</span>(@"+w+"Mhz)+"}else ca_txt="";for(ca_txt=ca_txt.slice(0,-1),lte_ca_scell_info=ca_txt,lte_ca_pcell_band="B"+lte_ca_pcell_band,e=0;e<vars.length;e++)$("#"+vars[e]).html(window[vars[e]])}})}function err(l,e,a){alert("Communication Error"),console.log(l),console.log(e),console.log(a)}function setgraph(l,a,n,t){x=(a-n)/(t-n)*100,xs=String(x)+String.fromCharCode(37),e="#"+l+"b",$(e).width(xs),$(e).html(l+" : "+a),x<50?$(e).css("background-color","yellow").css("color","black"):(85<x?$(e).css("background-color","orange"):$(e).css("background-color","green")).css("color","white")}function ltebandselection(){var l=prompt("Please input LTE bands number, separated by + char (example 1+3+20).If you want to use every supported bands, write 'AUTO'.","AUTO");if(null!=(l=l&&l.toLowerCase())&&""!==l){var e=l.split("+"),a=0;if(all_bands="0x20080800C5","AUTO"===l.toUpperCase())a=all_bands;else{for(var n=0;n<e.length;n++)a+=Math.pow(2,parseInt(e[n])-1);a="0x"+a.toString(16)}$.ajax({type:"GET",url:"/goform/goform_get_cmd_process",data:{cmd:"wa_inner_version,cr_version,RD",multi_data:"1"},dataType:"json",success:function(l){ad=hex_md5(hex_md5(l.wa_inner_version+l.cr_version)+l.RD),$.ajax({type:"POST",url:"/goform/goform_set_cmd_process",data:{isTest:"false",goformId:"SET_LTE_BAND_LOCK",lte_band_lock:a,AD:ad},success:function(){$("#band").html('<span style="color:green;">OK</span>')},error:err})}})}}function ftb(){$(".color_background_blue").css("background-color","#456"),$(".headcontainer").hide(),$("body").prepend('<style> #rsrq,#lte_rsrp,#rssi,#enbid,#Z_SINR,#Z_eNB_id,#lte_ca_pcell_band,#allowed,#a1,#a2{color:#b00;font-weight:strong;} .f{float:left;border:1px solid #bbb;border-radius:5px;padding:10px;line-height:2em;margin:5px;} .f ul{margin:0;padding:0;} .f ul li{display:inline;margin-right:10px;} #mode{margin-right:0 !important;} #enbid{font-weight:bold;text-decoration:underline;} .p{border:1px solid #ccc;width:auto;height:20px;} .v{height:20px;} .sb{padding:10px;border-radius:10px;display:inline-block;margin:10px 0 10px 10px;} .v{padding-left:20px;} </style> <div class="p"><div class="v" id="rsrpb"></div></div> <div class="p"><div class="v" id="rsrqb"></div></div> <div style="display:block;overflow: auto;"><div class="f"> <ul> <li><a style="font-weight:bolder;background-color: #448;color:white;padding: 10px;border-radius:10px;" onclick="ltebandselection()">SET</a></li> </ul> </div> <div class="f"> <ul> <li>RSRP:<span id="lte_rsrp"></span>dBm</li> <li>RSRQ:<span id="rsrq"></span>dB</li> <li>RSSI:<span id="rssi"></span>dBm</li> <li>SINR:<span id="Z_SINR"></span>dB</li></ul> </div> <div class="f"> <ul> <li id="mode">Che la banda sia con te! Miononno &#9829;</li> </ul> </div> <div class="f"> <ul> <li>ENB ID:<a id="lteitaly" target="lteitaly" href="#"><span id="enbid">#</span></a></li> <li>CELL ID:<span id="Z_eNB_id">#</span></li> <li>MAIN:<span id="lte_ca_pcell_band"></span>(<span id="lte_ca_pcell_bandwidth"></span>Mhz)</li> <li>CA:<span id="lte_ca_scell_info"></span></li> </ul> </div> ')}signal="",version="3.0a",console.log("Code by Miononno - v"+version),console.log("type: signal"),window.setInterval(getStatus,2500);
@olekstomek
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment