package gmt.protocol.ais;

public class Message06_440_40 extends Messages {
	
	int 	 sequence;			//!<  2 bits : Sequence Number
	long 	 destid;            //!< 30 bits : MMSI number of destination station.
	int 	 retransmit;		//!<  1 bits : Retransmit Flag
	int 	 spare;             //!<  1 bits : Spare
	int 	 app_id;            //!< 16 bits : Application ID
	int 	 messageType;       //!<  6 bits : MessageType
	int 	 pumpStatus;        //!<  6 bits : pumpStatus
	int 	 utc_year_on;       //!< 14 bits : UTC Year
	int 	 utc_month_on;      //!< 4 bits  : UTC Month
	int 	 utc_day_on;        //!< 5 bits  : UTC Day
	int 	 utc_hour_on;       //!< 5 bits  : UTC Hour
	int 	 utc_minute_on;     //!< 6 bits  : UTC Minute
	int 	 utc_second_on;     //!< 6 bits  : UTC Second
	int 	 utc_year_off;      //!< 14 bits : UTC Year
	int 	 utc_month_off;     //!< 4 bits  : UTC Month
	int 	 utc_day_off;       //!< 5 bits  : UTC Day
	int 	 utc_hour_off;      //!< 5 bits  : UTC Hour
	int 	 utc_minute_off;    //!< 6 bits  : UTC Minute
	int 	 utc_second_off;	//!< 6 bits  : UTC Second
	Position pos;               //!< 28 bits : Longitude in 1/10000 minute, 27 bits : Latitude in 1/10000 minute
	int 	 sog;               //!< 10 bits : Speed Over Ground
	int 	 cog;               //!< 12 bits : Course over Ground
	int 	 seq;               //!< 
	
	public Message06_440_40() {
		super();
		pos = new Position();
	}
	
	public void parse( Sixbit six_state )
			throws SixbitsExhaustedException, AISMessageException
	{
		super.parse( 6, six_state );
    
		this.sequence 		= (int)  six_state.get( 2 );
		this.destid   		= (long) six_state.get( 30 );
		this.retransmit 	= (int)  six_state.get( 1 );
		this.spare 			= (int)  six_state.get( 1 );
		this.app_id 		= (int)  six_state.get( 16 );
			   
		this.messageType	= (int)  six_state.get(  6 );   
		this.pumpStatus		= (int)  six_state.get(  6 );    
		this.utc_year_on	= (int)  six_state.get( 14 );   
		this.utc_month_on	= (int)  six_state.get(  4 );  
		this.utc_day_on		= (int)  six_state.get(  5 );    
		this.utc_hour_on	= (int)  six_state.get(  5 );   
		this.utc_minute_on	= (int)  six_state.get(  6 ); 
		this.utc_second_on	= (int)  six_state.get(  6 ); 
		this.utc_year_off	= (int)  six_state.get( 14 );  
		this.utc_month_off	= (int)  six_state.get(  4 ); 
		this.utc_day_off	= (int)  six_state.get(  5 );   
		this.utc_hour_off	= (int)  six_state.get(  5 );  
		this.utc_minute_off	= (int)  six_state.get(  6 );
		this.utc_second_off	= (int)  six_state.get(  6 ); 
		
		this.pos.setLatitude( (long) six_state.get( 28 ));
		this.pos.setLongitude((long) six_state.get( 28 ));
		
		this.sog			= (int)  six_state.get( 10 );
		this.cog			= (int)  six_state.get( 12 );
		this.seq			= (int)  six_state.get( 10 );
	}	

	public int sequence() {
		return sequence;
	}

	public long destid() {
		return destid;
	}

	public int retransmit() {
		return retransmit;
	}

	public int spare() {
		return spare;
	}

	public int app_id() {
		return app_id;
	}

	public int messageType() {
		return messageType;
	}

	public int pumpStatus() {
		return pumpStatus;
	}

	public int utc_year_on() {
		return utc_year_on;
	}

	public int utc_month_on() {
		return utc_month_on;
	}

	public int utc_day_on() {
		return utc_day_on;
	}

	public int utc_hour_on() {
		return utc_hour_on;
	}

	public int utc_minute_on() {
		return utc_minute_on;
	}

	public int utc_second_on() {
		return utc_second_on;
	}

	public int utc_year_off() {
		return utc_year_off;
	}

	public int utc_month_off() {
		return utc_month_off;
	}

	public int utc_day_off() {
		return utc_day_off;
	}

	public int utc_hour_off() {
		return utc_hour_off;
	}

	public int utc_minute_off() {
		return utc_minute_off;
	}

	public int utc_second_off() {
		return utc_second_off;
	}
	
	public long latitude() {
		return pos.latitude;
	}
	
	public long longitude() {
		return pos.longitude;
	}

	public int sog() {
		return sog;
	}

	public int cog() {
		return cog;
	}

	public int seq() {
		return seq;
	}             

}
