From ef6c20ca4ff14e63379e9be14a88e9c9d4bc6a4a Mon Sep 17 00:00:00 2001 From: Evgeny Gagua Date: Thu, 7 Nov 2024 18:51:17 +0200 Subject: [PATCH] BINAT updates --- lib/scripts/distro_web_utils.php | 119 ++++++++++++++++-- lib/scripts/sys_utils.php | 208 ++++++++++++++++++++++++++++++- lib/scripts/test.php | 7 +- lib/sysroot/srv/etc/boot.php | 26 +++- lib/sysroot/srv/etc/cron.php | 61 +++++++-- lib/sysroot/srv/etc/system.json | 2 +- nm_add.php | 21 ++++ nm_error.php | 15 +++ nm_operation.php | 102 +++++++++++++++ style/style.css | 6 + task_wait.php | 11 +- wan_cp.php | 10 +- wan_modem_operation.php | 18 +-- 13 files changed, 566 insertions(+), 40 deletions(-) create mode 100644 nm_add.php create mode 100644 nm_error.php create mode 100644 nm_operation.php diff --git a/lib/scripts/distro_web_utils.php b/lib/scripts/distro_web_utils.php index 451ceb9..64d4337 100644 --- a/lib/scripts/distro_web_utils.php +++ b/lib/scripts/distro_web_utils.php @@ -959,7 +959,14 @@ function print_TASK_PANEL(){ function print_MODEM_INFO(){ global $SYS_CONFIG; -?> +?> + +
Modem Info
Modem ID:"; echo ""; + if( $CM['REGISTER_AT_BOOT'] ){ + echo ""; + } else { + echo ""; + }; + if( $CM['CONNECT_AT_BOOT'] ){ + echo ""; + } else { + echo ""; + }; if( $CM['generic']['state'] == 'disabled' ){ echo ""; + } elseif( $CM['generic']['state'] == 'failed' ) { + echo ""; } else { echo ""; - }; - if( $CM['generic']['state'] == 'failed' ) { - echo ""; - }; + }; if( $CM['generic']['access-technologies'][0]!=''){ echo ""; }; @@ -1020,6 +1036,93 @@ function print_MODEM_INFO(){
{$MID}
Power state:{$CM['generic']['power-state']}
Register at Boot Time:
Register at Boot Time:
Connect at Boot Time:
Connect at Boot Time:
Modem state:{$CM['generic']['state']} enable
Failure reason:{$CM['generic']['state-failed-reason']}
Modem state:{$CM['generic']['state']} disable
Failure reason:{$CM['generic']['state-failed-reason']}
Current Mode:{$CM['generic']['access-technologies'][0]}
 

+ + +"; + }; +?> +
Network Manager Profiles
Create New Profile
+
Profile Name:Type:UUID:
"; + foreach( $CP['IP4.ADDRESS'] as $A ){ + echo ""; + }; + echo ""; + foreach( $CP['IP4.ROUTE'] as $R ){ + echo ""; + }; + foreach( $CP['IP4.DNS'] as $D ){ + echo ""; + }; + } else { + ?>
Current Status:Active "; + } else { + echo "
Status:Not Active "; + }; + if( $CP['connection.autoconnect']=='yes' ){ + echo "Auto Connect "; + } else { + echo "Auto Connect "; + }; + if( intval( $DP['GENERAL.STATE'] ) == 100 ){ + echo "CONNECTED "; + + echo "
IPv4 Address:{$A}
IPv4 Gateway:{$CP['IP4.GATEWAY']}
IPv4 Route:{$R}
IPv4 DNS:{$D}
NOT CONNECTED
"; + if( $CP['GENERAL.STATE'] == 'activated' ){ + echo ""; + } else { + echo ""; + }; + if( intval( $DP['GENERAL.STATE'] ) == 100 ){ + echo ""; + } else { + echo ""; + }; + echo ""; + ?>
Edit Profile
Disable
Enable
Disconnect
Connect
Delete Profile
Profile Name:Type:UUID:Try Activate
No Network Manager Profile Found!
+ +
+ + + +
Create NetworkManager's New Connection Profile
+ + + + + + + + + +
Connection Profile Name:
Connection Type:
Auto-Connect:
Connection Dial Number:
Connection User:
Connection Password:
Connection APN:
+
"; }; - if( $CM['generic']['state']=='registered' ){ + if( $CM['generic']['state']=='registered' || $CM['generic']['state']=='connected'){ $CMD = "echo \"terrarium\" | sudo -S mmcli -m {$MID} --location-get -J"; $LOFO = json_decode( `$CMD`, true ); $LI = $LOFO['modem']['location']; @@ -1077,7 +1180,7 @@ function print_MODEM_LOCATION_INFO( $MID ){ echo "Lon:{$I['longitude']}"; echo "
"; }; - print_r( $I ); + //print_r( $I ); $GMODE = 'A'; $GFIX = 1; $SATS = array(); @@ -1104,7 +1207,7 @@ function print_MODEM_LOCATION_INFO( $MID ){ }; }; }; - print_r( $SATS ); + //print_r( $SATS ); break; }; }; diff --git a/lib/scripts/sys_utils.php b/lib/scripts/sys_utils.php index 4023dfc..2e532b6 100644 --- a/lib/scripts/sys_utils.php +++ b/lib/scripts/sys_utils.php @@ -1,7 +1,8 @@ 8~'; +$WEB_USER_SUDO_PWD='terrarium'; if( file_exists( '/srv/etc/system.json' ) ){ $SYS_CONFIG = json_decode( file_get_contents( '/srv/etc/system.json' ), true ); @@ -38,18 +39,65 @@ function out_log( $str ){ function run_command( $CMD ){ $FD = @popen( $CMD, "r" ); + $Out = array(); + if( $FD ){ + while (($buffer = fgets( $FD ) ) !== false ){ + //out_log( $buffer ); + $Out[] = $buffer; + }; + if( !feof( $FD ) ){ + out_log( "Error: unexpected fgets() fail" ); + } + pclose($FD); + }; +}; + +function run_root_command( $CMD ){ + $sodo_user_pwd = 'terrarium'; + $EXEC = "echo \"{$sodo_user_pwd}\" | sudo -S {$CMD}"; + $FD = @popen( $EXEC, "r" ); + $Out = array(); if( $FD ){ while (($buffer = fgets( $FD ) ) !== false ){ - out_log( $buffer ); + //out_log( $buffer ); + $Out[] = $buffer; }; if( !feof( $FD ) ){ out_log( "Error: unexpected fgets() fail" ); } pclose($FD); }; + return $Out; }; +function nmcli_list_gsm_connections(){ + $O = run_root_command( "nmcli -c no -s -t connection show" ); + $Out = array(); + foreach( $O as $CL ){ + $T = explode( ':', trim( $CL ) ); + if( $T[2] == 'gsm' ) $Out[]=$T[0]; + }; + return $Out; +}; + +function nmcli_get_connection_info( $CN ){ + $O = run_root_command( "nmcli -c no -s -t connection show {$CN}" ); + $Out = array(); + foreach( $O as $CL ){ + $T = explode( ':', trim( $CL ) ); + $D = explode( '.', $T[0] ); + $Out[$D[0]][$D[1]] = $T[1]; + }; + return $Out; +}; + +function nmcli_create_connection( $name, $type ){ + $O = run_root_command( "nmcli -c no -s -t add con-name \"{$name}\" type {$type} ifname \"*\"" ); +}; + +//sudo nmcli c mod mycon connection.autoconnect yes + function create_cron_task( $TID, $Params = '' ){ if( file_exists( '/srv/etc/cron.json' ) ) return false; @unlink( '/srv/tmp/task_log.var' ); @@ -148,6 +196,7 @@ function sync_time(){ }; + function get_network_config(){ $Data = file_get_contents( '/etc/network/interfaces' ); $TArr = explode("\n", $Data ); @@ -1123,4 +1172,159 @@ function clear_history(){ start_BACKEND_APPLICATION(); }; +function reload_modem_data( $MID ){ + global $SYS_CONFIG; + $MANU = json_decode( `mmcli -m $MID --output-json`, true ); + $LOLO = json_decode( `mmcli -m $MID --location-status --output-json`, true ); + if( isset( $LOLO['modem'] ) ){ + $MANU['modem']['location'] = $LOLO['modem']['location']; + }; + $CD = $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]; + + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID] = $MANU['modem']; + if( isset( $CD['REGISTER_AT_BOOT'] )){ + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['REGISTER_AT_BOOT'] = $CD['REGISTER_AT_BOOT']; + } else $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['REGISTER_AT_BOOT'] = false; + if( isset( $CD['CONNECT_AT_BOOT'] )){ + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CONNECT_AT_BOOT'] = $CD['CONNECT_AT_BOOT']; + } else $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CONNECT_AT_BOOT'] = false; + if( isset( $CD['CUSTOM_APN'] ) ){ + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CUSTOM_APN'] = $CD['CUSTOM_APN']; + } else $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CUSTOM_APN'] = ''; + if( isset( $CD['CUSTOM_APN_USER'] ) ){ + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CUSTOM_APN_USER'] = $CD['CUSTOM_APN_USER']; + } else $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CUSTOM_APN_USER'] = ''; + if( isset( $CD['CUSTOM_APN_PASSWORD'] ) ){ + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CUSTOM_APN_PASSWORD'] = $CD['CUSTOM_APN_PASSWORD']; + } else $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CUSTOM_APN_PASSWORD'] = ''; +}; + +function get_NetworkManager_Profiles(){ + global $WEB_USER_SUDO_PWD; + $CMD = "echo \"{$WEB_USER_SUDO_PWD}\" | sudo -S nmcli -c no -e no -t -s connection"; + $LL = `$CMD`; + $TArr = explode( "\n", $LL ); + $Data = array(); + foreach( $TArr as $T ){ + $ZZ = explode( ':',trim( $T ) ); + if( count( $ZZ ) > 3 ){ + $CC = array(); + $CC['name']=$ZZ[0]; + $CC['uuid']=$ZZ[1]; + $CC['type']=$ZZ[2]; + $CC['device'] = $ZZ[3]; + $CC['managed'] = true; + if( strlen( $CC['device'] ) < 3 ) { + $CC['managed'] = false; + }; + $Data[] = $CC; + }; + }; + return $Data; +}; + +function get_NetworkManager_Device( $DN ){ + global $WEB_USER_SUDO_PWD; + $CMD = "echo \"{$WEB_USER_SUDO_PWD}\" | sudo -S nmcli -c no -e no -t -s device show {$DN}"; + $LL = `$CMD`; + $TArr = explode( "\n", $LL ); + $Data = array(); + foreach( $TArr as $T ){ + $ZZ = explode( ':',trim( $T ) ); + if( strpos( $ZZ[0], '[' ) !== false ){ + $TA = explode( '[', $ZZ[0] ); + if( array_key_exists($TA[0],$Data) ){ + $Data[$TA[0]][]=$ZZ[1]; + } else { + $Data[$TA[0]]=array(); + $Data[$TA[0]][0]=$ZZ[1]; + }; + } else { + $Data[$ZZ[0]] = $ZZ[1]; + }; + }; + return $Data; +}; + +function get_NetworkManager_Connection( $CN ){ + global $WEB_USER_SUDO_PWD; + $CMD = "echo \"{$WEB_USER_SUDO_PWD}\" | sudo -S nmcli -c no -e no -t -s connection show {$CN}"; + $LL = `$CMD`; + $TArr = explode( "\n", $LL ); + $Data = array(); + foreach( $TArr as $T ){ + $ZZ = explode( ':',trim( $T ) ); + if( strpos( $ZZ[0], '[' ) !== false ){ + $TA = explode( '[', $ZZ[0] ); + if( array_key_exists($TA[0],$Data) ){ + $Data[$TA[0]][]=$ZZ[1]; + } else { + $Data[$TA[0]]=array(); + $Data[$TA[0]][0]=$ZZ[1]; + }; + } else { + $Data[$ZZ[0]] = $ZZ[1]; + }; + }; + return $Data; +}; + +function create_NetworkManager_Profile( $type, $name, $add_params='' ){ + global $WEB_USER_SUDO_PWD; + $CMD = "echo \"{$WEB_USER_SUDO_PWD}\" | sudo -S nmcli connection add save yes +connection.type {$type} +connection.id \"{$name}\" "; + if( is_array( $add_params ) ){ + if( count( $add_params ) ){ + foreach( $add_params as $Key=>$Val ){ + $CMD .= "+{$Key} \"{$Value}\" "; + }; + }; + }; + $LL = `$CMD`; + if( strpos( $LL, 'successful' ) !== false ) return true; + return false; +}; + +function delete_NetworkManager_Profile( $name ){ + global $WEB_USER_SUDO_PWD; + $CMD = "echo \"{$WEB_USER_SUDO_PWD}\" | sudo -S nmcli connection down \"{$name}\" "; + $LL = `$CMD`; + if( strpos( $LL, 'successful' ) === false ) return false; + $CMD = "echo \"{$WEB_USER_SUDO_PWD}\" | sudo -S nmcli connection delete \"{$name}\" "; + $LL = `$CMD`; + if( strpos( $LL, 'successful' ) !== false ) return true; + return false; +}; + +function connect_NetworkManager_Device( $dev ){ + global $WEB_USER_SUDO_PWD; + $CMD = "echo \"{$WEB_USER_SUDO_PWD}\" | sudo -S nmcli device connect \"{$dev}\" "; + $LL = `$CMD`; + if( strpos( $LL, 'successful' ) !== false ) return true; + return false; +}; + +function disconnect_NetworkManager_Device( $dev ){ + global $WEB_USER_SUDO_PWD; + $CMD = "echo \"{$WEB_USER_SUDO_PWD}\" | sudo -S nmcli device disconnect \"{$dev}\" "; + $LL = `$CMD`; + if( strpos( $LL, 'successful' ) !== false ) return true; + return false; +}; + +function activate_NetworkManager_Profile( $name ){ + global $WEB_USER_SUDO_PWD; + $CMD = "echo \"{$WEB_USER_SUDO_PWD}\" | sudo -S nmcli connection up \"{$name}\" "; + $LL = `$CMD`; + if( strpos( $LL, 'successful' ) !== false ) return true; + return false; +}; + +function deactivate_NetworkManager_Profile( $name ){ + global $WEB_USER_SUDO_PWD; + $CMD = "echo \"{$WEB_USER_SUDO_PWD}\" | sudo -S nmcli connection down \"{$name}\" "; + $LL = `$CMD`; + if( strpos( $LL, 'successful' ) !== false ) return true; + return false; +}; + ?> \ No newline at end of file diff --git a/lib/scripts/test.php b/lib/scripts/test.php index 98d5038..60034c2 100644 --- a/lib/scripts/test.php +++ b/lib/scripts/test.php @@ -10,6 +10,11 @@ // echo "False!\n"; // }; - apply_application_config( serialize_current_application_config() ); + //apply_application_config( serialize_current_application_config() ); + $CL = nmcli_list_gsm_connections(); + foreach( $CL as $C ){ + $ZZ = nmcli_get_connection_info( $C ); + print_r( $ZZ ); + }; ?> \ No newline at end of file diff --git a/lib/sysroot/srv/etc/boot.php b/lib/sysroot/srv/etc/boot.php index c577d79..f78f098 100644 --- a/lib/sysroot/srv/etc/boot.php +++ b/lib/sysroot/srv/etc/boot.php @@ -22,8 +22,11 @@ $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']; + if( isset( $LOLO['modem'] ) ){ + $MANU['modem']['location'] = $LOLO['modem']['location']; + }; $MANU['modem']['CONNECT_AT_BOOT'] = false; + $MANU['modem']['REGISTER_AT_BOOT'] = false; $MANU['modem']['CUSTOM_APN'] = ''; $MANU['modem']['CUSTOM_APN_USER'] = ''; $MANU['modem']['CUSTOM_APN_PASSWORD'] = ''; @@ -34,6 +37,9 @@ }; } else { foreach( $SYS_CONFIG['MODEM_CONFIG']['DEVICES'] as $MID=>$CD ){ + if( isset( $CD['REGISTER_AT_BOOT'] )){ + $L = `mmcli -m $MID --enable`; + }; if( isset( $CD['CONNECT_AT_BOOT'] )){ // Connect Modem if( $CD['CONNECT_AT_BOOT'] ){ @@ -46,11 +52,19 @@ $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']; + reload_modem_data( $MID ); + //$MANU = json_decode( `mmcli -m $MID --output-json`, true ); + //$LOLO = json_decode( `mmcli -m $MID --location-status --output-json`, true ); + //if( isset( $LOLO['modem'] ) ){ + // $MANU['modem']['location'] = $LOLO['modem']['location']; + //}; + //$SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID] = $MANU['modem']; + //if( isset( $CD['REGISTER_AT_BOOT'] )){ + //$SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['REGISTER_AT_BOOT'] = $CD['REGISTER_AT_BOOT']; + //} else $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['REGISTER_AT_BOOT'] = false; + //if( isset( $CD['CONNECT_AT_BOOT'] )){ + //$SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CONNECT_AT_BOOT'] = $CD['CONNECT_AT_BOOT']; + //} else $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CONNECT_AT_BOOT'] = false; }; }; save_system_config(); diff --git a/lib/sysroot/srv/etc/cron.php b/lib/sysroot/srv/etc/cron.php index d680109..8916c56 100644 --- a/lib/sysroot/srv/etc/cron.php +++ b/lib/sysroot/srv/etc/cron.php @@ -266,10 +266,12 @@ $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']; + //$CMD = "mmcli -m {$CRON_CONFIG['parameter']} --output-json"; + //out_log( $CMD ); + //$MANU = json_decode( `$CMD`, true ); + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$CRON_CONFIG['parameter']]['REGISTER_AT_BOOT']=true; + reload_modem_data( $CRON_CONFIG['parameter'] ); + //$SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$CRON_CONFIG['parameter']]=$MANU['modem']; save_system_config(); break; }; @@ -279,10 +281,53 @@ $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']; + //$CMD = "mmcli -m {$CRON_CONFIG['parameter']} --output-json"; + //out_log( $CMD ); + //$MANU = json_decode( `$CMD`, true ); + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$CRON_CONFIG['parameter']]['REGISTER_AT_BOOT']=false; + reload_modem_data( $CRON_CONFIG['parameter'] ); + //$SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$CRON_CONFIG['parameter']]=$MANU['modem']; + save_system_config(); + break; + }; + case 29:{ + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$CRON_CONFIG['parameter']]['REGISTER_AT_BOOT']=false; + save_system_config(); + break; + }; + case 30:{ + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$CRON_CONFIG['parameter']]['REGISTER_AT_BOOT']=true; + save_system_config(); + break; + }; + case 31:{ + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$CRON_CONFIG['parameter']]['CONNECT_AT_BOOT']=false; + save_system_config(); + break; + }; + case 32:{ + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$CRON_CONFIG['parameter']]['CONNECT_AT_BOOT']=true; + save_system_config(); + break; + }; + case 33:{ + $TArr = explode( ':', $CRON_CONFIG['parameter'] ); + $MID = intval( $TArr[0] ); + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CUSTOM_APN']=$TArr[1]; + save_system_config(); + break; + }; + case 34:{ + $TArr = explode( ':', $CRON_CONFIG['parameter'] ); + $MID = intval( $TArr[0] ); + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CUSTOM_APN_USER']=$TArr[1]; + save_system_config(); + break; + }; + case 35:{ + $TArr = explode( ':', $CRON_CONFIG['parameter'] ); + $MID = intval( $TArr[0] ); + $SYS_CONFIG['MODEM_CONFIG']['DEVICES'][$MID]['CUSTOM_APN_PASSWORD']=$TArr[1]; save_system_config(); break; }; diff --git a/lib/sysroot/srv/etc/system.json b/lib/sysroot/srv/etc/system.json index b70a868..19485b2 100644 --- a/lib/sysroot/srv/etc/system.json +++ b/lib/sysroot/srv/etc/system.json @@ -1 +1 @@ -{"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 +{"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":"home"},"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":["\/org\/freedesktop\/ModemManager1\/Bearer\/0"],"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-4","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)","ttyUSB0 (qcdm)","ttyUSB1 (gps)","ttyUSB2 (at)","ttyUSB3 (at)","ttyUSB4 (audio)","wwan0 (net)"],"power-state":"on","primary-port":"cdc-wdm0","revision":"LE20B04SIM7600M22_210318","signal-quality":{"recent":"yes","value":"89"},"sim":"\/org\/freedesktop\/ModemManager1\/SIM\/0","state":"connected","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)"]},"location":{"capabilities":["3gpp-lac-ci","gps-raw","gps-nmea","gps-unmanaged","agps-msa","agps-msb"],"enabled":["3gpp-lac-ci"],"gps":{"assistance":[],"assistance-servers":[],"refresh-rate":"30","supl-server":"--"},"signals":"no"},"REGISTER_AT_BOOT":false,"CONNECT_AT_BOOT":false,"CUSTOM_APN":"","CUSTOM_APN_USER":"","CUSTOM_APN_PASSWORD":""}]},"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/nm_add.php b/nm_add.php new file mode 100644 index 0000000..0b7a996 --- /dev/null +++ b/nm_add.php @@ -0,0 +1,21 @@ +$CD ){ + reload_modem_data( $ID ); + //$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_NM_ADD_FORM(); + print_PAGE_BOTTOM(); + +?> \ No newline at end of file diff --git a/nm_error.php b/nm_error.php new file mode 100644 index 0000000..16e4ca5 --- /dev/null +++ b/nm_error.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/nm_operation.php b/nm_operation.php new file mode 100644 index 0000000..b956b64 --- /dev/null +++ b/nm_operation.php @@ -0,0 +1,102 @@ + \ No newline at end of file diff --git a/style/style.css b/style/style.css index 9866477..b2d6f96 100644 --- a/style/style.css +++ b/style/style.css @@ -155,4 +155,10 @@ body{ .smal_patch#lte{ color: yellow; background-color: blue; +} +.active_nm_profile{ + border: black 2px solid; +} +.passive_nm_profile{ + border: silver 2px solid; } \ No newline at end of file diff --git a/task_wait.php b/task_wait.php index 514a915..ba644b4 100644 --- a/task_wait.php +++ b/task_wait.php @@ -23,8 +23,15 @@ intval( $_GET['CTSS'] )); break; }; - case 27: $CPARAM = $_GET['MID']; break; - case 28: $CPARAM = $_GET['MID']; break; + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: $CPARAM = $_GET['MID']; break; + case 33: + case 34: + case 35: $CPARAM = $_GET['MID'] .':'. $_GET['AUX']; break; }; if( !create_cron_task( $CTID, $CPARAM ) ){ header('location: /'); diff --git a/wan_cp.php b/wan_cp.php index bbe8492..ddb0373 100644 --- a/wan_cp.php +++ b/wan_cp.php @@ -4,10 +4,11 @@ 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']; + reload_modem_data( $ID ); + //$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(); @@ -15,6 +16,7 @@ print_AUTH_WARNING(); }; print_MODEM_INFO(); + print_NM_PROFILES_INFO(); print_PAGE_BOTTOM(); ?> \ No newline at end of file diff --git a/wan_modem_operation.php b/wan_modem_operation.php index 2bacff9..dbaf6d3 100644 --- a/wan_modem_operation.php +++ b/wan_modem_operation.php @@ -1,4 +1,6 @@