From 60a89380196717ddbda15ec22c69526beaf0c0f0 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 19 Oct 2010 18:56:21 +0200 Subject: [PATCH] moved bash logging script for onewire sensors to controller section --- controller/README | 10 +- .../tools => controller/bash}/log_onewire.sh | 2 +- controller/ethersex | 2 +- controller/index.html | 40 --- controller/script.js | 286 ------------------ 5 files changed, 11 insertions(+), 329 deletions(-) rename {share/tools => controller/bash}/log_onewire.sh (97%) delete mode 100644 controller/index.html delete mode 100644 controller/script.js diff --git a/controller/README b/controller/README index 6b43e4e..ca81261 100644 --- a/controller/README +++ b/controller/README @@ -1,6 +1,14 @@ Dieses Verzeichnis enthällt den Sourcecode für die Messcontroller (und deren Webfrontend). -Das ethersex Verzeichnis ist als git Submodule eingebunden und kann mit folgenden Befehlen nachgeladen werden: +PHP +--------------------------------------- +Die PHP Implementation soll eine Referenz für alle anderen Controllerimplementationen darstellen und ist als Vorbild zu nutzen. +Ethersex +--------------------------------------- +Informationen zum Comilen und flashen finden sich hier: +http://wiki.volkszaehler.org/software/ethersex + +Das ethersex Verzeichnis ist als git Submodule eingebunden und kann mit folgenden Befehlen nachgeladen werden: git submodule init git submodule update diff --git a/share/tools/log_onewire.sh b/controller/bash/log_onewire.sh similarity index 97% rename from share/tools/log_onewire.sh rename to controller/bash/log_onewire.sh index 1e0936d..380b911 100755 --- a/share/tools/log_onewire.sh +++ b/controller/bash/log_onewire.sh @@ -81,7 +81,7 @@ do IFS=${OLD_IFS} if [ ${COLUMNS[3]:0:2} == "85" ]; then - echo "check your wiring; we received an invalid reading!" 1>2& + echo "check your wiring; we received an invalid reading!" >&2 elif [[ ${MAPPING[${COLUMNS[1]}]} ]]; then UUID=${MAPPING[${COLUMNS[1]}]} REQUEST_URL="${URL}/data/${UUID}.json?value=${COLUMNS[3]}×tamp=$(( ${COLUMNS[2]} * 1000 ))${URL_PARAMS}${DEBUG:+&debug=1}" diff --git a/controller/ethersex b/controller/ethersex index 4b945bb..57a68fb 160000 --- a/controller/ethersex +++ b/controller/ethersex @@ -1 +1 @@ -Subproject commit 4b945bbb1c42fb5ed110bff3f4bf0133977fb628 +Subproject commit 57a68fbcd433c5940608048362bab5c161159e2b diff --git a/controller/index.html b/controller/index.html deleted file mode 100644 index 81d5f6f..0000000 --- a/controller/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - -volkszaehler.org - controller setup - - - - -

volkszaehler.org - controller setup

-

Hier können Sie ihren Stromzähler einrichten.

- -
-

Kanäle

-

Derzeit sind folgende Zähler/Sensoren konfiguriert:

-
-
- -
-
-

Kanal hinzufügen

-

Hier können sie einen neuen Kanal hinzufügen:

-
Allgemeine Eigenschaften - - - -
-
- -
- Spezifische Eigenschaften -
-

(*) required

-
- -
-
- - \ No newline at end of file diff --git a/controller/script.js b/controller/script.js deleted file mode 100644 index 2640189..0000000 --- a/controller/script.js +++ /dev/null @@ -1,286 +0,0 @@ -/** - * Javascript controller webinterface - * - * @author Steffen Vogel - * @copyright Copyright (c) 2010, The volkszaehler.org project - * @package controller - * @license http://opensource.org/licenses/gpl-license.php GNU Public License - * - * @todo use prototypes - */ -/* - * This file is part of volkzaehler.org - * - * volkzaehler.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * volkzaehler.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with volkszaehler.org. If not, see . - */ - -const backend = '../backend'; -const controller = 'php/channel.php'; - -var entities; -var properties; -var channels; - -$(document).ready(function() { - fetchEntities(); - fetchProperties(); - fetchChannels(); - - // bind type dropdown to showEntityForm() - $('#new select').change(function(event) { showEntityForm(event.target.value); }); - - // bind button to addChannel() - $('#new form').submit(function(event) { - event.preventDefault(); - - addChannel(this); - - return false; - }); -}); - -/** - * Get entities from backend - */ -function fetchEntities() { - $.getJSON(backend + '/capabilities/definition/entity.json', function(data) { - entities = data.definition.entity; - - // Add channel types to dropdown - $('#new select').empty(); - $.each(entities, function(index, entity) { - if (entity.model == 'Volkszaehler\\Model\\Channel') { - $('#new select').append(''); - } - }); - - // show related properties - $('#new select').trigger('change'); - }); -} - -/** - * Get properties from backend - */ -function fetchProperties() { - $.getJSON(backend + '/capabilities/definition/property.json', function(data) { - properties = data.definition.property; - - // show related properties - $('#new select').trigger('change'); - }); -} - -/** - * Get channels from controller - */ -function fetchChannels() { - $.getJSON(controller, function(data) { - channels = data; - - // add fetched channels to table - showChannels(); - }); -} - -/** - * Show from for new Channel - * - * @param type - * @return - */ -function showEntityForm(type) { - $('#properties').empty(); - var entity = getDefinition(entities, type); - - $.each(entity.required, function(index, property) { - var property = getDefinition(properties, property); - - if (property) { - $('#properties').append('' + getPropertyForm(property) + '(*)'); - } - }); - - $.each(entity.optional, function(index, property) { - var property = getDefinition(properties, property); - - if (property) { - $('#properties').append('' + getPropertyForm(property) + ''); - } - }); -} - -/** - * @param uuid - * @return - */ -function deleteChannel(uuid) { - $.getJSON(controller, { operation: 'delete', uuid: uuid }, function(data) { - channels = data; - showChannels(); - }); -} - -function addChannel(form) { - var uuid = false; - - if (validateChannel(form)) { - //if (uuid = addChannelBackend(form)) { - if (addChannelController(form, randomUUID)) { //uuid)) { - fetchChannels(); - return true; - } - else { - //removeChannelBackend(uuid); - alert('Error: adding channel to controller'); - } - /*} - else { - alert('Error: adding channel to backend'); - }*/ - } - else { - alert('Please correct your input'); - } -} - -function addChannelController(form, uuid) { - $.getJSON(controller, { operation: 'add', uuid: uuid, port: form.port.value, type: form.type.value }, function(data) { - channels = data; - showChannels(); - }); - - return true; // TODO -} - -function addChannelBackend(form) { - $.getJSON(backend + '/channel.json', { operation: 'add' }, function(data) { - - }); - - return true; // TODO -} - -function getDefinition(definition, type) { - for (var i in definition) { - if (definition[i].name == type) { - return definition[i]; - } - } -} - -function getPropertyForm(property) { - switch (property.type) { - case 'string': - case 'float': - case 'integer': - return ''; - - case 'text': - return ''; - - case 'boolean': - return ''; - - case 'multiple': - $.each(property.options, function(index, option) { - options.push('