source: pacpusframework/branches/0.1.x/src/PacpusLib/ConnectionManager.cpp@ 309

Last change on this file since 309 was 89, checked in by morasjul, 11 years ago

PACPUS 2.0 Beta deployed in new branch

Major changes:
-Add communication interface between components
-Add examples for communications interface (TestComponents)
-Move to Qt5 support

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1
2#include <Pacpus/kernel/ConnectionManager.h>
3#include <Pacpus/kernel/Log.h>
4
5using namespace pacpus;
6
7DECLARE_STATIC_LOGGER("pacpus.core.ConnectionManager");
8
9ConnectionManager::ConnectionManager()
10{
11 LOG_TRACE("constructor");
12}
13
14ConnectionManager::~ConnectionManager()
15{
16 LOG_TRACE("destructor");
17
18
19}
20
21ConnectionManager * ConnectionManager::getInstance()
22{
23 LOG_TRACE("getInstance()");
24 LOG_TRACE("before: mInstance = " << mInstance);
25
26 if (!mInstance)
27 {
28 LOG_INFO("creating new instance...");
29 mInstance = new ConnectionManager();
30 LOG_DEBUG("mInstance = " << mInstance);
31 }
32
33 LOG_TRACE("after: mInstance = " << mInstance);
34 return mInstance;
35}
36
37//void ConnectionManager::LoadConnection()
38
39void ConnectionManager::setConnection()
40{
41 LOG_TRACE(Q_FUNC_INFO);
42
43 ComponentManager *mgr = ComponentManager::getInstance();
44
45
46 // TODO read XML file and build ConnectionList
47 QList<ConnectionDescriptor> ConnectionList;
48 ConnectionList.append(ConnectionDescriptor("testComponent1","image","testComponent2","image","type"));
49
50 ComponentBase * sender, * receiver;
51 InputInterfaceBase * in;
52 OutputInterfaceBase * out;
53
54 for(QList<ConnectionDescriptor>::iterator i = ConnectionList.begin(); i != ConnectionList.end(); ++i) {
55
56 // TODO Handle errors
57 sender = mgr->getComponent(i->_outputComponent);
58 out = sender->getOutput(i->_outputName);
59
60
61 receiver = mgr->getComponent(i->_inputComponent);
62 in = receiver->getInput(i->_inputName);
63
64 //connect(out,SIGNAL(),in,SLOT()); // TODO make connection
65
66 LOG_INFO(" Output " << "out" << " connected to " << "in") // TODO replace out / in
67 }
68
69
70// CledComponent * cledComponent = (CledComponent*) m_component[cName];
71
72// InputInterface<ScanAlascaData> * in1 = static_cast<InputInterface<ScanAlascaData> *> (cledComponent->input.at(0));
73// OutputInterface<ScanAlascaData> * out1 = static_cast<OutputInterface<ScanAlascaData> *> (cledComponent->output.at(0));
74
75// if(in1->getDataType() != out1->getDataType())
76// LOG_ERROR("Connection Error: Incomaptible dataType between " << cledComponent->getName() << " and " << cledComponent->getName());
77
78
79// PacpusBuffer * buffer = new PacpusBuffer(5,in1->getDataSize());
80// LOG_INFO("Device opened:" << buffer->open(QIODevice::ReadWrite));
81
82// in1->setConnection(buffer,true);
83// out1->setConnection(buffer,true);
84
85
86}
87
Note: See TracBrowser for help on using the repository browser.