Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1aee7cdc02 |
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Paper\InteractiveMenu;
|
||||
use App\Paper\Paper;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -18,6 +19,14 @@ class Keyboard extends Controller
|
||||
|
||||
$keyboardAction = explode('_', $keyboardData->action);
|
||||
|
||||
$redis = new \Redis();
|
||||
$redis->connect('127.0.0.1', 6379);
|
||||
if($keyboardAction[0] == 'interactivemenu' || $redis->get('interactivemenu')){
|
||||
$interactiveMenu = new InteractiveMenu();
|
||||
$interactiveMenu->pressed($key);
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($keyboardAction[0]) {
|
||||
case 'settings':
|
||||
$settings = new Settings();
|
||||
|
||||
@@ -76,6 +76,9 @@ class Settings extends Controller
|
||||
$actions['settings_list'] = 'Lista zmapowanych klawiszy';
|
||||
|
||||
$actions['separator1'] = 'separator';
|
||||
$actions['interactivemenu'] = 'Interaktywne menu';
|
||||
|
||||
$actions['separator2'] = 'separator';
|
||||
|
||||
$actions['repertoire_all_today'] = 'Repertuar wszystkie kina dzisiaj';
|
||||
$actions['repertoire_all_tomorrow'] = 'Repertuar wszystkie kina jutro';
|
||||
@@ -92,7 +95,7 @@ class Settings extends Controller
|
||||
$actions['repertoire_gdynskiecentrumfilmowe_today'] = 'Repertuar Gdyńskie Centrum filmowe dzisiaj';
|
||||
$actions['repertoire_gdynskiecentrumfilmowe_tomorrow'] = 'Repertuar Gdyńskie Centrum filmowe jutro';
|
||||
|
||||
$actions['separator2'] = 'separator';
|
||||
$actions['separator3'] = 'separator';
|
||||
$actions['airly_all'] = 'Airly wszystkie stacje';
|
||||
$actions['airly_rzeczypospolitej'] = 'Airly (Rzeczypospolitej)';
|
||||
$actions['airly_grunwaldzka'] = 'Airly (Grunwaldzka)';
|
||||
@@ -103,11 +106,11 @@ class Settings extends Controller
|
||||
// $actions['spacex_prev_flight'] = 'Poprzedni lot SpaceX';
|
||||
// $actions['spacex_all_next_summary'] = 'Wszystkie zaplanowane loty SpaceX (skrót)';
|
||||
|
||||
$actions['separator4'] = 'separator';
|
||||
$actions['separator5'] = 'separator';
|
||||
$actions['note_last'] = 'Ostatnia zapisana notatka';
|
||||
|
||||
|
||||
$actions['separator5'] = 'separator';
|
||||
$actions['separator6'] = 'separator';
|
||||
|
||||
$notes = DB::select('SELECT * FROM note WHERE type = "note" ORDER BY updated_at DESC');
|
||||
foreach ($notes as $note) {
|
||||
|
||||
42
app/Paper/InteractiveMenu.php
Normal file
42
app/Paper/InteractiveMenu.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Paper;
|
||||
|
||||
|
||||
class InteractiveMenu
|
||||
{
|
||||
|
||||
private $apiKey;
|
||||
|
||||
private $paper;
|
||||
|
||||
private $redis;
|
||||
|
||||
private $structure = [
|
||||
0 =>
|
||||
[
|
||||
'title' => 'tytuł pierwszego menu',
|
||||
1 => ['name' => 'to jest podtytuł pierwszego menu', 'action' => '', 'type' => 'output'],
|
||||
2 => ['name' => 'to jest podtytuł drugiego menu', 'action' => '', 'type' => 'input'],
|
||||
3 => ['name' => 'to jest podtytuł trzeciego menu', 'action' => '', 'type' => 'outputandinput'],
|
||||
4 => ['name' => 'to jest podtytuł czwartego menu', 'action' => '', 'type' => 'inputandoutput'],
|
||||
]
|
||||
];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->paper = new Paper();
|
||||
$this->redis = new \Redis();
|
||||
$this->redis->connect('127.0.0.1', 6379);
|
||||
$this->redis->setex('interactivemenu', 10, 1);
|
||||
}
|
||||
|
||||
public function pressed($key)
|
||||
{
|
||||
$this->paper->sendPrint($key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user