FACT++  1.0
jint send_data ( JNIEnv *  env,
jstring  name,
jobject  theCompletionHandler,
jint  mode,
jint  timeout,
void *  data_address,
int  data_size 
)

Definition at line 437 of file dim_jni.c.

References DBGm, DBGx, dim_Dbg_SEND_NATIVE, dim_Native_F_STAMPED, dim_Native_F_WAIT, Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIZ(), request_command(), send_callback(), SendSynchronizer, SendSynchronizer_getCompletionCode, and SendSynchronizer_new.

Referenced by Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3B(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3C(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3D(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3F(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3I(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3J(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3S(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3Z(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIB(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIC(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IID(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIF(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2III(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIJ(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIJI(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IILjava_lang_String_2(), Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIS(), and Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIZ().

438 {
439  jint ret;
440  int stamped = 0;
441  void (*callback_funct)();
442  jobject callback_param;
443  jobject theSendSynchronizer;
444 
445  extern int request_command(char *, void *, int , void (*)(), dim_long, int);
446 
447  const char* cmnd = (*env)->GetStringUTFChars(env, name, 0);
448 
449 // DBGe(dim_Dbg_SEND_NATIVE) ; /* trap only, report later */
450 
451  if(timeout){}
452  if(mode & dim_Native_F_STAMPED) stamped = 1;
453  if(mode & dim_Native_F_WAIT) // note: dim_Native_F_WAIT defined as -2147483648L //(0x80000000)
454  {
455  // Create a SendSynchronizer object using theCompletionHandler
456  theSendSynchronizer = (*env)->NewObject(env, SendSynchronizer, SendSynchronizer_new, theCompletionHandler);
457  callback_param = (*env)->NewGlobalRef(env, theSendSynchronizer);
458  callback_funct = &send_callback;
459  }
460  else if(theCompletionHandler)
461  {
462  // create a global reference of the CompletionHandler if present
463  callback_param = (*env)->NewGlobalRef(env, theCompletionHandler);
464  callback_funct = &send_callback;
465  }
466  else
467  {
468  callback_param = 0;
469  callback_funct = 0;
470  }
471 
472  // Send the request
473  ret = request_command((char *)cmnd, data_address, data_size, callback_funct, (dim_long)callback_param, stamped);
474  DBGx(dim_Dbg_SEND_NATIVE) printf("DimJNI: Client.Send(%s,(%s) 0x%x) returns %d \n", cmnd, send_data_format, * (int*) data_address, ret);
475 
476  // release the String
477  (*env)->ReleaseStringUTFChars(env, name, cmnd);
478 
479 //if the send request was not queued and there is a CompletionHandler, we call the send_callback
480  if(!ret && callback_param)
481  {
482  DBGm(dim_Dbg_SEND_NATIVE) printf("DimJNI: Native.send calls callback as bug fix.\n");
483 // TODO we do not have to call send_callback(&callback_param, &ret); when not queued? //Apparently we do not need this.
484  }
485 
486  if(mode & dim_Native_F_WAIT)
487  {
488  ret=(*env)->CallIntMethod(env, theSendSynchronizer, SendSynchronizer_getCompletionCode, 0);
489  DBGx(dim_Dbg_SEND_NATIVE) printf("DimJNI: SEND returns (after wait) %08x\n",ret);
490  }
491 
492  return ret;
493 }
#define dim_Native_F_STAMPED
Definition: dim_jni.h:24
int mode
jmethodID SendSynchronizer_new
Definition: dim_jni.c:96
static char * send_data_format
Definition: dim_jni.c:433
jmethodID SendSynchronizer_getCompletionCode
Definition: dim_jni.c:98
#define DBGm(test)
Definition: dim_jni.c:65
long dim_long
Definition: dim_common.h:57
void send_callback(jobject *_aCompletionHandler, int *_status)
Definition: dim_jni.c:413
#define DBGx(test)
Definition: dim_jni.c:66
#define dim_Dbg_SEND_NATIVE
Definition: dim_jni.h:36
if(extraDns) new Dns
jclass SendSynchronizer
Definition: dim_jni.c:95
int request_command(char *serv_name, void *serv_address, int serv_size, void(*usr_routine)(), dim_long tag, int stamped)
Definition: dic.c:736
#define dim_Native_F_WAIT
Definition: dim_jni.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function: