// $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/src/tiptilt_ctrl/bcu/Interface/Sharknir/Bcu/DiagnosticRecordDispatcher.h 975 2018-10-31 09:24:04Z depa $
#pragma once
// #include "basda/service/bcu/worker/DiagnosticsDispatcher.h"
// #include "basda/service/bcu/worker/OverallDiagnosticRecordBuffer.h"

#include "tiptilt_ctrl/bcu/Interface/Sharknir/Bcu/DiagnosticsDispatcher.h"
#include "tiptilt_ctrl/bcu/Interface/Sharknir/Bcu/OverallDiagnosticRecordBuffer.h"

#include "util/SharedPtr.h"

#include <Basda/Microgate/Diagnostics/DiagnosticRecordReceiver.h>
#include <Basda/Microgate/Mgp/ByteBuffer.h>


namespace Sharknir { namespace Bcu {

class DiagnosticRecordDispatcher : public DiagnosticsDispatcher
{
public:
    typedef Basda::Microgate::ByteBufferPtr ByteBufferPtr;

    DiagnosticRecordDispatcher(
            const std::string& name,
            const Basda::Microgate::DiagnosticRecordReceiverPtr& receiver,
            const OverallDiagnosticRecordBufferPtr& buffer);

    /** @note overriden */
    virtual void dispatchOnce();

    /** @note overridden */
    virtual std::string name();

private:
    void dispatchSlopeRecord(const ByteBufferPtr& rawRecord);
    void dispatchCcdRecord(const ByteBufferPtr& rawRecord);
    void dispatchAsmRecord(const ByteBufferPtr& rawRecord);

    Basda::Microgate::DiagnosticRecordReceiverPtr receiver_;
    OverallDiagnosticRecordBufferPtr buffer_;
    std::string name_;
};

SHARKNIR_DECLARE_BOOST_SP(DiagnosticRecordDispatcher)
}
}
