6 #include "jorte/4all.h"
7 #include "jorte/jorte_protos_api.h"
10 setRecvInfo(JNIEnv *env, const ORTERecvInfo *rinfo, jobject obj)
28 cls = findClass(env, "org.ocera.orte.types.RecvInfo");
31 printf(":!c: cls = NULL \n");
36 fid = (*env)->GetFieldID(env, cls, "status", "B");
39 printf(":!c: fid = NULL \n");
44 printf(":c: rinfo.status = %d \n",
47 (*env)->SetByteField(env,
50 (jbyte)rinfo->status);
51 /////////////////////////////////////////////////
53 if (!setTopic(env, cls, obj, rinfo->topic)) {
55 printf(":!c: seTopic() failed! \n");
60 if (!setType(env, cls, obj, rinfo->type)) {
62 printf(":!c: seType() failed! \n");
66 /////////////////////////////////////////////////
67 // find cls - GUID_RTPS
68 cls_tmp = findClass(env, "org.ocera.orte.types.GUID_RTPS");
71 printf(":!c: cls_tmp = NULL \n");
75 // call object constructor
76 mid = (*env)->GetMethodID(env,
82 printf(":!c: constructor failed! \n");
87 obj_tmp = (*env)->NewObject(env,
90 (jlong)rinfo->senderGUID.hid,
91 (jlong)rinfo->senderGUID.aid,
92 (jlong)rinfo->senderGUID.oid);
95 printf(":!c: obj = NULL \n");
99 // set AppInfo's field
100 fid = (*env)->GetFieldID(env,
103 "Lorg/ocera/orte/types/GUID_RTPS;");
106 printf(":!c: fid = NULL \n");
111 printf(":c: rinfo.senderGUID: hid = %#" PRIx32 ", aid = %#" PRIx32 ", oid = %#" PRIx32 " \n",
112 rinfo->senderGUID.hid, rinfo->senderGUID.aid, rinfo->senderGUID.oid);
114 (*env)->SetObjectField(env,
118 /////////////////////////////////////////////////
119 // find cls - NtpTime
120 cls_tmp = findClass(env, "org.ocera.orte.types.NtpTime");
123 printf(":!c: cls_tmp = NULL \n");
127 // call object constructor
128 mid = (*env)->GetMethodID(env,
134 printf(":!c: constructor failed! \n");
139 obj_tmp = (*env)->NewObject(env,
142 (jint)rinfo->localTimeReceived.seconds,
143 (jlong)rinfo->localTimeReceived.fraction);
146 printf(":!c: obj = NULL \n");
150 // set AppInfo's field
151 fid = (*env)->GetFieldID(env,
154 "Lorg/ocera/orte/types/NtpTime;");
157 printf(":!c: fid = NULL \n");
162 NtpTimeDisAssembToUs(sec, us, rinfo->localTimeReceived);
163 printf(":c: rinfo.NtpTime: %" PRId32 ".%" PRIu32 " (sec = %" PRId32 " fract = %" PRIu32 ") \n",
165 rinfo->localTimeReceived.seconds, rinfo->localTimeReceived.fraction);
167 (*env)->SetObjectField(env,
171 /////////////////////////////////////////////////
172 // find cls - NtpTime
174 cls_tmp = (*env)->FindClass(env, "org/ocera/orte/types/NtpTime");
178 printf(":!c: cls_tmp = NULL \n");
182 // call object constructor
183 mid = (*env)->GetMethodID(env,
190 printf(":!c: constructor failed! \n");
196 obj_tmp = (*env)->NewObject(env,
199 (jint)rinfo->remoteTimePublished.seconds,
200 (jlong)rinfo->remoteTimePublished.fraction);
203 printf(":!c: obj = NULL \n");
207 // set AppInfo's field
208 fid = (*env)->GetFieldID(env,
211 "Lorg/ocera/orte/types/NtpTime;");
214 printf(":!c: fid = NULL \n");
219 NtpTimeDisAssembToUs(sec, us, rinfo->remoteTimePublished);
220 printf(":c: rinfo.remoteTimePub: %" PRId32 ".%" PRIu32 " (sec = %" PRId32 " fract = %" PRIu32 ") \n",
222 rinfo->remoteTimePublished.seconds, rinfo->remoteTimePublished.fraction);
224 (*env)->SetObjectField(env,
228 /////////////////////////////////////////////////
229 // find cls - SequenceNumber
230 cls_tmp = findClass(env, "org.ocera.orte.types.SequenceNumber");
233 printf(":!c: cls_tmp = NULL \n");
237 // call object constructor
238 mid = (*env)->GetMethodID(env,
244 printf(":!c: constructor failed! # \n");
249 obj_tmp = (*env)->NewObject(env,
252 (jint)rinfo->sn.high,
253 (jlong)rinfo->sn.low);
256 printf(":!c: obj = NULL \n");
260 // set AppInfo's field
261 fid = (*env)->GetFieldID(env,
264 "Lorg/ocera/orte/types/SequenceNumber;");
267 printf(":!c: fid = NULL \n");
272 printf(":c: rinfo.sn: %" PRId64 " (high = %" PRId32 " low = %" PRId32 ") \n",
273 (((int64_t)rinfo->sn.high << 32) + rinfo->sn.low), rinfo->sn.high, rinfo->sn.low);
275 (*env)->SetObjectField(env,
279 /////////////////////////////////////////////////