2021-04-01 10:59:15 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
use App\Classes\Protocol;
|
|
|
|
use App\Classes\Protocol\Zmodem as ZmodemClass;
|
2022-06-26 14:14:36 +00:00
|
|
|
use App\Classes\Sock\SocketClient;
|
2021-04-01 10:59:15 +00:00
|
|
|
|
2022-06-26 14:14:36 +00:00
|
|
|
class CommZmodemSend extends Command
|
2021-04-01 10:59:15 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2022-06-26 14:14:36 +00:00
|
|
|
protected $signature = 'comm:zmodem:send {ip}';
|
2021-04-01 10:59:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = 'ZMODEM send';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
Log::info('Call ZMODEM send');
|
|
|
|
|
|
|
|
[$address,$service_port] = explode(':',$this->argument('ip'),2);
|
|
|
|
$client = SocketClient::create($address,$service_port);
|
|
|
|
|
|
|
|
$o = new ZmodemClass;
|
|
|
|
$o->session(Protocol::SESSION_ZMODEM,$client);
|
|
|
|
|
2021-07-23 14:53:35 +00:00
|
|
|
Log::info(sprintf('Connection ended: %s',$client->address_remote),['m'=>__METHOD__]);
|
2021-04-01 10:59:15 +00:00
|
|
|
}
|
|
|
|
}
|