Пример #1
0
JNIEXPORT jint JNICALL 
Java_ipc_java_IPC_IPC_1queryResponse (JNIEnv *env, jclass theClass, jstring msgName,
			     jint length, jlong byteArray, jobject response,
			     jlong timeoutMSecs)
{
  const char *cmsgName;
  int retVal;
  BYTE_ARRAY replyHandle;
  FORMATTER_PTR replyFormat;

  cmsgName = (*env)->GetStringUTFChars(env, msgName, 0);
  retVal = _IPC_queryResponse(cmsgName, (int)length,
			      (BYTE_ARRAY)(size_t)byteArray,
			      &replyHandle, &replyFormat,
			      (unsigned int)timeoutMSecs);
  (*env)->ReleaseStringUTFChars(env, msgName, cmsgName);

  if (retVal == IPC_OK) {
    jclass queryResponseClass = (*env)->GetObjectClass(env, response);
    jfieldID byteArrayFieldID = (*env)->GetFieldID(env, queryResponseClass,
						   "byteArray", "J");
    jfieldID formatterFieldID = (*env)->GetFieldID(env, queryResponseClass,
						   "formatter", "J");
    (*env)->SetLongField(env, response, byteArrayFieldID,
			 (jlong)(size_t)replyHandle);
    (*env)->SetLongField(env, response, formatterFieldID,
			 (jlong)(size_t)replyFormat);
  }

  return (jint)retVal;
}
Пример #2
0
IPC_RETURN_TYPE IPC_queryResponse (const char *msgName, 
				   unsigned int length, BYTE_ARRAY content,
				   BYTE_ARRAY *replyHandle,
				   unsigned int timeoutMsecs)
{
  return _IPC_queryResponse(msgName, length, content, 
			    replyHandle, NULL, NULL, timeoutMsecs);
}
Пример #3
0
IPC_RETURN_TYPE IPC_queryResponseVC (const char *msgName, 
				     IPC_VARCONTENT_PTR varcontent,
				     BYTE_ARRAY *replyHandle, 
				     unsigned int timeoutMsecs)
{
  if (!varcontent) {
    RETURN_ERROR(IPC_Null_Argument);
  } else {
    return _IPC_queryResponse(msgName, varcontent->length, varcontent->content,
			      replyHandle, NULL, NULL, timeoutMsecs);
  }
}