]> rtime.felk.cvut.cz Git - orte.git/blob - orte/java/src/org/ocera/orte/types/AppInfo.java
JORTE: fix the '2^32' problem and formatting in debug printf()
[orte.git] / orte / java / src / org / ocera / orte / types / AppInfo.java
1 /* AppInfo.java */
2
3 /**
4  * Class AppInfo. 
5  *
6  * @author Lukas Pokorny (lukas_pokorny@centrum.cz)
7  * @author CTU FEE Prague - Department of Control Engineering (dce.felk.cvut.cz)
8  * @author Project ORTE - OCERA Real Time Ethernet (www.ocera.org)
9  * @author dedication to Kj
10  * @version 0.1
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  */
23
24
25 package org.ocera.orte.types;
26 /* TODO - IpAddr!! */
27 import  java.net.Inet4Address;
28
29 /**
30  * @author luky
31  *
32  * TODO To change the template for this generated type comment go to
33  * Window - Preferences - Java - Code Style - Code Templates
34  */
35
36 /* TODO - naucit se delat s poli JAVA/JNI */
37 public class AppInfo 
38 {
39 /*  
40 struct ORTEAppInfo {
41 HostId hostId;
42 AppId appId;
43
44 IPAddress * unicastIPAddressList;
45 unsigned char unicastIPAddressCount;
46
47 IPAddress * metatrafficMulticastIPAddressList;
48 unsigned char metatrafficMulticastIPAddressCount;
49
50 Port metatrafficUnicastPort;
51 Port userdataUnicastPort;
52
53 VendorId vendorId;
54 ProtocolVersion protocolVersion;
55 };
56 */
57     
58   private long            hostId;
59   private long            appId;
60   /* TODO make an array of InetAddress[] instances */
61   // temporaly 1 address not list
62   private long            unicastIPAddressTemp;  
63   private byte            unicastIPcount;       
64   /* TODO make an array of InetAddress[] instances */
65   // temporaly 1 address not list
66   private long            mettaTrafficMulticastIPAddressTemp;     
67   private byte            multicastIPcount;
68   private long            metatrafficUniPort;
69   private long            userdataUniPort;
70   private VendorId        vendorId;
71   private ProtocolVersion protocolVersion;
72         
73   private Inet4Address ip;  
74   /* constructor */             
75   public AppInfo()
76   {
77   
78   }
79
80   // ONLY FOR TESTING PURPOSES  
81   public void setHostId(long hostId)
82   {
83       this.hostId = hostId;     
84       return;
85   }  
86   // ONLY FOR TESTING PURPOSES  
87   public void setAppId(long appId)
88   {
89       this.appId = appId;       
90       return;
91   }    
92   // ONLY FOR TESTING PURPOSES  
93   
94   public long getHostId()
95   {
96         return this.hostId;
97   }
98
99   public long getAppId()
100   {
101         return this.appId;
102   }
103
104   public long getIpAddressTemp()
105   {
106         return this.unicastIPAddressTemp;
107   }
108     
109   public byte getUnicastIPcount()
110   {
111         return this.unicastIPcount;
112   }
113   
114   public byte getMulticastIPcount()
115   {
116         return this.multicastIPcount;
117   }
118     
119   public long getMettaTrafficMulticastIPAddressTemp() 
120   {
121         return this.mettaTrafficMulticastIPAddressTemp;
122   }
123   
124   
125   
126   public long getMetatrafficUniPort()
127   {
128         return this.metatrafficUniPort;
129   }
130
131   public long getUserdataUniPort()
132   {
133         return this.userdataUniPort;
134   }
135
136   public VendorId getVendorId()
137   {
138         return this.vendorId;
139   }
140
141   public ProtocolVersion getProtocolVersion()
142   {             
143       return this.protocolVersion;
144   }
145
146     
147   // only for testing purposes
148   public void printWithLegend()
149   {
150         System.out.format(":j: * AppInfo.hostId = %#x\n", getHostId());
151         System.out.format(":j: * AppInfo.appId  = %#x\n", getAppId());
152         // ipAdressList
153         System.out.println(":j: * AppInfo.ipAddressTemp  = " + getIpAddressTemp());
154         System.out.println(":j: * AppInfo.unicastIPcount = " + getUnicastIPcount());
155         // ipAdressList
156         System.out.println(":j: * AppInfo.mettaTrafficMulticastIPAddressTemp  = " + getMettaTrafficMulticastIPAddressTemp());
157         System.out.println(":j: * AppInfo.multicastIPcount = " + getMulticastIPcount());
158         System.out.println(":j: * AppInfo.metatrafficUniPort = " + getMetatrafficUniPort());
159         System.out.println(":j: * AppInfo.userdataUniPort     = " + getUserdataUniPort());
160         System.out.println(":j: * AppInfo.vendorId = " + getVendorId());
161         System.out.println(":j: * AppInfo.protocolVersion = " + getProtocolVersion());  
162   }
163   
164 }