//-------------------------------------------------------------------------------------------------
// <copyright file="SEControllerSettings.cpp" company="LiquidRobotics">
//  Copyright (c) Liquid Robotics Corporation, confidential and proprietary.  All rights reserved. 
// </copyright>
//
// <summary>
// 	Implementation of SEControllerSettings, a serializable entity that holds the
//  settings for an example sensor controller.
// </summary>
//
// <owner>Mike Cookson</owner>
//-------------------------------------------------------------------------------------------------

#include "SEControllerSettings.h"
#include "LqrSMACLoadSaveBoostXml.h"

using namespace std;
using namespace LiquidRobotics::SMACFramework;

namespace LiquidRobotics {
namespace SensorExample {

SEControllerSettings::SEControllerSettings()
{
}

SEControllerSettings::SEControllerSettings(const SEControllerSettings& rhs)
: listenerSettings(rhs.listenerSettings)
, serialPortSettings(rhs.serialPortSettings)
{
}

SEControllerSettings& SEControllerSettings::operator=(const SEControllerSettings& rhs)
{
	if (this != &rhs)
	{
		listenerSettings = rhs.listenerSettings;
		serialPortSettings = rhs.serialPortSettings;
	}

	return *this;
}

const SerialListenerSettings& SEControllerSettings::GetSerialListenerSettings() const
{
	return listenerSettings;
}

void SEControllerSettings::SetSerialListenerSettings(const SerialListenerSettings& newValue)
{
	listenerSettings = newValue;
}

const SerialPortSettings& SEControllerSettings::GetSerialPortSettings() const
{
	return serialPortSettings;
}

void SEControllerSettings::SetSerialPortSettings(const SerialPortSettings& newValue)
{
	serialPortSettings = newValue;
}

void SEControllerSettings::Load(const string& fileName, bool withMD5)
{
	if (withMD5)
		LoadBoostXmlMD5(fileName, *this, true);
	else
		LoadBoostXml(fileName, *this);
}

void SEControllerSettings::Save(const string& fileName, bool withMD5) const
{
	if (withMD5)
		SaveBoostXmlMD5(fileName, *this, true);
	else
		SaveBoostXml(fileName, *this);
}

}
}
