core = $coreL; $this->labels = $LabelID; $this->labelProperties = $this->GetStatus(); } /** * Retrieve cached label properties * * @return null|object */ public function getDetails() { return $this->labelProperties; } /** * Get label version splitted into the three components major, minor, patch * * @return array */ public function GetVersion() { $softVersion = $this->labelProperties[array_keys($this->labelProperties)[0]]['status']; return array_values(array_filter_keys($softVersion, ['soft_major', 'soft_minor', 'soft_patch'])); } /** * Blink the label. If old version found, skip automatically useless parameter * * @param int $pattern * @param int $repeat * @param int $iter_time * @param int $iterations * @param int|null $ledColor */ public function BlinkSpecial(int $pattern, int $repeat, int $iter_time, int $iterations, int $ledColor = null) { $firmwareStringVersion = array( '3' => '1.0.0', '4' => '1.1.0', '6' => '2.0.0' ); $params = array( '3' => array($pattern, $repeat, $iter_time, $iterations, 1), '4' => array($pattern, $repeat, $iter_time, $iterations, 1), '6' => array($pattern, $ledColor, $repeat, $iter_time, $iterations, 1) ); // TODO #NODISPLAY da sistemare $strFWVer = $firmwareStringVersion[4]; $uriParams = json_encode(array_merge( array($this->labels), $params[4])); $URI = "/1.0.0/index.php/smartesl.blink_special/{$strFWVer}/"; $this->core->CallAPI($URI, $uriParams, true); } /** * Turn off led(s) */ 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); } /** * Request to label(s) its properties * @return null|object Details */ public function GetStatus() { $labels = json_encode(array($this->labels)); $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']; } return null; } public function Display(string $templateId, string $barcode) { $URI = "/1.0.0/index.php/smartesl.display/2.3.0/"; $params = json_encode(array( $this->labels[0], $barcode, [], $templateId, 1, 1)); return $this->core->CallAPI($URI, $params); } public function GetLabelMatch() { $URI = "/1.0.0/index.php/smartesl.getlabelmatch/1.2.0/"; return $this->core->CallAPI($URI, json_encode(array($this->labels))); } }