Subversion Repositories tpanel

Rev

Rev 457 | Rev 459 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Copyright (C) 2024 by Andreas Theofilu <andreas@theosys.at>
 *
 * This program 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
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */

#include "tqintercom.h"
#include "terror.h"

TQIntercom::TQIntercom()
{
    DECL_TRACER("TQIntercom::TQIntercom()");
}

TQIntercom::TQIntercom(INTERCOM_t ic)
{
    DECL_TRACER("TQIntercom::TQIntercom(INTERCOM_t ic)");

    setIntercom(ic);
}

TQIntercom::~TQIntercom()
{
    DECL_TRACER("TQIntercom::~TQIntercom()");
}

void TQIntercom::setIntercom(INTERCOM_t ic)
{
    if (ic.ip.empty())
    {
        MSG_ERROR("No valid IP address!");
        return;
    }

    if (ic.rxPort <= 0 || ic.rxPort > 0x0ffff)
    {
        MSG_ERROR("Receiver port is invalid! (" << ic.rxPort << ")");
        return;
    }

    if (ic.txPort <= 0 || ic.txPort > 0x0ffff)
    {
        MSG_ERROR("Transmit port is invalid! (" << ic.txPort << ")");
        return;
    }

    if (ic.mode < 0 || ic.mode > 2)
    {
        MSG_ERROR("Invalid mode " << ic.mode << "!");
        return;
    }

    mIntercom = ic;
    mInitialized = true;
}

void TQIntercom::setSpeakerLevel(int level)
{
    DECL_TRACER("TQIntercom::setSpeakerLevel(int level)");

    if (level < 0 || level > 100)
        return;

    mSpkLevel = level;
    // TODO: Add code to set volume
}

void TQIntercom::setMicrophonLevel(int level)
{
    DECL_TRACER("TQIntercom::setMicrophonLevel(int level)");

    if (level < 0 || level > 100)
        return;

    // TODO: Add code to set microphon level
}

void TQIntercom::start()
{
    DECL_TRACER("TQIntercom::start()");


    // TODO: Add code to start
}

void TQIntercom::stop()
{
    DECL_TRACER("TQIntercom::stop()");

    // TODO: Add code to stop
}

void TQIntercom::setMute(bool mute)
{
    DECL_TRACER("TQIntercom::setMute(bool mute)");

    // TODO: Add code to mute/unmute microphon
}