package org.etsi.ttcn.codec.its.atsp;

import org.etsi.adapter.TERFactory;
import org.etsi.ttcn.codec.CodecBuffer;
import org.etsi.ttcn.codec.MainCodec;
import org.etsi.ttcn.codec.generic.Record;
import org.etsi.ttcn.tci.RecordValue;
import org.etsi.ttcn.tci.Type;

public class AtspInd extends Record {

    public AtspInd(MainCodec mainCodec) {
        super(mainCodec);
    }

    @Override
    protected void preDecodeField(String fieldName, CodecBuffer buf, Type decodingHypothesis, RecordValue rv) {

        TERFactory.getInstance().logDebug("FntpInd.preDecodeField: " + fieldName + " - " + decodingHypothesis.getName());
        if(fieldName.equals("receptionTime")) {
            buf.overwriteWith(receptionTime);
        }
    }

    @Override
    protected void preDecode(CodecBuffer buf, Type decodingHypothesis) {
        int msgLen = buf.getNbBits() - 6/*Time48IAT*/ * Byte.SIZE;
        
        receptionTime = buf.getBuffer(msgLen, 6 * Byte.SIZE);
    }
    
    private CodecBuffer receptionTime = null;
    
} // End of class FntpInd 

