5 #include "jorte/4all.h"
6 #include "jorte/jorte_protos_api.h"
8 jobject setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo)
23 cls = findClass(env, "org.ocera.orte.types.RecvInfo");
27 printf(":!c: cls = NULL \n");
31 // call object constructor
32 mid = (*env)->GetMethodID(env, cls, "<init>", "()V");
36 printf(":!c: constructor failed! \n");
41 obj = (*env)->NewObject(env, cls, mid);
45 printf(":!c: obj = NULL \n");
53 private String typeName;
54 private GUID_RTPS senderGUID;
55 private NtpTime localTimeRecv;
56 private NtpTime remoteTimePub;
57 private SequenceNumber sn;
60 fid = (*env)->GetFieldID(env,cls,"status","B");
64 printf(":!c: fid = NULL \n");
69 printf(":c: rinfo.status = %d \n",
72 (*env)->SetByteField(env,
75 (jbyte) rinfo->status);
76 /////////////////////////////////////////////////
78 if(!setTopic(env,cls,obj,rinfo->topic))
81 printf(":!c: seTopic() failed! \n");
86 if(!setType(env,cls,obj,rinfo->type))
89 printf(":!c: seType() failed! \n");
93 /////////////////////////////////////////////////
94 // find cls - GUID_RTPS
95 cls_tmp = findClass(env, "org.ocera.orte.types.GUID_RTPS");
99 printf(":!c: cls_tmp = NULL \n");
103 // call object constructor
104 mid = (*env)->GetMethodID(env,
111 printf(":!c: constructor failed! \n");
116 obj_tmp = (*env)->NewObject(env,
119 (jlong)rinfo->senderGUID.hid,
120 (jlong)rinfo->senderGUID.aid,
121 (jlong)rinfo->senderGUID.oid);
125 printf(":!c: obj = NULL \n");
129 // set AppInfo's field
130 fid = (*env)->GetFieldID(env,
133 "Lorg/ocera/orte/types/GUID_RTPS;");
137 printf(":!c: fid = NULL \n");
142 printf(":c: rinfo.senderGUID: hid = %d, aid = %d, oid = %d \n",
143 rinfo->senderGUID.hid,rinfo->senderGUID.aid,rinfo->senderGUID.oid);
145 (*env)->SetObjectField(env,
149 /////////////////////////////////////////////////
150 // find cls - NtpTime
151 cls_tmp = findClass(env, "org.ocera.orte.types.NtpTime");
155 printf(":!c: cls_tmp = NULL \n");
159 // call object constructor
160 mid = (*env)->GetMethodID(env,
167 printf(":!c: constructor failed! \n");
172 obj_tmp = (*env)->NewObject(env,
175 (jint)rinfo->localTimeReceived.seconds,
176 (jlong)rinfo->localTimeReceived.fraction);
180 printf(":!c: obj = NULL \n");
184 // set AppInfo's field
185 fid = (*env)->GetFieldID(env,
188 "Lorg/ocera/orte/types/NtpTime;");
192 printf(":!c: fid = NULL \n");
197 printf(":c: rinfo.NtpTime: %d (sec = %d fract = %d) \n",
198 (rinfo->localTimeReceived.seconds + rinfo->localTimeReceived.fraction/2^32),
199 rinfo->localTimeReceived.seconds,rinfo->localTimeReceived.fraction);
201 (*env)->SetObjectField(env,
205 /////////////////////////////////////////////////
206 // find cls - NtpTime
208 cls_tmp = (*env)->FindClass(env, "org/ocera/orte/types/NtpTime");
212 printf(":!c: cls_tmp = NULL \n");
216 // call object constructor
217 mid = (*env)->GetMethodID(env,
224 printf(":!c: constructor failed! \n");
230 obj_tmp = (*env)->NewObject(env,
233 (jint)rinfo->remoteTimePublished.seconds,
234 (jlong)rinfo->remoteTimePublished.fraction);
238 printf(":!c: obj = NULL \n");
242 // set AppInfo's field
243 fid = (*env)->GetFieldID(env,
246 "Lorg/ocera/orte/types/NtpTime;");
250 printf(":!c: fid = NULL \n");
255 printf(":c: rinfo.remoteTimePub: %d (sec = %d fract = %d) \n",
256 (rinfo->remoteTimePublished.seconds + rinfo->remoteTimePublished.fraction/2^32),
257 rinfo->remoteTimePublished.seconds,rinfo->remoteTimePublished.fraction);
259 (*env)->SetObjectField(env,
263 /////////////////////////////////////////////////
264 // find cls - SequenceNumber
265 cls_tmp = findClass(env,"org.ocera.orte.types.SequenceNumber");
269 printf(":!c: cls_tmp = NULL \n");
273 // call object constructor
274 mid = (*env)->GetMethodID(env,
281 printf(":!c: constructor failed! \n");
286 obj_tmp = (*env)->NewObject(env,
289 (jint)rinfo->sn.high,
290 (jlong)rinfo->sn.low);
294 printf(":!c: obj = NULL \n");
298 // set AppInfo's field
299 fid = (*env)->GetFieldID(env,
302 "Lorg/ocera/orte/types/SequenceNumber;");
306 printf(":!c: fid = NULL \n");
311 printf(":c: rinfo.sn: %d (high = %d low = %d) \n",
312 (rinfo->sn.high*2^32 + rinfo->sn.low),rinfo->sn.high,rinfo->sn.low);
314 (*env)->SetObjectField(env,
318 /////////////////////////////////////////////////