#include "TriggerCommands.h" #include #include #include #include "Logger/Logger.h" #include "Register.h" #include "CheckIsRegistered.h" #include "CheckIsNotRegistered.h" #include "CheckCallIsInitialized.h" #include "CheckCallIsAnswered.h" #include "CheckCallIsEnded.h" #include "CheckNewMediaAdded.h" #include "CheckNewMediaRemoved.h" #include "Default.h" using namespace std; using namespace boost; namespace UpperTestAdapter { namespace Processors { namespace TriggerCommandsGUI { TriggerCommands::TriggerCommands() { } TriggerCommands::~TriggerCommands() { Logger::Instance().LogInfo("TriggerCommands::~TriggerCommands"); m_successor.reset(); } void TriggerCommands::SetEutIpInterface(boost::shared_ptr eutIface) { m_successor = shared_ptr(new Register(eutIface)); // Register shared_ptr checkIsRegistered = shared_ptr(new CheckIsRegistered(eutIface)); // CheckIsRegister m_successor.get()->SetSuccessor(checkIsRegistered); shared_ptr checkIsNotRegistered = shared_ptr(new CheckIsNotRegistered(eutIface)); // CheckIsNotRegister checkIsRegistered.get()->SetSuccessor(checkIsNotRegistered); shared_ptr checkCallIsInitialized = shared_ptr(new CheckCallIsInitialized(eutIface)); // CheckCallIsInitialized checkIsNotRegistered.get()->SetSuccessor(checkCallIsInitialized); shared_ptr checkCallIsAnswered = shared_ptr(new CheckCallIsAnswered(eutIface)); // CheckCallIsAnswered checkCallIsInitialized.get()->SetSuccessor(checkCallIsAnswered); shared_ptr checkCallIsEnded = shared_ptr(new CheckCallIsEnded(eutIface)); // CheckCallIsEnded checkCallIsAnswered.get()->SetSuccessor(checkCallIsEnded); shared_ptr checkNewMediaAdded = shared_ptr(new CheckNewMediaAdded(eutIface)); // CheckNewMediaAdded checkCallIsEnded.get()->SetSuccessor(checkNewMediaAdded); shared_ptr checkNewMediaRemoved = shared_ptr(new CheckNewMediaRemoved(eutIface)); // CheckNewMediaRemoved checkNewMediaAdded.get()->SetSuccessor(checkNewMediaRemoved); checkNewMediaRemoved.get()->SetSuccessor(shared_ptr(new Default(eutIface))); Logger::Instance().LogInfo("TriggerCommandsGUI::TriggerCommands::SetEutIpInterface: 9 commands created"); } int TriggerCommands::Process(const string &trigger, const vector ¶meterList) { // Sanity check, if (trigger.length() == 0) { Logger::Instance().LogError("TriggerCommandsGUI::TriggerCommands::Process: trigger is empty."); return 1; // See TTCN-3 FncRetCode } if (m_successor.get() == NULL) { Logger::Instance().LogError("TriggerCommandsGUI::TriggerCommands::Process: Bad pointer allocation."); return 1; // See TTCN-3 FncRetCode } /*stringstream ss; ss << "TriggerCommandsGUI::TriggerCommands::Process: start processing: " << trigger; Logger::Instance().LogInfo(ss.str());*/ return m_successor.get()->Process(trigger, parameterList); } } } } // namespaces