Ejemplo n.º 1
0
 public function __construct($startAt = 0, $width = 1, array $wights = [1])
 {
     if ($width <= 0 || count($wights) === 0) {
         throw new \InvalidArgumentException("wdith has to be greater than 0");
     }
     $this->startAt = $startAt;
     $this->width = $width;
     $this->wights = $wights;
     Logger::getInstance("singal.ramp")->debug("created: " . $startAt . ":" . $width . ":[" . implode(",", $wights) . "]");
 }
Ejemplo n.º 2
0
 function run()
 {
     foreach ($this->devices as $device) {
         $device->reset();
         $this->dmx->send();
     }
     foreach ($this->devices as $device) {
         if ($device instanceof Spot) {
             $device->addSignal(new Rectangel(0, 0.1, [1, 1, 1, 0, 0]));
         }
         if ($device instanceof Scanner) {
             $device->addSignal(new Rectangel(0, 0.1, [1, 1, 1, 0, 1]));
         }
     }
     $this->devices[0]->addSignal(new Ramp(0, 3, [0, 0, 1, 0, 0]));
     $this->devices[4]->addSignal(new Ramp(0, 3, [0, 0, 1, 0, 0]));
     $this->devices[1]->addSignal(new Ramp(2.5, 3, [0, 1, 0, 0, 0]));
     $this->devices[3]->addSignal(new Ramp(2.5, 3, [0, 1, 0, 0, 0]));
     $this->devices[2]->addSignal(new Ramp(5, 3, [1, 0, 0, 0, 0]));
     foreach ($this->devices as $spot) {
         $spot->addSignal(new Rectangel(8, 0.1, [1, 1, 1, 0, 0]));
         $spot->addSignal(new Random(8, 7, [1, 1, 1, 0, 0]));
     }
     $this->devices[0]->addSignal(new Ramp(15, 3, [0, 0, 1, 0, 0]));
     $this->devices[1]->addSignal(new Rectangel(15, 3, [0, 1, 0, 0, 0]));
     $this->devices[2]->addSignal(new Rectangel(15, 3, [1, 0, 0, 0, 0]));
     $this->devices[3]->addSignal(new Rectangel(15, 3, [0, 1, 0, 0, 0]));
     $this->devices[4]->addSignal(new Ramp(15, 3, [0, 0, 1, 0, 0]));
     $this->devices[0]->addSignal(new Rectangel(18, 0.5, [0, 0, 1, 0, 0]));
     $this->devices[1]->addSignal(new Rectangel(18.5, 0.5, [0, 1, 0, 0, 0]));
     $this->devices[2]->addSignal(new Rectangel(19, 0.5, [1, 0, 0, 0, 0]));
     $this->devices[3]->addSignal(new Rectangel(19.5, 0.5, [0, 1, 0, 0, 0]));
     $this->devices[4]->addSignal(new Rectangel(20, 0.5, [0, 0, 1, 0, 0]));
     $this->devices[4]->addSignal(new Rectangel(20, 0.5, [0, 0, 1, 0, 0]));
     $this->devices[3]->addSignal(new Rectangel(21, 0.5, [0, 1, 0, 0, 0]));
     $this->devices[2]->addSignal(new Rectangel(21.5, 0.5, [1, 0, 0, 0, 0]));
     $this->devices[1]->addSignal(new Rectangel(22, 0.5, [0, 1, 0, 0, 0]));
     $this->devices[0]->addSignal(new Rectangel(22.5, 0.5, [0, 0, 1, 0, 0]));
     foreach ($this->devices as $spot) {
         $spot->addSignal(new Random(23, 7, [1, 1, 1, 0, 0]));
     }
     $start = 0;
     $time = $start;
     while (1) {
         Logger::getInstance("prog.advanced")->debug("time: " . $time);
         $this->dmx->calcAll($time);
         $this->dmx->send();
         usleep(100000);
         $time += 0.1;
         if ($time > 30) {
             $time = $start;
         }
     }
 }
Ejemplo n.º 3
0
 function transmit()
 {
     if ($this->oldStatus === $this->status) {
         return;
     }
     foreach ($this->status as $channel => $value) {
         if (!isset($this->oldStatus[$channel]) || $this->oldStatus[$channel] !== $this->status[$channel]) {
             $data = "CH|{$channel}|{$value}";
             Logger::getInstance()->debug($data, ["ws"]);
             $this->ws->send($data);
         }
     }
     $this->oldStatus = $this->status;
 }
Ejemplo n.º 4
0
 function transmit()
 {
     Logger::getInstance("dmx.http")->debug("prepare send");
     $url = str_replace("&amp;", "&", urldecode(trim("http://151.217.14.79:9090/set_dmx")));
     $data = array('u' => '1', 'd' => implode(",", $this->status));
     if ($this->data_old === $data) {
         return;
     }
     $this->data_old = $data;
     curl_setopt($this->curl, CURLOPT_URL, $url);
     curl_setopt($this->curl, CURLOPT_HTTPHEADER, array('Connection: Keep-Alive', 'Keep-Alive: 300'));
     curl_setopt($this->curl, CURLOPT_POST, true);
     curl_setopt($this->curl, CURLOPT_POSTFIELDS, $data);
     Logger::getInstance("dmx.http")->debug("send", [$data]);
     curl_exec($this->curl);
 }