src/PowerAuth/jni/SessionJNI.cpp
//
// private native long init(SessionSetup setup)
//
private native long init(SessionSetup setup)
private native long init ( SessionSetup setup )
CC7_JNI_METHOD_PARAMS(jlong, init, jobject setup)
{
	if (!setup) {
		CC7_ASSERT(false, "You have to provide SessionSetup object.");
		return 0;
	}
	jclass setupClazz  = CC7_JNI_MODULE_FIND_CLASS("SessionSetup");
	SessionSetup cppSetup;
	cppSetup.applicationKey			= cc7::jni::CopyFromJavaString(env, CC7_JNI_GET_FIELD_STRING(setup, setupClazz, "applicationKey"));
	cppSetup.applicationSecret		= cc7::jni::CopyFromJavaString(env, CC7_JNI_GET_FIELD_STRING(setup, setupClazz, "applicationSecret"));
	cppSetup.masterServerPublicKey	= cc7::jni::CopyFromJavaString(env, CC7_JNI_GET_FIELD_STRING(setup, setupClazz, "masterServerPublicKey"));
	cppSetup.sessionIdentifier		= CC7_JNI_GET_FIELD_INT(setup, setupClazz, "sessionIdentifier");
	cppSetup.externalEncryptionKey	= cc7::jni::CopyFromJavaByteArray(env, CC7_JNI_GET_FIELD_BYTEARRAY(setup, setupClazz, "externalEncryptionKey"));
	auto session = new Session(cppSetup);
	return (jlong)session;
}
CC7_JNI_METHOD_PARAMS ( jlong , init , jobject setup ) { if ( ! setup ) { CC7_ASSERT ( false , " " ) ; return 0 ; } jclass setupClazz = CC7_JNI_MODULE_FIND_CLASS ( " " ) ; SessionSetup cppSetup ; cppSetup . applicationKey = cc7 :: jni :: CopyFromJavaString ( env , CC7_JNI_GET_FIELD_STRING ( setup , setupClazz , " " ) ) ; cppSetup . applicationSecret = cc7 :: jni :: CopyFromJavaString ( env , CC7_JNI_GET_FIELD_STRING ( setup , setupClazz , " " ) ) ; cppSetup . masterServerPublicKey = cc7 :: jni :: CopyFromJavaString ( env , CC7_JNI_GET_FIELD_STRING ( setup , setupClazz , " " ) ) ; cppSetup . sessionIdentifier = CC7_JNI_GET_FIELD_INT ( setup , setupClazz , " " ) ; cppSetup . externalEncryptionKey = cc7 :: jni :: CopyFromJavaByteArray ( env , CC7_JNI_GET_FIELD_BYTEARRAY ( setup , setupClazz , " " ) ) ; auto session = new Session ( cppSetup ) ; return ( jlong ) session ; }
private native long init(SessionSetup setup)
private native long init ( SessionSetup setup )
// Copy data from java SessionSetup to backing C++ structure