Skip to content

Commit

Permalink
Cmd: zigates cmds rename
Browse files Browse the repository at this point in the history
  • Loading branch information
tcharp38 committed Aug 21, 2023
1 parent bd7a27b commit f186b19
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 26 deletions.
12 changes: 6 additions & 6 deletions core/class/AbeilleCmdProcess.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2538,7 +2538,7 @@ function processCmd($Command) {
}

// Zigate specific command
else if (($cmdName == 'zgSetPermitMode') || ($cmdName == 'setZgPermitMode')) {
else if ($cmdName == 'zgSetPermitMode') {
$mode = $Command['mode'];
if ($mode == "start") {
$cmd = "0049";
Expand Down Expand Up @@ -2618,7 +2618,7 @@ function processCmd($Command) {
}

// Zigate specific command: Requests FW version
else if (($cmdName == 'zgGetVersion') || ($cmdName == 'getZgVersion') || ($cmdName == 'getVersion')) {
else if ($cmdName == 'zgGetVersion') {
$this->addCmdToQueue2(PRIO_NORM, $dest, "0010");
return;
}
Expand All @@ -2630,12 +2630,12 @@ function processCmd($Command) {
}

// Zigate specific command: Set Time server (v3.0f)
else if (($cmdName == 'zgSetTimeServer') || ($cmdName == 'setZgTimeServer') || ($cmdName == 'setTimeServer')) {
else if ($cmdName == 'zgSetTimeServer') {
if (!isset($Command['time'])) {
$zgRef = mktime(0, 0, 0, 1, 1, 2000); // 2000-01-01 00:00:00
$Command['time'] = time() - $zgRef;
}
cmdLog('debug', " setZgTimeServer, time=".$Command['time'], $this->debug['processCmd']);
cmdLog('debug', " zgSetTimeServer, time=".$Command['time'], $this->debug['processCmd']);

/* Cmd 0016 reminder
payload = <timestamp UTC: uint32_t> from 2000-01-01 00:00:00
Expand All @@ -2648,7 +2648,7 @@ function processCmd($Command) {
}

// Zigate specific command
else if (($cmdName == 'zgGetTimeServer') || ($cmdName == 'getZgTimeServer') || ($cmdName == 'getTimeServer')) {
else if ($cmdName == 'zgGetTimeServer') {
// $data = "";
// $length = sprintf("%04s", dechex(strlen($data) / 2));
$this->addCmdToQueue2(PRIO_NORM, $dest, "0017");
Expand All @@ -2666,7 +2666,7 @@ function processCmd($Command) {
}

// Zigate specific command
else if (($cmdName == 'zgStartNetwork') || ($cmdName == 'startZgNetwork')) {
else if ($cmdName == 'zgStartNetwork') {
$this->addCmdToQueue2(PRIO_NORM, $dest, "0024");
return;
}
Expand Down
4 changes: 2 additions & 2 deletions core/php/AbeilleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,13 @@ function cmdLog($loglevel = 'NONE', $message = "", $isEnable = 1) {

if ($test==132) {
echo "Set Time to Zigate\n";
$msg['topic'] = 'CmdAbeille' . $argv[2] . '/0000/setZgTimeServer';
$msg['topic'] = 'CmdAbeille' . $argv[2] . '/0000/zgSetTimeServer';
$msg['payload'] = '';
}

if ($test==133) {
echo "Get Time from Zigate\n";
$msg['topic'] = 'CmdAbeille' . $argv[2] . '/0000/getZgTimeServer';
$msg['topic'] = 'CmdAbeille' . $argv[2] . '/0000/zgGetTimeServer';
$msg['payload'] = '';
}

Expand Down
4 changes: 2 additions & 2 deletions desktop/js/Abeille.js
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ function sendToCmd(action, param1 = "", param2 = "", param3 = "", param4 = "") {
case "startPermitJoin":
zgId = param1;
sendCmd(
"CmdAbeille" + zgId + "/0000/setZgPermitMode",
"CmdAbeille" + zgId + "/0000/zgSetPermitMode",
"mode=start"
);
location.reload(true);
Expand All @@ -1391,7 +1391,7 @@ function sendToCmd(action, param1 = "", param2 = "", param3 = "", param4 = "") {
break;
case "stopPermitJoin":
zgId = param1;
sendCmd("CmdAbeille" + zgId + "/0000/setZgPermitMode", "mode=stop");
sendCmd("CmdAbeille" + zgId + "/0000/zgSetPermitMode", "mode=stop");
location.reload(true);
$("#div_alert").showAlert({
message:
Expand Down
16 changes: 0 additions & 16 deletions desktop/php/AbeilleFormAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,22 +166,6 @@ function sendMessageFromFormToCmd($topic, $payload) {
}
}

// Set Time
foreach ( $zigateIds as $zigateId ) {
if ( $_POST['submitButton'] == 'SetTime Z'.$zigateId ) {
echo "SetTime request processing";
sendMessageFromFormToCmd('CmdAbeille'.$zigateId.'/0000/setZgTimeServer', "time=".time() );
}
}

// Get Time
foreach ( $zigateIds as $zigateId ) {
if ( $_POST['submitButton'] == 'getTime Z'.$zigateId ) {
echo "getTime request processing";
sendMessageFromFormToCmd('CmdAbeille'.$zigateId.'/0000/getZgTimeServer', "");
}
}

// Set Certification CE
foreach ( $zigateIds as $zigateId ) {
if ( $_POST['submitButton'] == 'Set Certification CE Z'.$zigateId ) {
Expand Down

0 comments on commit f186b19

Please sign in to comment.