/* createAppInfo.c */
-#include <jni.h>
-#include "orte.h"
-#include "jorte/4all.h"
-#include "jorte/jorte_protos_api.h"
+/**
+ * This code provides conversion between JAVA a C environments.
+ * The C functions are calling here and results are send to JAVA
+ * native functions. It uses the header pregenerated by JAVA
+ * (by command 'javah -jni class_with_native_function')
+ *
+ * @author Lukas Pokorny (lukas_pokorny@centrum.cz)
+ * @author Martin Vajnar (martin.vajnar@gmail.com)
+ * @author CTU FEE Prague - Department of Control Engineering (dce.felk.cvut.cz)
+ * @author Project ORTE - OCERA Real Time Ethernet (www.ocera.org)
+ * @author dedication to Kj
+ * @version 0.1
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include "jorte/jorte.h"
jobject createAppInfo(JNIEnv *env, const ORTEAppInfo *ainfo)
{
do
{
// find cls
- cls = (*env)->FindClass(env, "org/ocera/orte/types/AppInfo");
+ cls = findClass(env, "org.ocera.orte.types.AppInfo");
if(cls == 0)
{
#ifdef TEST_STAGE
break;
}
#ifdef TEST_STAGE
- printf(":c: ainfo.hostId = %d \n",ainfo->hostId);
+ printf(":c: ainfo.hostId = %#"PRIx32" \n",ainfo->hostId);
#endif
(*env)->SetLongField(env,
obj,
break;
}
#ifdef TEST_STAGE
- printf(":c: ainfo.appId = %d \n",ainfo->appId);
+ printf(":c: ainfo.appId = %#"PRIx32" \n",ainfo->appId);
#endif
(*env)->SetLongField(env,
obj,
break;
}
#ifdef TEST_STAGE
- printf(":c: ainfo.unicastIPAddressList = %d \n",ainfo->unicastIPAddressList);
+ printf(":c: ainfo.unicastIPAddressList = %#"PRIxPTR"\n",(intptr_t)ainfo->unicastIPAddressList);
#endif
(*env)->SetLongField(env,
obj,
break;
}
#ifdef TEST_STAGE
- printf(":c: ainfo.unicastIPcount = %d \n",
+ printf(":c: ainfo.unicastIPcount = %hhu \n",
ainfo->unicastIPAddressCount);
#endif
(*env)->SetByteField(env,
break;
}
#ifdef TEST_STAGE
- printf(":c: ainfo.multicastIPAddressList = %d \n",
- ainfo->metatrafficMulticastIPAddressList);
+ printf(":c: ainfo.multicastIPAddressList = %#"PRIxPTR"\n",
+ (intptr_t)ainfo->metatrafficMulticastIPAddressList);
#endif
(*env)->SetLongField(env,
obj,
break;
}
#ifdef TEST_STAGE
- printf(":c: ainfo.metatrafficMulticastIPAddressCount = %d \n",
+ printf(":c: ainfo.metatrafficMulticastIPAddressCount = %hhu \n",
ainfo->metatrafficMulticastIPAddressCount);
#endif
(*env)->SetByteField(env,
break;
}
#ifdef TEST_STAGE
- printf(":c: ainfo.metatrafficUnicastPort = %d \n",
+ printf(":c: ainfo.metatrafficUnicastPort = %"PRIu32" \n",
ainfo->metatrafficUnicastPort);
#endif
(*env)->SetLongField(env,
break;
}
#ifdef TEST_STAGE
- printf(":c: ainfo.userdataUnicastPort = %d \n",
+ printf(":c: ainfo.userdataUnicastPort = %"PRIu32" \n",
ainfo->userdataUnicastPort);
#endif
(*env)->SetLongField(env,
(jlong) ainfo->userdataUnicastPort);
// find cls - VendorID
- cls_tmp = (*env)->FindClass(env, "org/ocera/orte/types/VendorId");
+ cls_tmp = findClass(env, "org.ocera.orte.types.VendorId");
if(cls_tmp == 0)
{
#ifdef TEST_STAGE
break;
}
#ifdef TEST_STAGE
- printf(":c: ainfo.vendorId: major = %d, minor = %d \n",
+ printf(":c: ainfo.vendorId: major = %"PRId8", minor = %"PRId8" \n",
ainfo->vendorId.major, ainfo->vendorId.minor);
#endif
(*env)->SetObjectField(env,
obj_tmp);
// find cls - VendorID
- cls_tmp = (*env)->FindClass(env, "org/ocera/orte/types/ProtocolVersion");
+ cls_tmp = findClass(env, "org.ocera.orte.types.ProtocolVersion");
if(cls_tmp == 0)
{
#ifdef TEST_STAGE
break;
}
#ifdef TEST_STAGE
- printf(":c: ainfo.protocolVersion: major = %d, minor = %d \n",
+ printf(":c: ainfo.protocolVersion: major = %"PRId8", minor = %"PRId8" \n",
ainfo->protocolVersion.major, ainfo->protocolVersion.minor);
#endif
(*env)->SetObjectField(env,