package com.its.dsrc.xnetudp.protocol;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

@Getter
@Setter
@ToString
public class CENTER_DSRC_REQ_CONTROL extends CENTER_DSRC_REQ_COMMON {

	private int  reqSeq;
	private byte deviceType;                            /* 장치유형, dsrc_device_code */
	private byte controlType;                           /* 제어유형, dsrc_control_code */
	public CENTER_DSRC_REQ_CONTROL(byte buffer[]) {

		super(buffer);
		if (getBody() != null) {
			ByteBuffer byteBuffer = ByteBuffer.wrap(getBody());
			byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
			this.reqSeq = byteBuffer.getInt();
			this.deviceType  = byteBuffer.get();
			this.controlType = byteBuffer.get();
		}
		else {
			this.deviceType  = 0;
			this.controlType = 0;
		}
	}

}
