diff --git a/lib/scripts/distro_web_utils.php b/lib/scripts/distro_web_utils.php index a062864..451ceb9 100644 --- a/lib/scripts/distro_web_utils.php +++ b/lib/scripts/distro_web_utils.php @@ -946,13 +946,9 @@ function print_TASK_PANEL(){ }; ?>Disable WANEnable WANWAN
WAN
WAN NA Package Installer @@ -961,6 +957,173 @@ function print_TASK_PANEL(){
+ +
Modem Info
+ $CM ){ + //print_r( $CM ); + echo ""; + echo ""; + if( $CM['generic']['state'] == 'disabled' ){ + echo ""; + } else { + echo ""; + }; + if( $CM['generic']['state'] == 'failed' ) { + echo ""; + }; + if( $CM['generic']['access-technologies'][0]!=''){ + echo ""; + }; + echo ""; + echo ""; + echo ""; + echo ""; + if( $CM['generic']['signal-quality']['recent'] =='no' ){ + echo ""; + } else { + echo ""; + }; + echo ""; + }; + if( $CM['generic']['state'] != 'disabled' ){ + $juja = json_decode( `mmcli -m 0 --messaging-list-sms -J`,true ); + echo ""; + }; + echo ""; + }; + } else { + echo ""; + }; +?> + +
Modem ID:{$MID}
Power state:{$CM['generic']['power-state']}
Modem state:{$CM['generic']['state']} + enable
Modem state:{$CM['generic']['state']} + disable
Failure reason:{$CM['generic']['state-failed-reason']}
Current Mode:{$CM['generic']['access-technologies'][0]}
IMEI:{$CM['generic']['equipment-identifier']}
manufacturer:{$CM['generic']['manufacturer']}
model:{$CM['generic']['model']}
revision:{$CM['generic']['revision']}
Signal validity:No Signal
Signal value:{$CM['generic']['signal-quality']['value']} %
Modem capabilities:"; + $ZI = explode( ',', $CM['generic']['current-capabilities'][0] ); + foreach( $ZI as $Z ){ + $CC = trim( $Z ); + echo "{$CC} "; + }; + if( isset( $CM['location'] ) ){ + echo "
Location capabilities:"; + foreach( $CM['location']['capabilities'] as $CC ){ + if( in_array( $CC, $CM['location']['enabled'] ) ){ + echo "{$CC} "; + } else { + echo "{$CC} "; + }; + }; + echo "Manage
SMS Messages:".count($juja['modem.messaging.sms'])."Manage
No Modem Defined!
 

+ +
Location Info
+ Location Engine Settings"; + //print_r( $CM['location'] ); + foreach( $CM['location']['capabilities'] as $CC ){ + echo ""; + }; + if( $CM['generic']['state']=='registered' ){ + $CMD = "echo \"terrarium\" | sudo -S mmcli -m {$MID} --location-get -J"; + $LOFO = json_decode( `$CMD`, true ); + $LI = $LOFO['modem']['location']; + foreach( $LI as $K=>$I ){ + switch( $K ){ + case '3gpp':{ + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + break; + }; + case 'cdma-bs':{ + if( $I['latitude'] != '--' ){ + echo ""; + echo ""; + echo ""; + echo ""; + }; + break; + }; + case 'gps':{ + if( $I['latitude'] != '--' ){ + echo ""; + echo ""; + echo ""; + echo ""; + }; + print_r( $I ); + $GMODE = 'A'; + $GFIX = 1; + $SATS = array(); + $SATNUM = 0; + foreach( $I['nmea'] as $NL ){ + $TAR = explode( ',', $NL ); + switch( $TAR[0] ){ + case '$GPGSA':{ + $GMODE = $TAR[1]; + $GFIX = intval( $TAR[2] ); + break; + }; + case '$GPGSV':{ + $SATNUM = intval( $TAR[3] ); + for( $i=1; $i < ( count( $TAR ) / 4 - 1); $i++ ){ + $SC=array(); + $CS['id'] = intval( $TAR[4*$i] ); + $CS['el'] = intval( $TAR[4*$i+1] ); + $CS['az'] = intval( $TAR[4*$i+2] ); + $CS['snr'] = intval( $TAR[4*$i+3] ); + $SATS[] = $CS; + }; + break; + }; + }; + }; + print_r( $SATS ); + break; + }; + }; + }; + //print_r( $LI ); + echo ""; + } else { + echo ""; + }; +?> + +
"; + if( in_array( $CC, $CM['location']['enabled'] ) ){ + echo "{$CC}"; + } else { + echo "{$CC}"; + }; + echo ""; + if( in_array( $CC, $CM['location']['enabled'] ) ){ + echo "disable"; + } else { + echo "enable"; + }; + echo "
3GPP Cellular Network Location Information
Mobile Country Code:{$I['mcc']}
Mobile Network Code:{$I['mnc']}
Cell ID:{$I['cid']}
Location Area Code:{$I['lac']}
Tracking Area Code:{$I['tac']}

CDMA Cellular Network Location Information
Lat:{$I['latitude']}
Lon:{$I['longitude']}

GPS Location Information
Lat:{$I['latitude']}
Lon:{$I['longitude']}

Go BackModem is Disabled!


Go Back
 

diff --git a/lib/scripts/sys_utils.php b/lib/scripts/sys_utils.php index d8d4192..4023dfc 100644 --- a/lib/scripts/sys_utils.php +++ b/lib/scripts/sys_utils.php @@ -462,7 +462,7 @@ function apply_NGINX_AUTH( $ROOTDIR, $AFILE ){ }; function get_SERVICE_STATUS( $ServName ){ - $Data = `service {$ServName} status`; + $Data = `systemctl status {$ServName}`; $TArr = explode( "\n", $Data ); $RD = array(); foreach( $TArr as $T ){ diff --git a/lib/sysroot/srv/etc/boot.php b/lib/sysroot/srv/etc/boot.php index c0dce25..c577d79 100644 --- a/lib/sysroot/srv/etc/boot.php +++ b/lib/sysroot/srv/etc/boot.php @@ -8,6 +8,51 @@ $TD = get_SERVICE_STATUS( 'smbd' ); $SYS_CONFIG['SAMBA_IS_ON'] = $TD['ENA']; $SYS_CONFIG['ARGUS_CONFIG'] = get_argus_config(); + if( !isset( $SYS_CONFIG['MODEM_SETUP'] ) ) $SYS_CONFIG['MODEM_SETUP'] = false; + if( !$SYS_CONFIG['MODEM_SETUP'] ){ + $MOMO = `mmcli -L`; + $TAR = explode( "\n", $MOMO ); + if( count( $TAR ) > 1 ){ + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'] = array(); + foreach( $TAR as $T ) { + $CMS = trim( $T ); + if( $CMS!= '' ){ + $PAPA = explode( ' ', $CMS ); + $AMO = explode( '/', $PAPA[0] ); + $MID = intval( $AMO[count($AMO)-1] ); + $MANU = json_decode( `mmcli -m $MID --output-json`, true ); + $LOLO = json_decode( `mmcli -m $MID --location-status --output-json`, true ); + $MANU['modem']['location'] = $LOLO['modem']['location']; + $MANU['modem']['CONNECT_AT_BOOT'] = false; + $MANU['modem']['CUSTOM_APN'] = ''; + $MANU['modem']['CUSTOM_APN_USER'] = ''; + $MANU['modem']['CUSTOM_APN_PASSWORD'] = ''; + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]=$MANU['modem']; + $SYS_CONFIG['MODEM_SETUP'] = true; + }; + }; + }; + } else { + foreach( $SYS_CONFIG['MODEM_CONFIG']['DEVICES'] as $MID=>$CD ){ + if( isset( $CD['CONNECT_AT_BOOT'] )){ + // Connect Modem + if( $CD['CONNECT_AT_BOOT'] ){ + $SIMP_CON_STR = array(); + if( $CD['CUSTOM_APN'] != '' ) $SIMP_CON_STR[] = "apn={$CD['CUSTOM_APN']}"; + if( $CD['CUSTOM_APN_USER'] != '' ) $SIMP_CON_STR[] = "user={$CD['CUSTOM_APN_USER']}"; + if( $CD['CUSTOM_APN_PASSWORD'] !='' ) $SIMP_CON_STR[] = "password={$CD['CUSTOM_APN_PASSWORD']}"; + $SIMP_CS = implode( ',', $SIMP_CON_STR ); + $CMD = "mmcli -m {$MID} --simple-connect=\"{$SIMP_CS}\""; + $L = `$CMD`; + }; + }; + //echo "Load Modem {$ID} NFO\n"; + $MANU = json_decode( `mmcli -m $MID --output-json`, true ); + $LOLO = json_decode( `mmcli -m $MID --location-status --output-json`, true ); + $MANU['modem']['location'] = $LOLO['modem']['location']; + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID] = $MANU['modem']; + }; + }; save_system_config(); ?> diff --git a/lib/sysroot/srv/etc/cron.php b/lib/sysroot/srv/etc/cron.php index a8b7b62..d680109 100644 --- a/lib/sysroot/srv/etc/cron.php +++ b/lib/sysroot/srv/etc/cron.php @@ -260,6 +260,32 @@ exit(); break; }; + case 27:{ + //Enable Modem + out_log("Disabling Modem!"); + $CMD = "mmcli -m {$CRON_CONFIG['parameter']} --enable"; + out_log( $CMD ); + $L=`$CMD`; + $CMD = "mmcli -m {$CRON_CONFIG['parameter']} --output-json"; + out_log( $CMD ); + $MANU = json_decode( `$CMD`, true ); + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$CRON_CONFIG['parameter']]=$MANU['modem']; + save_system_config(); + break; + }; + case 28:{ + //Dieable Modem + out_log("Disabling Modem!"); + $CMD = "mmcli -m {$CRON_CONFIG['parameter']} --disable"; + out_log( $CMD ); + $L=`$CMD`; + $CMD = "mmcli -m {$CRON_CONFIG['parameter']} --output-json"; + out_log( $CMD ); + $MANU = json_decode( `$CMD`, true ); + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$CRON_CONFIG['parameter']]=$MANU['modem']; + save_system_config(); + break; + }; }; }; ?> \ No newline at end of file diff --git a/lib/sysroot/srv/etc/pereodical.php b/lib/sysroot/srv/etc/pereodical.php index a3040fb..145b227 100644 --- a/lib/sysroot/srv/etc/pereodical.php +++ b/lib/sysroot/srv/etc/pereodical.php @@ -1,11 +1,13 @@ \ No newline at end of file diff --git a/lib/sysroot/srv/etc/system.json b/lib/sysroot/srv/etc/system.json index e183450..b70a868 100644 --- a/lib/sysroot/srv/etc/system.json +++ b/lib/sysroot/srv/etc/system.json @@ -1 +1 @@ -{"SAMBA_IS_ON":true,"ARGUS_CONFIG":{"app_is_running":true,"webui_is_running":true},"PERIODIC_JOB_COUNTS":0,"NET_CONFIG":{"lo":{"flags":{"hotplug":0,"auto":1},"net":[],"fam":"inet","mode":"loopback"},"enp6s0":{"flags":{"hotplug":1,"auto":0},"net":[],"fam":"inet","mode":"dhcp"}}} \ No newline at end of file +{"PERIODIC_JOB_COUNTS":0,"SAMBA_IS_ON":true,"ARGUS_CONFIG":{"app_is_running":true,"webui_is_running":true},"MODEM_SETUP":true,"MODEM_CONFIG":{"DEVICES":[{"3gpp":{"enabled-locks":[],"eps":{"initial-bearer":{"dbus-path":"--","settings":{"apn":"--","ip-type":"--","password":"--","user":"--"}},"ue-mode-operation":"csps-1"},"imei":"860147051348496","operator-code":"42501","operator-name":"Partner","pco":"--","registration-state":"--"},"cdma":{"activation-state":"--","cdma1x-registration-state":"--","esn":"--","evdo-registration-state":"--","meid":"--","nid":"--","sid":"--"},"dbus-path":"\/org\/freedesktop\/ModemManager1\/Modem\/0","generic":{"access-technologies":["lte"],"bearers":[],"carrier-configuration":"ROW_Gen_VoLTE","carrier-configuration-revision":"05010822","current-bands":["egsm","dcs","utran-1","utran-5","utran-8","eutran-1","eutran-3","eutran-5","eutran-7","eutran-8","eutran-20","eutran-38","eutran-40","eutran-41"],"current-capabilities":["gsm-umts, lte"],"current-modes":"allowed: 2g, 3g, 4g; preferred: 4g","device":"\/sys\/devices\/pci0000:00\/0000:00:14.0\/usb1\/1-2","device-identifier":"370583bd437ad3b0629ff381ca0c81fc37647d4a","drivers":["option1","qmi_wwan"],"equipment-identifier":"860147051348496","hardware-revision":"10000","manufacturer":"QUALCOMM INCORPORATED","model":"SIMCOM_SIM7600E-H","own-numbers":[],"plugin":"simtech","ports":["cdc-wdm0 (qmi)","ttyUSB1 (qcdm)","ttyUSB2 (gps)","ttyUSB3 (at)","ttyUSB4 (at)","ttyUSB5 (audio)","wwan0 (net)"],"power-state":"on","primary-port":"cdc-wdm0","revision":"LE20B04SIM7600M22_210318","signal-quality":{"recent":"yes","value":"59"},"sim":"\/org\/freedesktop\/ModemManager1\/SIM\/0","state":"enabled","state-failed-reason":"--","supported-bands":["egsm","dcs","utran-1","utran-5","utran-8","eutran-1","eutran-3","eutran-5","eutran-7","eutran-8","eutran-20","eutran-38","eutran-40","eutran-41"],"supported-capabilities":["gsm-umts, lte"],"supported-ip-families":["ipv4","ipv6","ipv4v6"],"supported-modes":["allowed: 2g; preferred: none","allowed: 3g; preferred: none","allowed: 4g; preferred: none","allowed: 2g, 3g; preferred: 3g","allowed: 2g, 3g; preferred: 2g","allowed: 2g, 4g; preferred: 4g","allowed: 2g, 4g; preferred: 2g","allowed: 3g, 4g; preferred: 4g","allowed: 3g, 4g; preferred: 3g","allowed: 2g, 3g, 4g; preferred: 4g","allowed: 2g, 3g, 4g; preferred: 3g","allowed: 2g, 3g, 4g; preferred: 2g"],"unlock-required":"sim-pin2","unlock-retries":["sim-pin (3)","sim-puk (10)","sim-pin2 (3)","sim-puk2 (10)"]}}]},"NET_CONFIG":{"lo":{"flags":{"hotplug":0,"auto":1},"net":[],"fam":"inet","mode":"loopback"},"enp6s0":{"flags":{"hotplug":1,"auto":0},"net":[],"fam":"inet","mode":"dhcp"}}} \ No newline at end of file diff --git a/style/style.css b/style/style.css index 95ccf59..9866477 100644 --- a/style/style.css +++ b/style/style.css @@ -53,6 +53,8 @@ body{ } .link_buton{ /*border: 2px solid white;*/ + display: block; + text-align: center; border-radius: 5px; color: black; text-decoration: none; @@ -60,6 +62,7 @@ body{ padding-top: 3px; padding-right: 10px; padding-bottom: 3px; + margin: 5px; font-size: 14px; font-weight: bold; background-color: orange; @@ -120,4 +123,36 @@ body{ color: black; border: black 2px solid; background-color: white; +} + +.smal_patch{ + aheight: 30px; + border-radius: 5px; + padding-left: 10px; + padding-top: 3px; + padding-right: 10px; + padding-bottom: 3px; + text-transform: uppercase; + text-decoration: none; + font-family: arial; + font-size: 10px; + font-weight: bold; + color: black; + background-color: orange; +} +.smal_patch#failed,.smal_patch#off{ + color: yellow; + background-color: red; +} +.smal_patch#on,.smal_patch#enabled{ + color: yellow; + background-color: green; +} +.smal_patch#disabled{ + color: black; + background-color: silver; +} +.smal_patch#lte{ + color: yellow; + background-color: blue; } \ No newline at end of file diff --git a/task_wait.php b/task_wait.php index 74a70ee..514a915 100644 --- a/task_wait.php +++ b/task_wait.php @@ -23,6 +23,8 @@ intval( $_GET['CTSS'] )); break; }; + case 27: $CPARAM = $_GET['MID']; break; + case 28: $CPARAM = $_GET['MID']; break; }; if( !create_cron_task( $CTID, $CPARAM ) ){ header('location: /'); diff --git a/wan_cp.php b/wan_cp.php index b71357e..bbe8492 100644 --- a/wan_cp.php +++ b/wan_cp.php @@ -3,16 +3,18 @@ require_once('../../scripts/sys_utils.php'); require_once('../../scripts/distro_web_utils.php'); + foreach( $SYS_CONFIG['MODEM_CONFIG']['DEVICES'] as $ID=>$CD ){ + $MANU = json_decode( `mmcli -m $ID --output-json`, true ); + $LOLO = json_decode( `mmcli -m $ID --location-status --output-json`, true ); + $MANU['modem']['location'] = $LOLO['modem']['location']; + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$ID]=$MANU['modem']; + }; + print_PAGE_HEADER(); if( $SYS_CONFIG['NGINX_AUTH_IS_SET'] == false ) { print_AUTH_WARNING(); }; - print_CONNECTION_INFO(); - print_TASK_PANEL(); - print_NET_INFO(); - print_CERT_INFO(); - print_APPLICATION_INFO(); - print_TIME_INFO(); + print_MODEM_INFO(); print_PAGE_BOTTOM(); ?> \ No newline at end of file diff --git a/wan_location_cp.php b/wan_location_cp.php new file mode 100644 index 0000000..16b5874 --- /dev/null +++ b/wan_location_cp.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/wan_modem_operation.php b/wan_modem_operation.php new file mode 100644 index 0000000..2bacff9 --- /dev/null +++ b/wan_modem_operation.php @@ -0,0 +1,98 @@ + \ No newline at end of file diff --git a/wan_sms_cp.php b/wan_sms_cp.php new file mode 100644 index 0000000..e8d8211 --- /dev/null +++ b/wan_sms_cp.php @@ -0,0 +1,15 @@ + \ No newline at end of file