Skip to content

Commit

Permalink
Parser: fix for attrib reporting with private section
Browse files Browse the repository at this point in the history
  • Loading branch information
tcharp38 committed Nov 26, 2024
1 parent 15d7ade commit 34970db
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
44 changes: 26 additions & 18 deletions core/class/AbeilleParser.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3562,26 +3562,34 @@ function decode8002($dest, $payload, $lqi) {
$attrId = $attr['id'];

// Is this an attribute to handle as 'private' ?
unset($private); // Clear in case it is set by previous attribute
// parserLog('debug', 'LA eq='.json_encode($eq));
if (isset($eq['private'])) {
// parserLog('debug', " Model with 'private' entry");
foreach ($eq['private'] as $pKey => $pVal) {
$pKeyLen = strlen($pKey);
// parserLog2('debug', $srcAddr, " clustId/attrId={$clustId}/{$attrId} vs pKey={$pKey}, len={$pKeyLen}");
if ((($pKeyLen == 4) && ($pKey != $clustId)) || // 'CCCC' (clustId) case
(($pKeyLen == 9) && ($pKey != $clustId.'-'.$attrId))) // 'CCCC-AAAA (clustId-attrId) case
continue;

$private = $pVal;
parserLog2('debug', $srcAddr, " Private=".json_encode($private, JSON_UNESCAPED_SLASHES));
break;
}
}
// unset($private); // Clear in case it is set by previous attribute
// // parserLog('debug', 'LA eq='.json_encode($eq));
// if (isset($eq['private'])) {
// // parserLog('debug', " Model with 'private' entry");
// foreach ($eq['private'] as $pKey => $pVal) {
// $pKeyLen = strlen($pKey);
// // parserLog2('debug', $srcAddr, " clustId/attrId={$clustId}/{$attrId} vs pKey={$pKey}, len={$pKeyLen}");
// if ((($pKeyLen == 4) && ($pKey != $clustId)) || // 'CCCC' (clustId) case
// (($pKeyLen == 9) && ($pKey != $clustId.'-'.$attrId))) // 'CCCC-AAAA (clustId-attrId) case
// continue;

// $private = $pVal;
// parserLog2('debug', $srcAddr, " Private=".json_encode($private, JSON_UNESCAPED_SLASHES));
// break;
// }
// }

// Handling attribute
if (isset($private)) {
// parserLog('debug', " This cluster/attrib must be handled as private");
// if (isset($private)) {
// // parserLog('debug', " This cluster/attrib must be handled as private");
// if ($private['type'] == "xiaomi") {
// xiaomiReportAttribute($dest, $srcAddr, $clustId, $attr, $attrReportN);
// } else {
// parserLog2("error", $srcAddr, " Ouahh... missing code to handle private cluster");
// }
// }
if (isset($eq['private']) && isset($eq['private']["$clustId-$attrId"])) {
if ($private['type'] == "xiaomi") {
xiaomiReportAttribute($dest, $srcAddr, $clustId, $attr, $attrReportN);
} else {
Expand Down
1 change: 1 addition & 0 deletions docs/fr_FR/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ChangeLog

- Correction: Commande 'Identify'.
- Correction: Parser: Support section 'private' pour 'attribut report'.

## 241120-BETA-1

Expand Down

0 comments on commit 34970db

Please sign in to comment.