//-------------------------------------------------------------------------------------
// <copyright file="ConnectionManagerProgramSettings.cpp" company="LiquidRobotics">
//
// Copyright (c) 2014 Liquid Robotics, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// This software is associated with a release.  Liquid Robotics makes no
// representation that the design, interfaces or component distribution will
// remain unchanged in future releases.
//
// </copyright>
//
// <summary>
// 	Implementation ofConnectionManagerProgramSettings class, a serializable entity that
//  holds the various settings for the ConnectionManagerProgram class
// </summary>
//
// <owner>Arash Ushani</owner>
//-------------------------------------------------------------------------------------

#include "ConnectionManagerProgramSettings.h"
#include "LqrSMACLoadSaveBoostXml.h"

using namespace std;
using namespace LiquidRobotics::EventLib;
using namespace LiquidRobotics::SMACFramework;

namespace LiquidRobotics {
namespace ConnectionManager {

ConnectionManagerProgramSettings::ConnectionManagerProgramSettings()
//: controllerSettings
: serverName("ConnectionManager")
, serverKind("")
, channelStateEvent("ChannelState", "ChannelStateEvent", "LiquidR-SMC")
, channelRequestEvent("Request", "RequestEvent", "LiquidR-SMC")
, shutdownEvent("Shutdown", "EventBase", "LiquidR-SMC")
{
}

ConnectionManagerProgramSettings::ConnectionManagerProgramSettings(const ConnectionManagerProgramSettings& rhs)
: serverName(rhs.serverName)
, serverKind(rhs.serverKind)
, channelStateEvent(rhs.channelStateEvent)
, channelRequestEvent(rhs.channelRequestEvent)
, shutdownEvent(rhs.shutdownEvent)
, eventTransceiverSettings(rhs.eventTransceiverSettings)
{
}

const string& ConnectionManagerProgramSettings::GetServerName() const
{
	return serverName;
}

void ConnectionManagerProgramSettings::SetServerName(const string& newValue)
{
	serverName = newValue;
}

const string& ConnectionManagerProgramSettings::GetServerKind() const
{
	return serverKind;
}

void ConnectionManagerProgramSettings::SetServerKind(const string& newValue)
{
	serverKind = newValue;
}

const ConnectionManagerProgramSettings::ChannelSettingsList& ConnectionManagerProgramSettings::GetChannelSettings() const
{
	return channelSettings;
}

void ConnectionManagerProgramSettings::SetChannelSettings(const ConnectionManagerProgramSettings::ChannelSettingsList& newValue)
{
	channelSettings = newValue;
}

//const ConnectionManagerChannelSettings& ConnectionManagerProgramSettings::GetRUDICSSettings() const
//{
//	return RUDICSSettings;
//}

//void ConnectionManagerProgramSettings::SetRUDICSSettings(const ConnectionManagerChannelSettings& newValue)
//{
//	RUDICSSettings = newValue;
//}

const ConnectionManagerProgramSettings::StdOutLoggerSettings& ConnectionManagerProgramSettings::GetLoggerSettings() const
{
	return loggerSettings;
}

void ConnectionManagerProgramSettings::SetLoggerSettings(const StdOutLoggerSettings& newValue)
{
	loggerSettings = newValue;
}

const ConnectionManagerProgramSettings::EventSettings& ConnectionManagerProgramSettings::GetChannelStateEvent() const
{
	return channelStateEvent;
}

void ConnectionManagerProgramSettings::SetChannelStateEvent(const EventSettings& newValue)
{
	channelStateEvent = newValue;
}

const ConnectionManagerProgramSettings::EventSettings& ConnectionManagerProgramSettings::GetChannelRequestEvent() const
{
	return channelRequestEvent;
}

void ConnectionManagerProgramSettings::SetChannelRequestEvent(const EventSettings& newValue)
{
	channelRequestEvent = newValue;
}

const ConnectionManagerProgramSettings::EventSettings& ConnectionManagerProgramSettings::GetShutdownEvent() const
{
	return shutdownEvent;
}

void ConnectionManagerProgramSettings::SetShutdownEvent(const EventSettings& newValue)
{
	shutdownEvent = newValue;
}

const EventTransceiverSettings& ConnectionManagerProgramSettings::GetEventTransceiverSettings() const
{
	return eventTransceiverSettings;
}

void ConnectionManagerProgramSettings::SetEventTransceiverSettings(const EventTransceiverSettings& newValue)
{
	eventTransceiverSettings = newValue;
}

const PayloadManagerClientSettings& ConnectionManagerProgramSettings::GetPayloadManagerClientSettings() const
{
	return payloadManagerClientSettings;
}

void ConnectionManagerProgramSettings::SetPayloadManagerClientSettings(const PayloadManagerClientSettings& newValue)
{
	payloadManagerClientSettings = newValue;
}

void ConnectionManagerProgramSettings::Load(const string& fileName)
{
	LoadBoostXml(fileName, *this);
}

void ConnectionManagerProgramSettings::Save(const string& fileName) const
{
	SaveBoostXml(fileName, *this);
}

}
}
