#ifndef BTPCODEC_H
#define BTPCODEC_H

#include "Codec.hh"
#include "loggers.hh" // TODO To be removed
#include "Params.hh"

class Base_Type;
class TTCN_Typedescriptor_t;
class TTCN_Buffer;

namespace LibItsBtp__TestSystem {
  class BtpReq;
  class BtpInd;
}

namespace LibItsBtp__TypesAndValues {
  class BtpPacket;
}

class BTPCodec: public Codec <
  LibItsBtp__TypesAndValues::BtpPacket,
  LibItsBtp__TypesAndValues::BtpPacket>
{
  int encode_ (const Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& encoding_buffer);

  int decode_ (Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& decoding_buffer);

public:
  enum BtpType { btpA, btpB };
  BTPCodec() : Codec<LibItsBtp__TypesAndValues::BtpPacket, LibItsBtp__TypesAndValues::BtpPacket>() { _type = BTPCodec::btpA; loggers::get_instance().log("BTPCodec::BTPCodec(D) :%d ", _type); };
  virtual ~BTPCodec() { loggers::get_instance().log("BTPCodec::~BTPCodec"); };

  void set_btp_type(const BTPCodec::BtpType p_BtpType);
  virtual int encode (const LibItsBtp__TypesAndValues::BtpPacket&, OCTETSTRING& data);
  virtual int decode (const OCTETSTRING& data, LibItsBtp__TypesAndValues::BtpPacket&, Params* params = NULL);

private:
  BtpType _type;
};

#endif
