// $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/src/tiptilt_ctrl/bcu/Interface/Sharknir/Bcu/Device.h 1160 2019-01-24 16:30:31Z depa $
#pragma once

#include <Nice/Util/File.h>
#include <Nice/Util/Sync.h>

#include "Basda/Microgate/Mgp/MemoryBuffer.h"
#include "Basda/Microgate/Mgp/OpCode.h"


namespace Sharknir { namespace Bcu {

class Device : public Nice::Shared
{
public:
    virtual double readBcuFpgaTemperatureInC()= 0;
    virtual double readBcuPcbTemperatureInC()= 0;
    // virtual double readDsp16do0FpgaTemperatureInC()= 0;
    // virtual double readDsp16do0PcbTemperatureInC()= 0;
    // virtual double readDsp16do1FpgaTemperatureInC()= 0;
    // virtual double readDsp16do1PcbTemperatureInC()= 0;
    // virtual double readHvc0FpgaTemperatureInC()= 0;
    // virtual double readHvc0PcbTemperatureInC()= 0;
    // virtual double readHvc1FpgaTemperatureInC()= 0;
    // virtual double readHvc1PcbTemperatureInC()= 0;

    virtual Basda::Microgate::MemoryBufferPtr read(
            Basda::Microgate::OpCode opcode,
            uint8_t firstDspIndex, uint8_t lastDspIndex,
            int32_t address, unsigned lengthInDword)= 0;

    virtual void write(Basda::Microgate::OpCode _opcode,
                       uint8_t _firstDsp,
                       uint8_t _lastDsp,
                       int32_t _address,
                       const Basda::Microgate::MemoryBufferPtr& _buffer )= 0;

    virtual void uploadDspCode(Nice::U8 firstDsp, Nice::U8 lastDsp,
                           const Nice::File& dspProgram)= 0;

    virtual void enableMasterDiagnostics( Nice::U16 decimationFactor,
            const std::string& remoteIpv4Address,
            const std::string& remoteMacAddress, Nice::U16 remoteUdpPortNr)= 0;

    virtual ~Device()= 0;

private:
};

typedef IceUtil::Handle<Device> DevicePtr;
}
}
