Skip to content
Snippets Groups Projects
Commit 017e39c9 authored by alfredo's avatar alfredo
Browse files

rimosse stampe ciao

parent 4bbf4edc
No related branches found
No related tags found
No related merge requests found
......@@ -49,22 +49,22 @@ class Api {
* gets the luci of the user from the server
* @returns {*} all the lights of the user
*/
static getLuci = () => { console.log('ciao');
static getLuci = () => {
const topic = "to/all";
const message = "{request:status}";
sendMessage(topic, message);
};
static sendLuciWeb = luciInput => { console.log('ciao');
static sendLuciWeb = luciInput => {
Api.luci.luciFromMqtt(luciInput);
}
// static callbackGetAllLuci = null;
static getAllLuci = () => { console.log('ciao');
static getAllLuci = () => {
const topic = `rpc/${mqtt_tree}luci`;
const message = "{request:description}";
sendMessage(topic, message);
}
static sendDataLuciWeb = luciInput => { console.log('ciao');
static sendDataLuciWeb = luciInput => {
Api.luci.luciFromMqtt(luciInput);
}
......@@ -75,7 +75,7 @@ class Api {
* @param {luceTemplate} luce the luce to add to the server
* @returns {*} null if the light was added
*/
static makeNewLuci = luce => { console.log('ciao');
static makeNewLuci = luce => {
if (luce == null)
throw new Error("luce must be defined");
const luceSent = {nome: luce.luogo, stato: luce.stato, input: luce["sensore-in"], output: luce["luce-out"]};
......@@ -85,7 +85,7 @@ class Api {
const message = JSON.stringify(luceSent);
sendMessage(topic, message);
}
static sendWebNewLuci = luce => { console.log('ciao');
static sendWebNewLuci = luce => {
const oldLuce = Api.luceMakeNewLuci;
const luceReceived = {luogo: luce.nome, stato: luce.stato, "sensore-in": luce.input, "luce-out": luce.output, id : oldLuce.id};
if (oldLuce != luce) {
......@@ -99,7 +99,7 @@ class Api {
* invia il sensore al microservizio per aggiornarlo //FIXME YET TO BE USED
* @param {*} sensore l'oggetto sensore che dev'essere inviato al microservizio
*/
static makeNewSensoreLuci = sensore => { console.log('ciao');
static makeNewSensoreLuci = sensore => {
if (sensore == null || sensore.nome == null)
throw new Error("sensore must be defined");
Api.sensoreMakeNewSensore = sensore;
......@@ -109,7 +109,7 @@ class Api {
const message = JSON.stringify(newSensore);
sendMessage(topic, message);
}
static sendWebNewSensore = sensore => { console.log('ciao');
static sendWebNewSensore = sensore => {
const oldSensore = Api.sensoreMakeNewSensore;
if(oldSensore != null && oldSensore.nome !== sensore.sensM) {
console.log('i sensori non corrispondono', { oldSensore, sensore });
......@@ -125,7 +125,7 @@ class Api {
* @param {luceTemplate} luce the luce to change the status of
* @returns {*} null if the light's status was changed
*/
static setLuciStato = (luce, toggle, callback) => { console.log('ciao');
static setLuciStato = (luce, toggle, callback) => {
if (Api.fixedCallbackLuciStato == null)
return;
if (luce == null)
......@@ -144,7 +144,7 @@ class Api {
// Api.outForToggleLuciStato = luce;
sendMessage(topic, message);
}
static sendLuciStatoWeb = response => { console.log('ciao');
static sendLuciStatoWeb = response => {
//response == {"output":outVal,stato};
if (response == null) {
const toggle = Api.toggleForLuciStato;
......@@ -159,16 +159,16 @@ class Api {
* gets the scenari of the user from the server
* @returns {*} all the scenarios of the user
*/
static getScenari = () => { console.log('ciao');
static getScenari = () => {
const topic = `rpc/${mqtt_tree}scenari`;
const message = "{request:status}";
sendMessage(topic, message);
};
static sendScenariWeb = scenari => { console.log('ciao');
static sendScenariWeb = scenari => {
Api.scenari.mostraScenariServer(scenari);
}
static setAntifurtoINbtnFromScenari = newINbtn => { console.log('ciao');
static setAntifurtoINbtnFromScenari = newINbtn => {
console.log(newINbtn)
if(newINbtn == null || newINbtn?.nome == null)
throw new Error("newINbtn must be defined");
......@@ -188,7 +188,7 @@ class Api {
* @param {scenarioTemplate} scenario the scenario to activate or deactivate
* @returns {*} null if the scenario was activated or deactivated
*/
static setScenarioStatus = (scenario, activating) => { console.log('ciao');
static setScenarioStatus = (scenario, activating) => {
if (scenario == null)
throw new Error("scenario must be defined");
if (activating == null)
......@@ -200,7 +200,7 @@ class Api {
const message = `{"evento":${scenario.stato === false ? '0' : '1'},"nome":"${scenario.nome}"}`;
sendMessage(topic, message);
};
static sendWebNewScenarioStatus = scenarioNome => { console.log('ciao');
static sendWebNewScenarioStatus = scenarioNome => {
const scenario = Api.scenarioSetScenarioStatus;
const activating = Api.activatingSetScenarioStatus;
Api.scenarioSetScenarioStatus = null;
......@@ -213,7 +213,7 @@ class Api {
Api.scenari.showScenarioAfterToggling(scenario, activating,true);
}
static sendWebScenarioAttivoAutomatico = scenarioNome => { console.log('ciao');
static sendWebScenarioAttivoAutomatico = scenarioNome => {
Api.scenari.showScenarioAfterToggling(scenarioNome, true,true);
}
......@@ -228,7 +228,7 @@ class Api {
* @param {Boolean} recording true to start the recording, false to stop it
* @returns {*} null if the recording was started or stopped
*/
static recordScenario = (recording, learnINBtn) => { console.log('ciao');
static recordScenario = (recording, learnINBtn) => {
if (recording == null)
throw new Error("recording must be defined");
if (learnINBtn == null)
......@@ -243,7 +243,7 @@ class Api {
sendMessage(topic, message);
}
static retriesRecordScenario = 0;
static sendWebScenarioAutoma = stato => { console.log('ciao');
static sendWebScenarioAutoma = stato => {
if(isNaN(stato))
return;
const recording = Api.recordingRecordScenario;
......@@ -267,7 +267,7 @@ class Api {
* tells the server to save the currently recorded scenario
* @returns {*} the scenario if it was saved
*/
static saveScenario = nome => { console.log('ciao');
static saveScenario = nome => {
if (nome == null)
throw new Error("nome must be defined");
......@@ -275,16 +275,16 @@ class Api {
const message = JSON.stringify({nome});
sendMessage(topic, message);
};
static sendWebSavedScenario = scenario => { console.log('ciao');
static sendWebSavedScenario = scenario => {
Api.scenari.saveScenarioCallback(scenario);
}
// /api/scenari/conf
static sendScenariConfiguration = conf => { console.log('ciao');
static sendScenariConfiguration = conf => {
const topic = `conf/${mqtt_tree}scenari`;
const message = JSON.stringify(conf);
sendMessage(topic, message);
}
static sendWebConfigurationScenari = conf => { console.log('ciao');
static sendWebConfigurationScenari = conf => {
Api.scenari.updateConfiguration(conf);
}
// /api/antifurto/
......@@ -292,12 +292,12 @@ class Api {
* gets everything about the antifurto (stato, allarme, attenzione (valore progress bar), soglia, sensori)
* @returns {*} the antifurto's values
*/
static getAntifurto = () => { console.log('ciao');
static getAntifurto = () => {
const topic = `rpc/${mqtt_tree}antifurto`;
const message = `{"request":"description"}`;
sendMessage(topic, message);
};
static sendWebGetAntifurto = antifurto => { console.log('ciao');
static sendWebGetAntifurto = antifurto => {
Api.antifurto.mostraAntifurtoServer(antifurto);
}
// /api/antifurto/stato/
......@@ -307,7 +307,7 @@ class Api {
* @param {Boolean} payload {previousStatus, fromScenari, fromServer}
* @returns {*} null if the status was changed
*/
static setAntifurtoStatus = payload => { console.log('ciao');
static setAntifurtoStatus = payload => {
if (payload == null)
throw new Error("payload must be defined");
// Api.newStatusSetAntifurtoStatus = newStatus;
......@@ -320,7 +320,7 @@ class Api {
sendMessage(topic, message);
};
static retriesSetAntifurtoStatus = 0;
static sendWebSetAntifurtoStatus = stato => { console.log('ciao');
static sendWebSetAntifurtoStatus = stato => {
if(stato === NaN)
return;
const newStatus = Api.antifurto?.status != null ? !Api.antifurto.status : !Api.scenari?.antifurtoStatus;
......@@ -359,7 +359,7 @@ class Api {
* @param {Boolean} allarme the new status of the antifurto's alarm
* @returns {*} null if the status was changed
*/
static setAntifurtoAllarme = allarme => { console.log('ciao');
static setAntifurtoAllarme = allarme => {
// const booleanAlarm = allarme == 'true';
if (allarme == null || Api.fixedCallbackStatoAllarme == null)
return;
......@@ -372,7 +372,7 @@ class Api {
* @param {Number} attenzione the new value of the antifurto's attention
* @returns {*} null if the value was changed
*/
static setAntifurtoAttenzione = attenzione => { console.log('ciao');
static setAntifurtoAttenzione = attenzione => {
if (attenzione == null || isNaN(parseInt(attenzione)) || Api.fixedCallbackValoreAttenzione == null)
return;
const val = parseInt(attenzione);
......@@ -387,7 +387,7 @@ class Api {
* @param {Number} soglia the user's value of the antifurto's threshold
* @returns {*} null if the value was changed
*/
static setAntifurtoSoglia = (soglia, fromServer) => { console.log('ciao');
static setAntifurtoSoglia = (soglia, fromServer) => {
if (soglia == null || isNaN(parseInt(soglia)))
throw new Error("soglia must be a set integer");
const val = parseInt(soglia);
......@@ -402,7 +402,7 @@ class Api {
const message = `{"soglia":${val}}`;
sendMessage(topic, message);
};
static sendWebSoglia = soglia => { console.log('ciao');
static sendWebSoglia = soglia => {
const expectedSoglia = Api.sogliaSetAntifurtoSoglia;
if (expectedSoglia !== soglia) {
console.log('soglie differenti', { expectedSoglia, soglia });
......@@ -413,21 +413,21 @@ class Api {
Api.antifurto.showEditsSoglia(soglia, fromServer);
}
// /api/antifurto/conf
static sendAntifurtoConfiguration = json => { console.log('ciao');
static sendAntifurtoConfiguration = json => {
const topic = `conf/${mqtt_tree}antifurto`;
const message = JSON.stringify(json);
sendMessage(topic, message);
}
static sendWebConfigurationAntifurto = conf => { console.log('ciao');
static sendWebConfigurationAntifurto = conf => {
Api.antifurto.updateConfiguration(conf);
}
static sendSensoreConfiguration = json => { console.log('ciao');
static sendSensoreConfiguration = json => {
const topic = `conf/${mqtt_tree}antifurto/sensore`;
const message = JSON.stringify(json);
sendMessage(topic, message);
}
static sendWebConfigurationSensore = conf => { console.log('ciao');
static sendWebConfigurationSensore = conf => {
Api.antifurto.updateSensoreConfiguration(conf);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment