View Javadoc

1   package net.sf.tourviewer.lib.ciclo;
2   
3   
4   
5   public class AABlock extends AbstractBlock {
6   
7   	enum TourType { BIKE2, BIKE1, JOGGING, SKI, BIKE, SKI_BIKE, UNKNOWN };
8   	
9   	private TourType tourType;
10  	private int ddOffset;
11  	private int timeHour;
12  	private int timeMinute;
13  	private int timeMonth;
14  	private int timeDay;
15  	private int totalDistance;
16  	private int mswDistance;
17  	private int initialAltitude;
18  	private int initialPulse;
19  	
20  	public AABlock(int[] data) {
21  		super(data);
22  		
23  		switch (getHexH(0)) {
24  			case 0x2E:
25  				this.tourType = TourType.BIKE1;
26  				break;
27  			case 0x3E:
28  				this.tourType = TourType.BIKE2;
29  				break;
30  			case 0x81:
31  				this.tourType = TourType.JOGGING;
32  				break;
33  			case 0x91:
34  				this.tourType = TourType.SKI;
35  				break;
36  			case 0xA1:
37  				this.tourType = TourType.BIKE;
38  				break;
39  			case 0xB1:
40  				this.tourType = TourType.SKI_BIKE;
41  				break;
42  			default:
43  				this.tourType = TourType.UNKNOWN;
44  		}
45  		
46  		this.ddOffset = getHex(1);
47  		this.timeHour = getDecH(2);
48  		this.timeMinute = getDecL(2);
49  		this.timeMonth = getDecH(3);
50  		this.timeDay = getDecL(3);
51  		this.totalDistance = getHex(4);
52  		this.mswDistance = getHex(5);
53  		this.initialAltitude = getHex(6);
54  		this.initialPulse = getHex(7);
55  	}
56  	
57  	@Override
58  	public String toString()
59  	{
60  		StringBuffer sb = new StringBuffer();
61  		sb.append(getDataString());
62  		sb.append(String.format(" [(AA) Type=%s,DDOffset=%d,Time=%02d-%02d %02d:%02d,TotalDist=%d,MSWDist=%d,InitialAlt=%d,InitalPulse=%d]", 
63  				tourType, ddOffset, timeMonth, timeDay, timeHour, timeMinute, totalDistance, mswDistance, initialAltitude, initialPulse));
64  		return sb.toString();
65  	}
66  
67  	
68  	public int getDdOffset()
69  	{
70  		return ddOffset;
71  	}
72  
73  	
74  	public int getInitialAltitude()
75  	{
76  		return initialAltitude;
77  	}
78  
79  	
80  	public int getInitialPulse()
81  	{
82  		return initialPulse;
83  	}
84  
85  	
86  	public int getMswDistance()
87  	{
88  		return mswDistance;
89  	}
90  
91  	
92  	public int getTimeDay()
93  	{
94  		return timeDay;
95  	}
96  
97  	
98  	public int getTimeHour()
99  	{
100 		return timeHour;
101 	}
102 
103 	
104 	public int getTimeMinute()
105 	{
106 		return timeMinute;
107 	}
108 
109 	
110 	public int getTimeMonth()
111 	{
112 		return timeMonth;
113 	}
114 
115 	
116 	public int getTotalDistance()
117 	{
118 		return totalDistance;
119 	}
120 
121 	
122 	public TourType getTourType()
123 	{
124 		return tourType;
125 	}
126 	
127 }