Skip to content

Commit

Permalink
Version 1.03:
Browse files Browse the repository at this point in the history
 - Node-Instanz hat die Rückmeldung von COMMAND_SEND_CFM und STATUS_REQUEST_CFM falsch ausgewertet.
 - Neue Scenen-Instanzen werden im Konfigurator angezeigt.
  • Loading branch information
Nall-chan committed Jan 18, 2024
1 parent 0e6a97b commit f048c77
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 35 deletions.
3 changes: 2 additions & 1 deletion KLF200Configurator/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ public function RemoveNode(int $Node)
return true;
}

//todo scenes
public function GetConfigurationForm()
{
$Form = json_decode(file_get_contents(__DIR__ . '/form.json'), true);
Expand All @@ -164,6 +163,8 @@ public function GetConfigurationForm()
$Form['actions'][2]['popup']['items'][0]['caption'] = 'Splitter has no IO instance.';
} else {
$NodeValues = $this->GetNodeConfigFormValues($Splitter);
$SceneValues = $this->GetSceneConfigFormValues($Splitter);
$NodeValues = array_merge($NodeValues, $SceneValues);
}
}
$Form['actions'][1]['values'] = $NodeValues;
Expand Down
4 changes: 2 additions & 2 deletions KLF200Gateway/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ private function GetAllNodesInformation()
if ($ResultAPIData->isError()) {
return false;
}
return ord($ResultAPIData->Data[0]) == 1;
return ord($ResultAPIData->Data[0]) == \KLF200\Status::REQUEST_ACCEPTED;
}

