Firmware Updater (Backend + GUI)

This commit is contained in:
JonatanRek
2020-03-11 12:22:44 +01:00
parent 0d076eb67c
commit 44c4c84292
6 changed files with 110 additions and 94 deletions

View File

@@ -47,6 +47,15 @@ class DeviceManager{
}
}
public function editByToken ($token, $values = []) {
try {
Db::edit ('devices', $values, 'WHERE token = ?', array($deviceId));
} catch(PDOException $error) {
echo $error->getMessage();
die();
}
}
/**
* [assignRoom Přiřazení zařízení do třídy]
* @param [type] $roomId [číslo místnosti do kter se má zařízení přiřadit]

View File

@@ -67,6 +67,10 @@
<div class="label">Type:</div>
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['type']; ?>" disabled>
</div>
<div class="field">
<div class="label">Mac Address:</div>
<input class="input" type="text" name="deviceToken" value="<?php echo $DEVICE['mac']; ?>" disabled>
</div>
<div class="field">
<div class="label">IP:</div>
<input class="input" type="text" name="deviceIp" value="<?php echo $DEVICE['ip']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
@@ -85,6 +89,13 @@
<div class="label">DNS:</div>
<input class="input" type="text" name="deviceDns" value="<?php echo $DEVICE['dns']; ?>" minlength="7" maxlength="15" size="15" pattern="^((\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$" disabled>
</div>
<h4 class="mb-4"><?php $LANGMNG->echo('t_deviceVersion'); ?></h4>
<div class="field">
<div class="label"><?php $LANGMNG->echo('l_uploadFirmware'); ?></div>
<input class="input" type="file" name="deviceFirmware" value="">
</div>
<?php if ($DEVICE['userIsAdmin']) { ?>
<?php if (!in_array($SUBDEVICE['type'], ['on/off', 'door', 'water'])) { ?>
<div class="field">

View File

@@ -161,6 +161,7 @@ class Home extends Template
'room' => $deviceData['room_id'],
'token' => $deviceData['token'],
'type' => $deviceData['type'],
'mac' => $deviceData['mac'],
'ip' => $deviceData['ip_address'],
'subnet' => $deviceData['subnet'],
'gateway' => $deviceData['gateway'],