var draw_control = function() {
    getFullPanel(0, 7, 2, 2, "tab-page-basic_systems", "sec-control", "CONTROLS", "", "VER 1.0");
    var panel = document.getElementById("sec-control");
    panel.innerHTML += draw_control_0();
}

var draw_control_0 = function() {
    var html = getSectionTitle('DEVICE COUNTERS');

    var rows = '';
    var row = '';
    row += '<td><div class="ai-cell ai-cell-secondary-2" id="communicate" onclick="Communicate();">COMMUNICATE</div></td>';
    rows += getInfoRow(row);

    html += getTabel(rows);

    rows = '';
    row = getInfoCell('', 'GPS EXTERNAL');
    row += getInfoCell('comm-gps-external', '--');
    row += getInfoCell('', 'CAN BUS');
    row += getInfoCell('comm-can-bus', '--');
    rows += getInfoRow(row);
    row = getInfoCell('', 'MAIN UNIT');
    row += getInfoCell('comm-main-unit', '--');
    row += getInfoCell('', 'SECONDARY 1');
    row += getInfoCell('comm-secondary-1', '--');
    rows += getInfoRow(row);
    row = getInfoCell('', 'SECONDARY 2');
    row += getInfoCell('comm-secondary-2', '--');
    row += getInfoCell('', 'RAIN METER');
    row += getInfoCell('comm-rain-meter', '--');
    rows += getInfoRow(row);

    html += getTabel(rows);
    html = getPanel(html);
    return html;
}

var Communicate = function()
{
    if (document.getElementById("communicate").className == "ai-cell ai-cell-secondary-2") {
        document.getElementById("communicate").className = "ai-cell ai-cell-warning";
        ipcRenderer.send('main-unit-message', "DataOutput 1" + String.fromCharCode(13));
    } else {
        document.getElementById("communicate").className = "ai-cell ai-cell-secondary-2";
        ipcRenderer.send('main-unit-message', "DataOutput 0" + String.fromCharCode(13));
    }
}

draw_control();