/*!
 * \file      uppertester_cam_codec.hh
 * \brief     Header file for ITS UpperTester CAM codec definition.
 * \author    ETSI STF525
 * \copyright ETSI Copyright Notification
 *            No part may be reproduced except as authorized by written permission.
 *            The copyright and the foregoing restriction extend to reproduction in all media.
 *            All rights reserved.
 * \version   0.1
 */
#pragma once

#include <memory>

#include "codec.hh"
#include "params.hh"

class Base_Type;
class Record_Type;
class TTCN_Typedescriptor_t;
class TTCN_Buffer;

namespace LibItsCam__TypesAndValues {
  class UtCamTrigger;
  class UtCamResults;
  class UtCamEventInd;
}

class uppertester_cam_codec: public codec <
  Record_Type,
  Record_Type>
{
  const unsigned char c_utCamInitialize = 0x00;
  const unsigned char c_utCamInitializeResult = 0x01;
  const unsigned char c_utCamChangePosition = 0x02;
  const unsigned char c_utCamChangePositionResult = 0x03;
  const unsigned char c_utCamChangeCurvature = 0x30;
  const unsigned char c_utCamChangeSpeed = 0x31;
  const unsigned char c_utCamSetAccelerationStatus = 0x32;
  const unsigned char c_utCamSetExteriorLightsStatus = 0x33;
  const unsigned char c_utCamChangeHeading = 0x34;
  const unsigned char c_utCamSetDriveDirection = 0x35;
  const unsigned char c_utCamChangeYawRate = 0x36;
  const unsigned char c_utCamSetStationType = 0x39;
  const unsigned char c_utCamSetVehicleRole = 0x3a;
  const unsigned char c_utCamSetEmbarkationStatus = 0x3b;
  const unsigned char c_utCamSetPtActivation = 0x3c;
  const unsigned char c_utCamSetDangerousGoods = 0x3d;
  const unsigned char c_utCamSetLightBarSirene = 0x3f;
  const unsigned char c_utCamTriggerResult = 0x21;
  const unsigned char c_utCamEventInd = 0x23;

  int encode_ (const Base_Type& type, const TTCN_Typedescriptor_t& field_descriptor, TTCN_Buffer& encoding_buffer);

public:
  uppertester_cam_codec() : codec<Record_Type, Record_Type>() { };
  virtual ~uppertester_cam_codec() { };

  virtual int encode (const Record_Type&, OCTETSTRING& data);
  int encode (const LibItsCam__TypesAndValues::UtCamTrigger&, OCTETSTRING& data);
  virtual int decode (const OCTETSTRING& data, Record_Type&, params* params = NULL);
  std::unique_ptr<Base_Type> decode (const OCTETSTRING& data, params* params = NULL);
  
private:
  int decode (const OCTETSTRING& data, LibItsCam__TypesAndValues::UtCamResults& msg, params* params = NULL);
  int decode (const OCTETSTRING& data, LibItsCam__TypesAndValues::UtCamEventInd& msg, params* params = NULL);
}; // End of class uppertester_cam_codec

