FACT++  1.0
void server_getInfo_callback ( jobject *  _aDataEncoder,
void **  address,
int *  size 
)

Definition at line 1232 of file dim_jni.c.

References DBGx, dim_Dbg_SERVICE_CALLBACK, dim_jni_attachThread(), Java_dim_Server_getClientConnID(), NativeDataEncoder_encodeNativeData, NativeDataMemory_dataAddress, NativeDataMemory_dataSize, and theJavaVM.

Referenced by Java_dim_Server_addService().

1233 {
1234  /* server_getInfo_callback is invoked when dim needs the data for a service.
1235  * The data is obtained by calling the encodeData method of the DataEncoder
1236  * interface which returns us a Memory object. Next we extract the data address
1237  * and size from the returned Memory object.
1238  */
1239  /* Note, the DataEncoder can obtain the identity of the client by calling
1240  * getClient or getClientConnID */
1241 
1242  /* thou shall not not use volatile storage to return info to dim */
1243  jobject dataEncoder = *_dataEncoder;
1244  jobject theMemory;
1245  JNIEnv* env;
1246  int doit;
1247 
1248 // DBGe(dim_Dbg_SERVICE_CALLBACK) ; /* no report, only trap */
1249 
1250  doit = dim_jni_attachThread(&env);
1251 // (*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)&env, NULL);
1252 
1253  theMemory = (*env)->CallObjectMethod(env, dataEncoder, NativeDataEncoder_encodeNativeData);
1254  if(theMemory == NULL)
1255  {
1256  *address = 0;
1257  *size = 0;
1258  }
1259  else
1260  {
1261  *address = (void*) (*env)->GetLongField(env, theMemory, NativeDataMemory_dataAddress);
1262  *size = (*env)->GetIntField(env, theMemory, NativeDataMemory_dataSize);
1263 // printf("data address = %x, data size = %d\n",*address, *size);
1264  }
1265  DBGx(dim_Dbg_SERVICE_CALLBACK) printf("DimJNI: server_SERVICE_CALLBACK(dataEncoder=%08lx)\n ==> data: %08lx size %08x\n", (dim_long)dataEncoder, (dim_long) *address, *size);
1266 
1267  if ((*env)->ExceptionOccurred(env)) (*env)->ExceptionDescribe(env); // clear any possible exception, if we do not do this, all further methods will fail!!
1268  if(doit)
1269  (*theJavaVM)->DetachCurrentThread(theJavaVM);
1270 
1271  return;
1272 }
JavaVM * theJavaVM
Definition: dim_jni.c:85
jfieldID NativeDataMemory_dataSize
Definition: dim_jni.c:91
#define dim_Dbg_SERVICE_CALLBACK
Definition: dim_jni.h:44
long dim_long
Definition: dim_common.h:57
jmethodID NativeDataEncoder_encodeNativeData
Definition: dim_jni.c:112
#define DBGx(test)
Definition: dim_jni.c:66
int size
Definition: db_dim_server.c:17
float data[4 *1440]
if(extraDns) new Dns
int dim_jni_attachThread(JNIEnv **env)
Definition: dim_jni.c:171
jfieldID NativeDataMemory_dataAddress
Definition: dim_jni.c:90

+ Here is the call graph for this function:

+ Here is the caller graph for this function: