void saj_dataReaderListenerOnRequestedIncompatibleQos( void* listenerData, gapi_dataReader dataReader, const gapi_requestedIncompatibleQosStatus* status) { saj_listenerData ld; JNIEnv *env; jobject jstatus; jobject jdataReader; saj_returnCode rc; ld = saj_listenerData(listenerData); env = *(JNIEnv**)os_threadMemGet(OS_THREAD_JVM); rc = saj_statusCopyOutRequestedIncompatibleQosStatus(env, (gapi_requestedIncompatibleQosStatus *)status, &jstatus); if(rc == SAJ_RETCODE_OK) { jdataReader = saj_read_java_address(dataReader); (*env)->CallVoidMethod(env, ld->jlistener, GET_CACHED(listener_onRequestedIncompatibleQos_mid), jdataReader, jstatus); } }
void saj_topicListenerOnInconsistentTopic( void* listenerData, gapi_topic topic, const gapi_inconsistentTopicStatus *status) { saj_listenerData ld; JNIEnv *env; jobject jstatus; jobject jtopic; saj_returnCode rc; ld = saj_listenerData(listenerData); env = *(JNIEnv**)os_threadMemGet(OS_THREAD_JVM); rc = saj_statusCopyOutInconsistentTopicStatus(env, (gapi_inconsistentTopicStatus *)status, &jstatus); if(rc == SAJ_RETCODE_OK){ jtopic = saj_read_java_address(topic); (*env)->CallVoidMethod( env, ld->jlistener, GET_CACHED(listener_onInconsistentTopic_mid), jtopic, jstatus); } }
/** * Class: org_opensplice_dds_dcps_EntityImpl * Method: jniGetStatuscondition * Signature: ()LDDS/StatusCondition; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniGetStatuscondition)( JNIEnv *env, jobject jentity) { gapi_entity entity; gapi_statusCondition condition; jobject jcondition; saj_returnCode rc; jcondition = NULL; entity = (gapi_entity)saj_read_gapi_address(env, jentity); condition = gapi_entity_get_statuscondition(entity); if(condition != GAPI_OBJECT_NIL){ jcondition = saj_read_java_address(condition); if(jcondition == NULL){ rc = saj_construct_java_object(env, PACKAGENAME "StatusConditionImpl", (PA_ADDRCAST)condition, &jcondition); if(rc == SAJ_RETCODE_OK){ saj_write_java_statusCondition_address(env, entity, condition, jcondition); } } } return jcondition; }
/** * Class: org_opensplice_dds_dcps_PublisherImpl * Method: jniLookupDatawriter * Signature: (Ljava/lang/String;)LDDS/DataWriter; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniLookupDatawriter)( JNIEnv *env, jobject jpublisher, jstring jtopicName) { jobject jwriter; gapi_publisher publisher; gapi_dataWriter writer; const gapi_char* topicName; jwriter = NULL; writer = GAPI_OBJECT_NIL; topicName = NULL; publisher = (gapi_publisher)saj_read_gapi_address(env, jpublisher); if(jtopicName != NULL){ topicName = (*env)->GetStringUTFChars(env, jtopicName, 0); } writer = gapi_publisher_lookup_datawriter(publisher, topicName); if (writer != GAPI_OBJECT_NIL){ jwriter = saj_read_java_address(writer); } if(jtopicName != NULL){ (*env)->ReleaseStringUTFChars(env, jtopicName, topicName); } return jwriter; }
/** * Class: org_opensplice_dds_dcps_SubscriberImpl * Method: jniLookupDatareader * Signature: (Ljava/lang/String;)LDDS/DataReader; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniLookupDatareader)( JNIEnv *env, jobject jsubscriber, jstring jtopicName) { jobject jreader; gapi_subscriber subscriber; gapi_dataReader reader; const gapi_char* topicName; jreader = NULL; reader = GAPI_OBJECT_NIL; topicName = NULL; subscriber = (gapi_subscriber)saj_read_gapi_address(env, jsubscriber); if(jtopicName != NULL){ topicName = (*env)->GetStringUTFChars(env, jtopicName, 0); } reader = gapi_subscriber_lookup_datareader(subscriber, topicName); if (reader != GAPI_OBJECT_NIL){ jreader = saj_read_java_address(reader); } if(jtopicName != NULL){ (*env)->ReleaseStringUTFChars(env, jtopicName, topicName); } return jreader; }
/** * Class: org_opensplice_dds_dcps_SubscriberImpl * Method: jniGetParticipant * Signature: ()LDDS/DomainParticipant; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniGetParticipant)( JNIEnv *env, jobject jsubscriber) { gapi_subscriber subscriber; gapi_domainParticipant participant; subscriber = (gapi_subscriber)saj_read_gapi_address(env, jsubscriber); participant = gapi_subscriber_get_participant(subscriber); return saj_read_java_address(participant); }
/** * Class: org_opensplice_dds_dcps_PublisherImpl * Method: jniGetParticipant * Signature: ()LDDS/DomainParticipant; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniGetParticipant)( JNIEnv *env, jobject jpublisher) { gapi_publisher publisher; gapi_domainParticipant participant; publisher = (gapi_publisher)saj_read_gapi_address(env, jpublisher); participant = gapi_publisher_get_participant(publisher); return saj_read_java_address(participant); }
saj_returnCode saj_gapiObjectBufferCopyOut( JNIEnv *env, jclass classId, gapi_unsigned_long seqLength, gapi_object *src, jobjectArray *dst) { jobject object; gapi_unsigned_long i; saj_returnCode rc; assert(dst != NULL); assert((seqLength == 0) || (src != NULL)); object = NULL; rc = SAJ_RETCODE_ERROR; if(classId != NULL) { /* create a new object array */ *dst = (*env)->NewObjectArray(env, seqLength, classId, NULL); saj_exceptionCheck(env); if (*dst != NULL) { rc = SAJ_RETCODE_OK; for (i = 0; i < seqLength && rc == SAJ_RETCODE_OK; i++) { /* find the reference to the already existing java object */ object = saj_read_java_address((gapi_object)src[i]); assert(object != NULL); (*env)->SetObjectArrayElement(env, *dst, i, object); if ((*env)->ExceptionCheck(env) == JNI_TRUE) { /* ArrayIndexOutOfBoundsException or ArrayStoreException */ rc = SAJ_RETCODE_ERROR; } } } } return rc; }
void saj_dataReaderListenerOnDataAvailable( void* listenerData, gapi_dataReader dataReader) { saj_listenerData ld; JNIEnv *env; jobject jdataReader; ld = saj_listenerData(listenerData); env = *(JNIEnv**)os_threadMemGet(OS_THREAD_JVM); jdataReader = saj_read_java_address(dataReader); (*env)->CallVoidMethod(env, ld->jlistener, GET_CACHED(listener_onDataAvailable_mid), jdataReader); }
void saj_extTopicListenerOnAllDataDisposed( void* listenerData, gapi_topic topic) { saj_listenerData ld; JNIEnv *env; jobject jtopic; ld = saj_listenerData(listenerData); env = *(JNIEnv**)os_threadMemGet(OS_THREAD_JVM); jtopic = saj_read_java_address(topic); (*env)->CallVoidMethod(env, ld->jlistener, GET_CACHED(listener_onAllDataDisposed_mid), jtopic); }
/** * Class: org_opensplice_dds_dcps_TopicImpl * Method: jniGetParticipant * Signature: ()LDDS/DomainParticipant; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniGetParticipant)( JNIEnv *env, jobject jtopic) { gapi_topic topic; gapi_domainParticipant participant; jobject jparticipant; jparticipant = NULL; topic = (gapi_topic) saj_read_gapi_address(env, jtopic); participant = gapi_topic_get_participant(topic); if(participant != NULL){ jparticipant = saj_read_java_address(participant); } return jparticipant; }
/** * Class: org_opensplice_dds_dcps_ReadConditionImpl * Method: jniGetDatareaderView * Signature: ()LDDS/DataReaderView; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniGetDatareaderView)( JNIEnv *env, jobject jreadCondition) { gapi_readCondition readCondition; gapi_dataReaderView dataReaderView; jobject jdataReaderView; jdataReaderView = NULL; readCondition = (gapi_readCondition) saj_read_gapi_address(env, jreadCondition); dataReaderView = gapi_readCondition_get_datareaderview(readCondition); if(dataReaderView != NULL){ jdataReaderView = saj_read_java_address(dataReaderView); } return jdataReaderView; }
/** * Class: org_opensplice_dds_dcps_TopicDescriptionImpl * Method: jniGetParticipant * Signature: ()LDDS/DomainParticipant; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniGetParticipant)( JNIEnv *env, jobject jdescription) { gapi_topicDescription description; gapi_domainParticipant participant; jobject jparticipant; jparticipant = NULL; description = (gapi_topicDescription) saj_read_gapi_address(env, jdescription); participant = gapi_topicDescription_get_participant(description); if(participant != NULL){ jparticipant = saj_read_java_address(participant); } return jparticipant; }
/** * Class: org_opensplice_dds_dcps_DataWriterImpl * Method: jniGetPublisher * Signature: ()LDDS/Publisher; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniGetPublisher)( JNIEnv *env, jobject jdataWriter) { jobject jpublisher; gapi_publisher publisher; gapi_dataWriter dataWriter; jpublisher = NULL; dataWriter = (gapi_dataWriter)saj_read_gapi_address(env, jdataWriter); publisher = gapi_dataWriter_get_publisher(dataWriter); if (publisher != GAPI_OBJECT_NIL){ jpublisher = saj_read_java_address(publisher); } return jpublisher; }
/** * Class: org_opensplice_dds_dcps_DataWriterImpl * Method: jniGetTopic * Signature: ()LDDS/Topic; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniGetTopic)( JNIEnv *env, jobject jdataWriter) { jobject jtopic; gapi_topic topic; gapi_dataWriter dataWriter; jtopic = NULL; dataWriter = (gapi_dataWriter)saj_read_gapi_address(env, jdataWriter); topic = gapi_dataWriter_get_topic(dataWriter); if (topic != GAPI_OBJECT_NIL){ jtopic = saj_read_java_address(topic); } return jtopic; }
/* * Class: org_opensplice_dds_dcps_DataReaderViewImpl * Method: jniGetStatusCondition * Signature: ()LDDS/StatusCondition; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniGetStatusCondition)( JNIEnv *env, jobject jdataReaderView) { jobject jstatusCondition; gapi_statusCondition statusCondition; gapi_dataReaderView dataReaderView; jstatusCondition = NULL; statusCondition = GAPI_OBJECT_NIL; dataReaderView = (gapi_dataReaderView)saj_read_gapi_address(env, jdataReaderView); statusCondition = gapi_dataReaderView_get_statuscondition(dataReaderView); if (statusCondition != GAPI_OBJECT_NIL){ jstatusCondition = saj_read_java_address(statusCondition); } return jstatusCondition; }
/** * Class: org_opensplice_dds_dcps_DataReaderViewImpl * Method: jniGetDataReader * Signature: ()LDDS/DataReader; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniGetDataReader)( JNIEnv *env, jobject jdataReaderView) { jobject jdatareader; gapi_dataReader dataReader; gapi_dataReaderView dataReaderView; jdatareader = NULL; dataReader = GAPI_OBJECT_NIL; dataReaderView = (gapi_dataReaderView)saj_read_gapi_address(env, jdataReaderView); dataReader = gapi_dataReaderView_get_datareader(dataReaderView); if (dataReader != GAPI_OBJECT_NIL){ jdatareader = saj_read_java_address(dataReader); } return jdatareader; }
/** * Class: org_opensplice_dds_dcps_PublisherImpl * Method: jniCreateDatawriter * Signature: (LDDS/Topic;LDDS/DataWriterQos;LDDS/DataWriterListener;)LDDS/DataWriter; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniCreateDatawriter)( JNIEnv *env, jobject jpublisher, jobject jtopic, jobject jqos, jobject jlistener, jint jmask) { jobject jwriter; gapi_publisher publisher; gapi_dataWriter writer; gapi_dataWriterQos* writerQos; gapi_topic topic; gapi_domainParticipant participant; gapi_typeSupport typeSupport; const struct gapi_dataWriterListener *listener; gapi_char* dataWriterClassName; saj_returnCode rc; gapi_string typeName; gapi_char* signature; jobject jtypeSupport; jwriter = NULL; listener = NULL; writer = GAPI_OBJECT_NIL; publisher = (gapi_publisher) saj_read_gapi_address(env, jpublisher); participant = gapi_publisher_get_participant(publisher); topic = (gapi_topic) saj_read_gapi_address(env, jtopic); typeName = gapi_topicDescription_get_type_name((gapi_topicDescription)topic); typeSupport = gapi_domainParticipant_get_typesupport(participant, (const gapi_char*) typeName); gapi_free(typeName); jtypeSupport = saj_read_java_address((gapi_object)typeSupport); rc = saj_LookupTypeSupportDataWriter(env, jtypeSupport, &dataWriterClassName); if(rc == SAJ_RETCODE_OK){ if ((*env)->IsSameObject (env, jqos, GET_CACHED(DATAWRITER_QOS_DEFAULT)) == JNI_TRUE) { writerQos = (gapi_dataWriterQos *)GAPI_DATAWRITER_QOS_DEFAULT; rc = SAJ_RETCODE_OK; } else if ((*env)->IsSameObject (env, jqos, GET_CACHED(DATAWRITER_QOS_USE_TOPIC_QOS)) == JNI_TRUE) { writerQos = (gapi_dataWriterQos *)GAPI_DATAWRITER_QOS_USE_TOPIC_QOS; rc = SAJ_RETCODE_OK; } else { writerQos = gapi_dataWriterQos__alloc(); rc = saj_DataWriterQosCopyIn(env, jqos, writerQos); } if(rc == SAJ_RETCODE_OK){ listener = saj_dataWriterListenerNew(env, jlistener); writer = gapi_publisher_create_datawriter(publisher, topic, writerQos, listener, (gapi_statusMask)jmask); if (writer != GAPI_OBJECT_NIL){ rc = saj_LookupTypeSupportConstructorSignature(env, jtypeSupport, &signature); if(rc == SAJ_RETCODE_OK){ gapi_publisherQos *pqos = gapi_publisherQos__alloc(); rc = saj_construct_typed_java_object(env, dataWriterClassName, (PA_ADDRCAST)writer, &jwriter, signature, jtypeSupport); gapi_free(signature); if(listener != NULL){ saj_write_java_listener_address(env, writer, listener->listener_data); } if(pqos){ if(gapi_publisher_get_qos(publisher, pqos) == GAPI_RETCODE_OK){ if(pqos->entity_factory.autoenable_created_entities) { gapi_entity_enable(writer); } } gapi_free(pqos); } } } else if(listener != NULL){ saj_listenerDataFree(env, saj_listenerData(listener->listener_data)); } } if ((writerQos != (gapi_dataWriterQos *)GAPI_DATAWRITER_QOS_DEFAULT) && (writerQos != (gapi_dataWriterQos *)GAPI_DATAWRITER_QOS_USE_TOPIC_QOS)) { gapi_free(writerQos); } gapi_free(dataWriterClassName); } return jwriter; }
/** * Class: org_opensplice_dds_dcps_SubscriberImpl * Method: jniCreateDatareader * Signature: (LDDS/TopicDescription;LDDS/DataReaderQos;LDDS/DataReaderListener;)LDDS/DataReader; */ JNIEXPORT jobject JNICALL SAJ_FUNCTION(jniCreateDatareader)( JNIEnv *env, jobject jsubscriber, jobject jdescription, jobject jqos, jobject jlistener, jint jmask) { jobject jreader; jobject jtypeSupport; gapi_subscriber subscriber; gapi_dataReader reader; gapi_dataReaderQos* readerQos; gapi_domainParticipant participant; gapi_typeSupport typeSupport; gapi_string typeName; gapi_topicDescription description; struct gapi_dataReaderListener *listener; gapi_char* dataReaderClassName; gapi_char* signature; saj_returnCode rc; listener = NULL; jreader = NULL; reader = GAPI_OBJECT_NIL; subscriber = (gapi_subscriber) saj_read_gapi_address(env, jsubscriber); participant = gapi_subscriber_get_participant(subscriber); description = (gapi_topicDescription) saj_read_gapi_address(env, jdescription); typeName = gapi_topicDescription_get_type_name(description); typeSupport = gapi_domainParticipant_get_typesupport(participant, (const gapi_char*) typeName); gapi_free(typeName); jtypeSupport = saj_read_java_address((gapi_object)typeSupport); rc = saj_LookupTypeSupportDataReader(env, jtypeSupport, &dataReaderClassName); if(rc == SAJ_RETCODE_OK){ if ((*env)->IsSameObject (env, jqos, GET_CACHED(DATAREADER_QOS_DEFAULT)) == JNI_TRUE) { readerQos = (gapi_dataReaderQos *)GAPI_DATAREADER_QOS_DEFAULT; rc = SAJ_RETCODE_OK; } else if ((*env)->IsSameObject (env, jqos, GET_CACHED(DATAREADER_QOS_USE_TOPIC_QOS)) == JNI_TRUE) { readerQos = (gapi_dataReaderQos *)GAPI_DATAREADER_QOS_USE_TOPIC_QOS; rc = SAJ_RETCODE_OK; } else { readerQos = gapi_dataReaderQos__alloc(); rc = saj_DataReaderQosCopyIn(env, jqos, readerQos); } if(rc == SAJ_RETCODE_OK){ listener = saj_dataReaderListenerNew(env, jlistener); reader = gapi_subscriber_create_datareader(subscriber, description, readerQos, listener, (gapi_statusMask)jmask); if (reader != GAPI_OBJECT_NIL){ rc = saj_LookupTypeSupportConstructorSignature(env, jtypeSupport, &signature); if(rc == SAJ_RETCODE_OK){ gapi_subscriberQos *sqos = gapi_subscriberQos__alloc(); rc = saj_construct_typed_java_object(env, dataReaderClassName, (PA_ADDRCAST)reader, &jreader, signature, jtypeSupport); gapi_free(signature); if(listener != NULL){ saj_write_java_listener_address(env, reader, listener->listener_data); } if(sqos){ if(gapi_subscriber_get_qos(subscriber, sqos) == GAPI_RETCODE_OK){ if(sqos->entity_factory.autoenable_created_entities) { gapi_entity_enable(reader); } } gapi_free(sqos); } } } else if(listener != NULL){ saj_listenerDataFree(env, saj_listenerData(listener->listener_data)); } } if ((readerQos != (gapi_dataReaderQos *)GAPI_DATAREADER_QOS_DEFAULT) && (readerQos != (gapi_dataReaderQos *)GAPI_DATAREADER_QOS_USE_TOPIC_QOS)) { gapi_free(readerQos); } gapi_free(dataReaderClassName); } return jreader; }