]> rtime.felk.cvut.cz Git - orte.git/commitdiff
JORTE: add wrapper for ORTESubscriptionPull() and revert ORTEDomainStart() removal
authorMartin Vajnar <martin.vajnar@gmail.com>
Sat, 24 Aug 2013 10:55:39 +0000 (12:55 +0200)
committerMartin Vajnar <martin.vajnar@gmail.com>
Sat, 24 Aug 2013 10:55:39 +0000 (12:55 +0200)
orte/include/jorte/jorte.h
orte/include/jorte/org_ocera_orte_Domain.h [new file with mode: 0644]
orte/java/src/org/ocera/orte/Domain.java
orte/java/src/org/ocera/orte/Subscription.java
orte/libaorte/jni/Android.mk
orte/libjorte/JORTEDomainStart.c [new file with mode: 0644]
orte/libjorte/JORTESubscriptionPull.c [new file with mode: 0644]
orte/libjorte/Makefile.am
orte/libjorte/Makefile.omk

index 73c51fad1d290fffd5c69af6bbca3a6c853e440d..9c7a5e339a253ff05c2060b0aba8f897effca471 100644 (file)
@@ -42,6 +42,7 @@ extern "C" {
 
 // auto-generated headers by JNI
 #include "org_ocera_orte_tools_Conversions.h"
+#include "org_ocera_orte_Domain.h"
 #include "org_ocera_orte_DomainEvents.h"
 #include "org_ocera_orte_DomainProp.h"
 #include "org_ocera_orte_tools_GetORTEConstant.h"
diff --git a/orte/include/jorte/org_ocera_orte_Domain.h b/orte/include/jorte/org_ocera_orte_Domain.h
new file mode 100644 (file)
index 0000000..1ea97d4
--- /dev/null
@@ -0,0 +1,21 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_ocera_orte_Domain */
+
+#ifndef _Included_org_ocera_orte_Domain
+#define _Included_org_ocera_orte_Domain
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class:     org_ocera_orte_Domain
+ * Method:    jORTEDomainStart
+ * Signature: (JZZZ)V
+ */
+JNIEXPORT void JNICALL Java_org_ocera_orte_Domain_jORTEDomainStart
+  (JNIEnv *, jclass, jlong, jboolean, jboolean, jboolean);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
index 8ed7b5f870c041f11f1e79f127112a42127338c3..813cad8027749308c56ea27db472a4196d8d6f33 100644 (file)
@@ -62,4 +62,26 @@ public abstract class Domain {
     * @return Handle of the Domain.
     */
     public abstract boolean destroy();
+   
+   
+  /* ****************************************************************** *
+   *                                                                    *
+   *                         native methods                             *
+   *                                                                    *
+   * ****************************************************************** */
+
+  /**
+   * jORTEDomainStart -
+   *
+   * @param dhandle handler to domain
+   * @param
+   * @param
+   * @return
+   */
+   private static native
+   void jORTEDomainStart(long dhandle,
+                         boolean recvMetatrafficThread,
+                         boolean recvUserDataThread,
+                            boolean sendThread);
+
 }
index 485f9e3301f8aa2234a0ffd00834fcec6f6bbe97..6f3558ee5f141197b64f28fbd3587f2ed9e55065 100644 (file)
@@ -150,7 +150,6 @@ public class Subscription {
     return i; 
   }
   
-  /* TODO - dodelat middle C zdrojak !! */
   /**
    * Read data
    * @param Time how long to wait.
index 2ef23c1641858d21ba5eb999cc7ecb3bebb2debf..997f16c3cc0083cf01cfcdcd18df6b524216f6df 100644 (file)
@@ -82,6 +82,7 @@ libjorte/JORTEDomainMgrDestroy.c \
 libjorte/JORTEDomainPropDefaultGet.c \
 libjorte/JORTEDomainPropSet.c \
 libjorte/JORTEDomainPropDestroy.c \
+libjorte/JORTEDomainStart.c \
 libjorte/JORTEInit.c \
 libjorte/JORTEPublicationCreate.c \
 libjorte/JORTEPublicationDestroy.c \
@@ -95,6 +96,7 @@ libjorte/JORTESubscriptionCreate.c \
 libjorte/JORTESubscriptionDestroy.c \
 libjorte/JORTESubscriptionPropertiesGet.c \
 libjorte/JORTESubscriptionPropertiesSet.c \
+libjorte/JORTESubscriptionPull.c \
 libjorte/JORTESubscriptionGetStatus.c \
 libjorte/JORTESubscriptionWaitForPublications.c \
 libjorte/JORTETypeRegisterAdd.c \
@@ -105,4 +107,4 @@ libjorte/JStringToIPAddress.c
 
 LOCAL_STATIC_LIBRARIES := orte
 
-include $(BUILD_SHARED_LIBRARY)
+include $(BUILD_SHARED_LIBRARY)
\ No newline at end of file
diff --git a/orte/libjorte/JORTEDomainStart.c b/orte/libjorte/JORTEDomainStart.c
new file mode 100644 (file)
index 0000000..e9a1527
--- /dev/null
@@ -0,0 +1,55 @@
+/* JORTEDomainStart.c */
+
+
+/**
+  * 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 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.
+  *
+  */
+
+
+// origin orte headers
+#include "orte.h"
+// pregenerated header
+#include "jorte/org_ocera_orte_Domain.h"
+#include "jorte/4all.h"
+
+// ve fci chybi 2 Multicast argumenty - maji se dodat???
+JNIEXPORT void JNICALL
+Java_org_ocera_orte_Domain_jORTEDomainStart
+(JNIEnv *env, jclass cls, jlong dom_handle,
+ jboolean recvUnicastMetatrafficThread,
+ jboolean recvUnicastUserDataThread,
+ jboolean sendThread)
+{
+  // vyresit problemy s booleanem
+  ORTEDomainStart((ORTEDomain *) dom_handle,
+                  (Boolean) recvUnicastMetatrafficThread,
+                  ORTE_FALSE, // Multicast !
+                  (Boolean) recvUnicastUserDataThread,
+                  ORTE_FALSE, // Multicast !
+                  (Boolean) sendThread);
+  #ifdef TEST_STAGE
+    printf(":c: starting domain thread [ORTEDomainStart()].. \n");
+  #endif
+}
+
diff --git a/orte/libjorte/JORTESubscriptionPull.c b/orte/libjorte/JORTESubscriptionPull.c
new file mode 100644 (file)
index 0000000..938f993
--- /dev/null
@@ -0,0 +1,11 @@
+#include "orte.h"
+#include "jorte/4all.h"
+#include "jorte/org_ocera_orte_Subscription.h"
+
+JNIEXPORT jint JNICALL
+Java_org_ocera_orte_Subscription_jORTESubscriptionPull
+(JNIEnv *env, jobject obj, jlong sub_handle)
+{
+  return ORTESubscriptionPull((ORTESubscription*)sub_handle);
+}
+
index 1e168bedfa52f56caa24ef84e4b89e59b21799f5..f3fe7052f60e43b2cece7cc2bfe3c0a4e18bf342 100644 (file)
@@ -21,6 +21,7 @@ JORTEDomainMgrDestroy.c \
 JORTEDomainPropDefaultGet.c \
 JORTEDomainPropSet.c \
 JORTEDomainPropDestroy.c \
+JORTEDomainStart.c \
 JORTEInit.c \
 JORTEPublicationCreate.c \
 JORTEPublicationDestroy.c \
@@ -28,6 +29,7 @@ JORTEPublicationSend.c \
 JORTESleepMs.c \
 JORTESubscriptionCreate.c \
 JORTESubscriptionDestroy.c \
+JORTESubscriptionPull.c \
 JORTETypeRegisterAdd.c \
 JStringToIPAddress.c
 
index ea20e4833e9483f442f5cac70345b3ea532fe78f..3a892159c36c78ceb3a0fecf09957c806b2ae01b 100644 (file)
@@ -37,6 +37,7 @@ JORTEDomainMgrDestroy.c \
 JORTEDomainPropDefaultGet.c \
 JORTEDomainPropSet.c \
 JORTEDomainPropDestroy.c \
+JORTEDomainStart.c \
 JORTEInit.c \
 JORTEPublicationCreate.c \
 JORTEPublicationDestroy.c \
@@ -50,6 +51,7 @@ JORTESubscriptionCreate.c \
 JORTESubscriptionDestroy.c \
 JORTESubscriptionPropertiesGet.c \
 JORTESubscriptionPropertiesSet.c \
+JORTESubscriptionPull.c \
 JORTESubscriptionGetStatus.c \
 JORTESubscriptionWaitForPublications.c \
 JORTETypeRegisterAdd.c \