|
|
@@ -16,7 +16,7 @@ class SmartESL
|
|
|
public function __construct(FindBoxCoreSystem $coreL, array $LabelID)
|
|
|
{
|
|
|
$this->core = $coreL;
|
|
|
- $this->labels = $LabelID;
|
|
|
+ $this->labels = array_map('strtoupper', $LabelID);
|
|
|
// TODO utilizzare la $Cache di F3 per velocizzare le operazioni
|
|
|
$this->labelProperties = $this->GetStatus();
|
|
|
}
|
|
|
@@ -31,7 +31,9 @@ class SmartESL
|
|
|
$URI = "/1.0.0/index.php/smartesl.getstatus/3.1.0/";
|
|
|
$ret = $this->core->CallAPI($URI, $labels);
|
|
|
if ($ret['err'] == 0 && $ret['value']['code'] == 0) {
|
|
|
- return $ret['value']['value'];
|
|
|
+ // Update current properties
|
|
|
+ $this->labelProperties = $ret['value']['value'];
|
|
|
+ return $this->labelProperties;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
@@ -57,8 +59,13 @@ class SmartESL
|
|
|
return array_values(array_filter_keys($softVersion, ['soft_major', 'soft_minor', 'soft_patch']));
|
|
|
}
|
|
|
|
|
|
+ public function getData()
|
|
|
+ {
|
|
|
+ return $this->labelProperties[$this->labels[0]]['data'];
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
- * Blink the label. If old version found, skip automatically useless parameter
|
|
|
+ * Blink the label with parameters. BlinkSpecial make use of getData() and check how many leds has to auto select the firmware version.
|
|
|
*
|
|
|
* @param int $pattern
|
|
|
* @param int $repeat
|
|
|
@@ -68,6 +75,18 @@ class SmartESL
|
|
|
*/
|
|
|
public function BlinkSpecial(int $pattern, int $repeat, int $iter_time, int $iterations, int $ledColor = null)
|
|
|
{
|
|
|
+ $numLeds = $this->getData()['led'];
|
|
|
+ switch ($numLeds) {
|
|
|
+ case 2:
|
|
|
+ $version = 4;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ $version = 6;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $version = 3;
|
|
|
+ break;
|
|
|
+ }
|
|
|
$firmwareStringVersion = array(
|
|
|
'3' => '1.0.0',
|
|
|
'4' => '1.1.0',
|
|
|
@@ -82,11 +101,11 @@ class SmartESL
|
|
|
);
|
|
|
|
|
|
// TODO #NODISPLAY da sistemare
|
|
|
- $strFWVer = $firmwareStringVersion[4];
|
|
|
+ $strFWVer = $firmwareStringVersion[$version];
|
|
|
|
|
|
$uriParams = json_encode(array_merge(
|
|
|
array($this->labels),
|
|
|
- $params[4]));
|
|
|
+ $params[$version]));
|
|
|
|
|
|
$URI = "/1.0.0/index.php/smartesl.blink_special/{$strFWVer}/";
|
|
|
$this->core->CallAPI($URI, $uriParams, true);
|
|
|
@@ -97,10 +116,8 @@ class SmartESL
|
|
|
*/
|
|
|
public function BlinkOff()
|
|
|
{
|
|
|
- $URI = "/1.0.0/index.php/smartesl.blink_special/1.1.0/";
|
|
|
- $this->core->CallAPI($URI, "[[\"{$this->labels[0]}\"],3,1,500,1,1]", true);
|
|
|
-// $URI = "/1.0.0/index.php/smartesl.blink_special/2.0.0/";
|
|
|
-// $this->core->CallAPI($URI, "[[\"{$this->labels[0]}\"],0,1,1,500,1,1]", true);
|
|
|
+ $URI = "/1.0.0/index.php/smartesl.blink_special/2.0.0/";
|
|
|
+ $this->core->CallAPI($URI, "[[\"{$this->labels[0]}\"],0,0,0,0,0,1]", true);
|
|
|
}
|
|
|
|
|
|
public function Display(string $templateId, string $barcode)
|