clrghouz/app/Console/Commands/EMSISend.php

49 lines
944 B
PHP
Raw Normal View History

2021-04-01 10:59:15 +00:00
<?php
namespace App\Console\Commands;
use App\Models\Node;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
use App\Classes\Sock\SocketClient;
use App\Classes\Protocol\EMSI as EMSIClass;
class EMSISend extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'emsi:send {ftn : FTN to Send to}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'EMSI send';
/**
* Execute the console command.
*
* @return mixed
* @throws \App\Classes\Sock\SocketException
*/
public function handle()
{
Log::info('Call EMSI send');
$no = Node::findFTN($this->argument('ftn'));
$client = SocketClient::create($no->address,$no->port,38400);
$o = new EMSIClass;
$o->session(EMSIClass::SESSION_AUTO,$client,$no);
Log::info(sprintf('Connection ended: %s',$client->getAddress()),['m'=>__METHOD__]);
}
}