/*
*
* Copyright (C) 2026 Private Island Networks Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* file: controller.js
*
*
*/
function ajaxData() {
var data = {};
return data;
}
function log_msg(msg) {
let msg_str = '';
msg_str += msg.type + ': ' + msg.address + ' ' + msg.data + '
';
return msg_str;
}
function postControllerMsg(event) {
$.loading('block');
event.preventDefault();
console.log("postControllerMsg");
let fd = new FormData($('#mc-cont_message'));
fd.append('dummy', 'foo')
$.post("/controller", fd, function(resp) {
$.loading('none');
resp = JSON.parse(resp);
if (resp.r == STATUS.OK) {
let log = document.getElementById('mc-log');
let height = 2 * resp.d.length;
for (let i=0; i < resp.d.length; i++) {
msg = resp.d[i];
if (msg.port == PORT_PC) {
log.innerHTML += '