Skip to content
Snippets Groups Projects
Commit 61d651c4 authored by Valerio Pastore's avatar Valerio Pastore
Browse files

added init state and protocol rename

parent 65ed6469
No related branches found
No related tags found
No related merge requests found
......@@ -2,11 +2,11 @@
#define BASEDAQ_H_
#include <Base_Monitor.h>
#include <Base_Protocol.h>
#include <Base_Archiver.h>
#include <Base_Provider.h>
#include <Base_Packet.h>
#include <Base_Configurator.h>
#include <Base_Receiver.h>
// FORWARD DECLARE
namespace inaf::oasbo::DAQ_observers {
......@@ -17,14 +17,14 @@ namespace inaf::oasbo::DAQ {
class BaseDAQ {
public:
enum Status {
STOP = -1, READY = 0, IDLE = 1, RUN = 2
INIT = -2, STOP = -1, READY = 0, IDLE = 1, RUN = 2
};
protected:
Status currentState;
Status nextState;
bool changeStateFlag = false;
ConnectionProtocols::BaseProtocol *protocol = nullptr;
Receivers::BaseReceiver *receiver = nullptr;
Archivers::BaseArchiver *archiver = nullptr;
Providers::BaseProvider *provider = nullptr;
PacketMonitors::BasePacketMonitor *monitor = nullptr;
......@@ -33,8 +33,8 @@ protected:
std::vector<inaf::oasbo::Configurators::BaseConfigurator*> configurations;
public:
void setProtocol(ConnectionProtocols::BaseProtocol &socket) {
this->protocol = &socket;
void setReceiver(Receivers::BaseReceiver &receiver) {
this->receiver = &receiver;
}
void setArchiver(Archivers::BaseArchiver &archiver) {
this->archiver = &archiver;
......@@ -69,8 +69,8 @@ public:
observers.end());
}
ConnectionProtocols::BaseProtocol* getSocketPtr() {
return this->protocol;
Receivers::BaseReceiver* getReceiverPtr() {
return this->receiver;
}
Archivers::BaseArchiver* getArchiverPtr() {
return this->archiver;
......@@ -100,7 +100,7 @@ public:
virtual int deliverPacket() = 0;
virtual ~BaseDAQ() {
delete protocol;
delete receiver;
delete provider;
delete archiver;
delete monitor;
......
......@@ -5,15 +5,14 @@
*
*/
#ifndef BASEPROTOCOL_H_
#define BASEPROTOCOL_H_
#pragma once
#include <iostream>
#include <netinet/in.h>
#include <Base_Packet.h>
namespace inaf::oasbo::ConnectionProtocols{
namespace inaf::oasbo::Receivers{
/*
* class BaseSocket
* Implementation of a socket that allows to communicate with the sender.
......@@ -24,7 +23,7 @@ namespace inaf::oasbo::ConnectionProtocols{
* @member field port: listen port
* @member field protocol: communication protocol.
*/
class BaseProtocol{
class BaseReceiver{
protected:
std::string host;
public:
......@@ -36,7 +35,6 @@ public:
virtual int closeConnectionToClient()=0;
virtual bool isConnectedToClient() const =0;
virtual int receiveFromClient(PacketLib::BasePacket &) = 0;
virtual ~BaseProtocol() = default;
virtual ~BaseReceiver() = default;
};
}
#endif /* BASEPROTOCOL_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment