added emessage api

master
cheetah 3 years ago
parent 3bce300c70
commit d97b63ee27

@ -20,6 +20,15 @@
"enabled": false, "enabled": false,
"duplexTimeout": 180 "duplexTimeout": 180
}, },
"emessage": {
"enabled": false,
"username": "",
"password": "",
"duplexTimeout": 60,
"responseTimeout": 320,
"startInterval": 5,
"2wayS_BackChannel": true
},
"lorawan": { "lorawan": {
"enabled": true, "enabled": true,
"duplexTimeout": 1800, "duplexTimeout": 1800,

@ -78,6 +78,26 @@
<label for="ecityruf_duplex_timeout">Duplex Timeout(in seconds): [recommended 180s]</label> <label for="ecityruf_duplex_timeout">Duplex Timeout(in seconds): [recommended 180s]</label>
<input type="number" min="10" max="1200" id="ecityruf_duplex_timeout"/> <input type="number" min="10" max="1200" id="ecityruf_duplex_timeout"/>
</fieldset> </fieldset>
<fieldset>
<legend>eMessage Connector</legend>
<label for="emessage_enabled">Enabled:</label>
<input type="checkbox" id="emessage_enabled"/>
</br>
<label for="emessage_username">Username:</label>
<input type="text" id="emessage_username"/>
</br>
<label for="emessage_password">Password:</label>
<input type="password" id="emessage_password"/>
</br>
<label for="emessage_start_interval">Start Interval(in seconds): [recommended 5s]</label>
<input type="number" min="1" max="60" id="emessage_start_interval"/>
</br>
<label for="emessage_duplex_timeout">Duplex Timeout(in seconds): [recommended 60s]</label>
<input type="number" min="10" max="1200" id="emessage_duplex_timeout"/>
</br>
<label for="emessage_response_timeout">Response Timeout(in seconds): [recommended 320s]</label>
<input type="number" min="10" max="1200" id="emessage_response_timeout"/>
</fieldset>
<hr> <hr>
<!-- <!--
@ -117,6 +137,13 @@
$('#ecityruf_enabled').attr('checked', config.connectors.ecityruf.enabled) $('#ecityruf_enabled').attr('checked', config.connectors.ecityruf.enabled)
$('#ecityruf_duplex_timeout').val(config.connectors.ecityruf.duplexTimeout) $('#ecityruf_duplex_timeout').val(config.connectors.ecityruf.duplexTimeout)
$('#emessage_enabled').attr('checked', config.connectors.emessage.enabled)
$('#emessage_username').val(config.connectors.emessage.username)
$('#emessage_password').val(config.connectors.emessage.password)
$('#emessage_response_timeout').val(config.connectors.emessage.responseTimeout)
$('#emessage_duplex_timeout').val(config.connectors.emessage.duplexTimeout)
$('#emessage_start_interval').val(config.connectors.emessage.startInterval)
} }
async function saveConfigFromForm() { async function saveConfigFromForm() {
let newConfig = await $.getJSON('/config') // make a copy from the current dispatcher config let newConfig = await $.getJSON('/config') // make a copy from the current dispatcher config
@ -140,6 +167,14 @@
newConfig.connectors.ecityruf.enabled = $('#ecityruf_enabled').prop('checked') newConfig.connectors.ecityruf.enabled = $('#ecityruf_enabled').prop('checked')
newConfig.connectors.ecityruf.duplexTimeout = parseInt($('#ecityruf_duplex_timeout').val()) newConfig.connectors.ecityruf.duplexTimeout = parseInt($('#ecityruf_duplex_timeout').val())
// connectors.emessage
newConfig.connectors.emessage.enabled = $('#emessage_enabled').prop('checked')
newConfig.connectors.emessage.username = $('#emessage_username').val()
newConfig.connectors.emessage.password = $('#emessage_password').val()
newConfig.connectors.emessage.responseTimeout = parseInt($('#emessage_response_timeout').val())
newConfig.connectors.emessage.duplexTimeout = parseInt($('#ecityruf_duplex_timeout').val())
newConfig.connectors.emessage.startInterval = parseInt($('#emessage_start_interval').val())
console.log(newConfig) console.log(newConfig)
await $.ajax({ await $.ajax({
type: 'POST', type: 'POST',

Loading…
Cancel
Save