|
@@ -63,6 +63,7 @@ class FindBoxService
|
|
|
|
|
|
|
|
/** @var QueueCommand $qCommand */
|
|
/** @var QueueCommand $qCommand */
|
|
|
$qCommand = $table->getCommandObject();
|
|
$qCommand = $table->getCommandObject();
|
|
|
|
|
+ $eraseRecord = true;
|
|
|
switch ($qCommand->operation) {
|
|
switch ($qCommand->operation) {
|
|
|
case Q_SAVEPRODUCT:
|
|
case Q_SAVEPRODUCT:
|
|
|
$this->saveProduct($qCommand);
|
|
$this->saveProduct($qCommand);
|
|
@@ -72,8 +73,17 @@ class FindBoxService
|
|
|
break;
|
|
break;
|
|
|
case Q_BLINK_OFF:
|
|
case Q_BLINK_OFF:
|
|
|
$this->log2console("BlinkOff for label {$qCommand->id} requested\n");
|
|
$this->log2console("BlinkOff for label {$qCommand->id} requested\n");
|
|
|
|
|
+
|
|
|
$esl = new SmartESL($this->findBoxCore, [$qCommand->id]);
|
|
$esl = new SmartESL($this->findBoxCore, [$qCommand->id]);
|
|
|
- $esl->BlinkOff();
|
|
|
|
|
|
|
+ $err = $esl->BlinkOff();
|
|
|
|
|
+
|
|
|
|
|
+ $labelResponses = $this->findBoxCore->getLabelsFromResponse($err);
|
|
|
|
|
+ if ($labelResponses === NULL) {
|
|
|
|
|
+ $this->log2console("Label {$qCommand->id} fatal error. Removing from queue\n");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $eraseRecord = $labelResponses[$qCommand->id];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
unset($this->labelToBlink[$qCommand->id]);
|
|
unset($this->labelToBlink[$qCommand->id]);
|
|
|
break;
|
|
break;
|
|
|
case Q_DISPLAY:
|
|
case Q_DISPLAY:
|
|
@@ -83,7 +93,10 @@ class FindBoxService
|
|
|
unset($this->labelToBlink[$qCommand->id]);
|
|
unset($this->labelToBlink[$qCommand->id]);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
- $table->erase();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if ($eraseRecord)
|
|
|
|
|
+ $table->erase();
|
|
|
|
|
+
|
|
|
$table->next();
|
|
$table->next();
|
|
|
$this->log2console("Label {$qCommand->id} readed\n");
|
|
$this->log2console("Label {$qCommand->id} readed\n");
|
|
|
}
|
|
}
|
|
@@ -148,8 +161,21 @@ class FindBoxService
|
|
|
$esl = new SmartESL($this->findBoxCore, [$label->id]);
|
|
$esl = new SmartESL($this->findBoxCore, [$label->id]);
|
|
|
$ledParams = $label->params;
|
|
$ledParams = $label->params;
|
|
|
|
|
|
|
|
- $esl->BlinkSpecial($ledParams['pattern'], $ledParams['repeat'], $ledParams['iter_time'], $ledParams['iterations'], $ledParams['color']);
|
|
|
|
|
- $label->tsLastLongBlink = time();
|
|
|
|
|
|
|
+ $err = $esl->BlinkSpecial($ledParams['pattern'], $ledParams['repeat'], $ledParams['iter_time'], $ledParams['iterations'], $ledParams['color']);
|
|
|
|
|
+
|
|
|
|
|
+ $labelResponses = $this->findBoxCore->getLabelsFromResponse($err);
|
|
|
|
|
+ if ($labelResponses === NULL) {
|
|
|
|
|
+ $this->log2console("Label {$label->id} fatal error. Removing from queue\n");
|
|
|
|
|
+ unset($this->labelToBlink[$labelId]);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if ($labelResponses[$label->id])
|
|
|
|
|
+ $label->tsLastLongBlink = time();
|
|
|
|
|
+ else { // Retry to blink to next cycle
|
|
|
|
|
+ $this->log2console("Label {$label->id} blink error. Try next cycle...\n");
|
|
|
|
|
+ $label->tsLastLongBlink = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|