Example #1
0
    echo date('m/d/Y - H:i:s - ', time()) . 'HUAWEIMA5600 - ' . $msg . "\n";
    return;
}
try {
    /* Instantiate devices. */
    $connsCount = count($conns);
    $devices = array();
    for ($i = 0; $i < $connsCount; $i++) {
        $devices[] = new MDMHUAWEIMA5600($argv[1], (int) $argv[2], $conns[$i], $tgts[$i], 'user', 'pass', SCHEMA);
    }
    /* Do. */
    myLog('Start.');
    $cmdCount = count($cmds);
    for ($j = 0; $j < $connsCount; $j++) {
        for ($i = 0; $i < $cmdCount; $i++) {
            myLog($descs[$i] . ' ' . ($args[$i] != null ? $args[$i] : '') . ' ' . '(' . intval($i) . ') ' . MDMDevice::getConnectionName($conns[$j]));
            $device = $devices[$j];
            if (USE_SERVER) {
                $device->exec((int) $argv[3], (int) $argv[4], $cmds[$i], 300000, 300000, $args[$i]);
                $resultCode = $device->getResponseCode();
                $resultMsg = $device->getResponseMessage();
                myLog($device->getRawResponse());
                if ($resultCode != 0) {
                    throw new Exception('Command failed: ' . $resultCode . ': ' . $resultMsg);
                }
                if ($responses[$i] != null) {
                    myLog(print_r($device->{$responses}[$i](), true));
                }
            } else {
                $output = array();
                $ret = 0;