package org.josast.amicalsat;



public  class FrameFactory {
	

	    public  Frame creerFrame(String tlmArea, String typeFrame) {
	    	
	    	Frame frame=null;
  	
	    	if (tlmArea.compareTo("M1") == 0) {
	    		
	    		if (typeFrame.compareTo("LOG") == 0) {
	    			
	    		
	    		
	    		frame = new M1TypeFrame();
	    		
				}
	    

				
	    	if (typeFrame.compareTo("FLAGS") == 0) {
					
			frame = new FlagsTypeFrame();
			
				}
	    	}		
		
		if (tlmArea.compareTo("A1") == 0) {
			


			if (typeFrame.compareTo("FLAGS") == 0) {
				frame = new A1FlagTypeFrame();
			}
			
			if (typeFrame.compareTo("MAG") == 0) {
				frame = new A1MagTypeFrame();
				 
			}
		
			if (typeFrame.compareTo("GYRO") == 0) {
				
				frame = new A1GyroTypeFrame(); 
				
				

			}
			//# #A1;POSITION;[Current timestamp];[Latitude];[Longitude]
			if (typeFrame.compareTo("POSITION") == 0) {
			
				frame = new A1PositionTypeFrame(); 
			}
		}
		if (tlmArea.compareTo("EM") == 0) {


			if (typeFrame.compareTo("MN") == 0) {
				frame = new EmmnTypeFrame(); 
				
			
			}

			if (typeFrame.compareTo("LOG") == 0) {
				frame = new EmLogTypeFrame(); 

			

			}

		}
		
		if (tlmArea.compareTo("CU_R") == 0) {

			
			if (typeFrame.compareTo("LOG") == 0) {
				frame = new CuLogTypeFrame(); 

				

			}
		}
		
		if (tlmArea.compareTo("CU_L") == 0) {

			if (typeFrame.compareTo("LOG") == 0) {

				frame = new CuLogTypeFrame(); 

			}
		}
		
		if (tlmArea.compareTo("V1") == 0) {

			//#[V1/U2];MS;[Timestamp];[Current rssi];[Latch rssi];[AFC offset ]
			
			if (typeFrame.compareTo("MS") == 0) {

				frame = new V1MsTypeFrame(); 
				
			}
			
			if (typeFrame.compareTo("RL") == 0) {
				frame = new V1RlTypeFrame(); 
					
				
			}		
		}
		
		
		if (tlmArea.compareTo("U2") == 0) {

			//#[V1/U2];MS;[Timestamp];[Current rssi];[Latch rssi];[AFC offset ]
			if (typeFrame.compareTo("MS") == 0) {
				frame = new U2MsTypeFrame(); 
 
			
				
			}
			//#[U2];RL;[Timestamp],[CPU voltage];[Battery voltage];[CPU temperature];[Amplifier temperature];[Flags]
			if (typeFrame.compareTo("RL") == 0) {
				
				frame = new U2RlTypeFrame(); 				

			
			}
			
		}
		
		if (tlmArea.compareTo("ER") == 0) {

			//#[V1/U2];MS;[Timestamp];[Current rssi];[Latch rssi];[AFC offset ]
			if (typeFrame.compareTo("LOG") == 0) {
				frame = new EmLogTypeFrame(); 



			}
			if (typeFrame.compareTo("MN") == 0) {


				frame = new EmmnTypeFrame(); 
			}
		}
		
		return frame;
		}
	    
	    
	    
	    
	}