private function SetHouseStatusMonitor()
Expand Down Expand Up @@ -476,7 +476,7 @@ private function Connect()
trigger_error($this->Translate($ResultAPIData->ErrorToString()), E_USER_NOTICE);
return false;
}
if ($ResultAPIData->Data != "\x00") {
if (ord($ResultAPIData->Data[0]) != \KLF200\Status::REQUEST_ACCEPTED) {
$this->SendDebug('Login Error', '', 0);
$this->SetStatus(IS_EBASE + 1);
$this->LogMessage('Access denied', KL_ERROR);
Expand Down
2 changes: 1 addition & 1 deletion KLF200Node/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"Request accepted": "Anfrage angenommen",
"Invalid Parameters": "Ungültige Parameter",
"Request rejected": "Anfrage abgelehnt",
"Invalid node index": "Ungültiger Node-Eintrag",
"Invalid system table index": "Ungültiger Systemtabellenindex",
"Instance has no active parent.": "Instanz hat keinen aktiven Parent.",
"This module is free for non-commercial use,\r\nDonations in support of the author are accepted here:": "Dieses Modul ist für die nicht kommerzielle Nutzung kostenlos,\r\nSchenkungen als Unterstützung für den Autor werden hier akzeptiert:"
}
Expand Down
29 changes: 11 additions & 18 deletions KLF200Node/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,12 @@ public function RequestNodeInformation()
if ($ResultAPIData === null) {
return false;
}
$State = ord($ResultAPIData->Data[0]);
switch ($State) {
case 0:
return true;
case 1:
trigger_error($this->Translate('Request rejected'), E_USER_NOTICE);
return false;
case 2:
trigger_error($this->Translate('Invalid node index'), E_USER_NOTICE);
return false;
$ResultStatus = ord($ResultAPIData->Data[0]);
if ($ResultStatus == \KLF200\Status::REQUEST_ACCEPTED) {
return true;
}
trigger_error($this->Translate(\KLF200\Status::ToString($ResultStatus * 2)), E_USER_NOTICE);
return false;
}

public function RequestStatus()
Expand Down Expand Up @@ -902,14 +897,11 @@ private function SendAPIData(\KLF200\APIData $APIData, int $SessionId = -1)
if ($SessionId == -1) {
return $ResponseAPIData;
}
$ResultStatus = ord($ResponseAPIData->Data[0]);
switch ($ResultStatus) {
case \KLF200\Status::INVALID_PARAMETERS:
case \KLF200\Status::REQUEST_REJECTED:
$this->SessionQueueRemove($SessionId);
trigger_error($this->Translate(\KLF200\State::ToString($ResultStatus)), E_USER_NOTICE);
return false;
break;
$ResultStatus = ord($ResponseAPIData->Data[2]); //CommandStatus
if ($ResultStatus == \KLF200\CommandStatus::COMMAND_REJECTED) {
$this->SessionQueueRemove($SessionId);
trigger_error($this->Translate(\KLF200\Status::ToString($ResultStatus)), E_USER_NOTICE);
return false;
}
if (!$this->ReadPropertyBoolean(\KLF200\Node\Property::WaitForFinishSession)) {
return true;
Expand All @@ -926,6 +918,7 @@ private function SendAPIData(\KLF200\APIData $APIData, int $SessionId = -1)
return null;
}
}

//################# SessionQueue
private function SessionQueueAdd(int $SessionId)
{
Expand Down
4 changes: 2 additions & 2 deletions KLF200Scene/locale.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
"Instance does not implement this function": "Instanz unterstützt diese Funktion nicht",
"Invalid Ident": "Ungültiger Ident",
"Request accepted": "Anfrage angenommen",
"Invalid Parameters": "Ungültige Parameter",
"Invalid parameters": "Ungültige Parameter",
"Request rejected": "Anfrage abgelehnt",
"Invalid scene index": "Ungültiger Szenen-Eintrag",
"Invalid system table index": "Ungültiger Systemtabellenindex",
"Instance has no active parent.": "Instanz hat keinen aktiven Parent.",
"This module is free for non-commercial use,\r\nDonations in support of the author are accepted here:": "Dieses Modul ist für die nicht kommerzielle Nutzung kostenlos,\r\nSchenkungen als Unterstützung für den Autor werden hier akzeptiert:"
}
Expand Down
10 changes: 3 additions & 7 deletions KLF200Scene/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,9 @@ private function SendAPIData(\KLF200\APIData $APIData, int $SessionId = -1)
if ($SessionId == -1) {
return $ResponseAPIData;
}
$ResultStatus = ord($ResponseAPIData->Data[0]);
switch ($ResultStatus) {
case \KLF200\Status::INVALID_PARAMETERS:
case \KLF200\Status::REQUEST_REJECTED:
trigger_error($this->Translate(\KLF200\Status::ToString($ResultStatus)), E_USER_NOTICE);
return false;
break;
$ResultStatus = ord($ResponseAPIData->Data[0]); //Status
if ($ResultStatus != \KLF200\Status::REQUEST_ACCEPTED) {
trigger_error($this->Translate(\KLF200\Status::ToString($ResultStatus)), E_USER_NOTICE);
}
return true;
} catch (Exception $exc) {
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ Es wird empfohlen die Einrichtung mit der Discovery-Instanz zu starten ([KLF200

### 2. Changelog

Version 1.03:
- Node-Instanz hat die Rückmeldung von COMMAND_SEND_CFM und STATUS_REQUEST_CFM falsch ausgewertet.
- Neue Scenen-Instanzen werden im Konfigurator angezeigt.

Version 1.02:
- Timeout auf 10 Sekunden erhöht.
- Neue Scenen-Instanz.
Expand Down
6 changes: 3 additions & 3 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"compatibility": {
"version": "6.0"
},
"version": "1.00",
"build": 102,
"date": 1705389031
"version": "1.03",
"build": 103,
"date": 1705605140
}
20 changes: 19 additions & 1 deletion libs/KLF200Class.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,39 @@ public static function ToString(int $State)
}
}

class CommandStatus
{
public const COMMAND_REJECTED = 0;
public const COMMAND_ACCEPTED = 1;

public static function ToString(int $Status)
{
switch ($Status) {
case self::COMMAND_REJECTED:
return 'Command is rejected';
case self::COMMAND_ACCEPTED:
return 'Command is accepted';
}
}
}
class Status
{
public const REQUEST_ACCEPTED = 0;
public const INVALID_PARAMETERS = 1;
public const REQUEST_REJECTED = 2;
public const INVALID_SYSTEM_TABLE_INDEX = 4; // factor 2

public static function ToString(int $Status)
{
switch ($Status) {
case self::REQUEST_ACCEPTED:
return 'Request accepted';
case self::INVALID_PARAMETERS:
return 'Invalid Parameters';
return 'Invalid parameters';
case self::REQUEST_REJECTED:
return 'Request rejected';
case self::INVALID_SYSTEM_TABLE_INDEX:
return 'Invalid system table index';
}
}
}
Expand Down

0 comments on commit f048c77

Please sign in to comment.