add card status command
[linksys-wrt3g-tools.git] / scripts / linksys-wrt3g.php
index e9279e3d464b0317071c10d77a7a99669acf55e8..f47502523af8deb09809ed58a9f456892be33802 100755 (executable)
@@ -72,13 +72,22 @@ $parser->addOption(
     )
 );
 
-$parser->addCommand(
+$stCmd = $parser->addCommand(
     'status',
     array(
         'aliases'     => array('s', 'st'),
         'description' => 'Show the router status'
     )
 );
+$stCmd = $parser->addCommand(
+    'cardstatus',
+    array(
+        'aliases'     => array('c', 'cs'),
+        'description' => 'Show the card/SIM status'
+    )
+);
+
+
 $parser->addCommand(
     'reboot',
     array(
@@ -101,6 +110,8 @@ try {
     $router->user      = $result->options['user'];
     $router->password  = $result->options['password'];
 
+    $router->log('Command: ' . $result->command_name, 2);
+
     switch ($result->command_name) {
     case 'reboot':
         $resp = $router->reboot();
@@ -110,9 +121,14 @@ try {
         }
         break;
 
+    case 'cardstatus':
     case 'status':
     default:
-        $arStatus = $router->getStatus();
+        if ($result->command_name == 'cardstatus') {
+            $arStatus = $router->getCardStatus();
+        } else {
+            $arStatus = $router->getStatus();
+        }
         foreach ($arStatus as $key => $value) {
             echo $key . ': ' . $value . "\n";
         }