aboutsummaryrefslogtreecommitdiffstats
path: root/Java/com_phidgets_BridgePhidget.c
blob: 6f42cf76183d85f3d07f98ac1e2491aaf08e17c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "../stdafx.h"
#include "phidget_jni.h"
#include "com_phidgets_BridgePhidget.h"
#include "../cphidgetbridge.h"

EVENT_VARS(bridgeData, BridgeData)

JNI_LOAD(bridge, Bridge)
	EVENT_VAR_SETUP(bridge, bridgeData, BridgeData, ID, V)
}

EVENT_HANDLER_INDEXED(Bridge, bridgeData, BridgeData, 
					  CPhidgetBridge_set_OnBridgeData_Handler, double)

JNI_CREATE(Bridge)

JNI_GETFUNC(Bridge, InputCount, InputCount, jint)
JNI_INDEXED_GETFUNC(Bridge, BridgeValue, BridgeValue, jdouble)
JNI_INDEXED_GETFUNC(Bridge, BridgeMin, BridgeMin, jdouble)
JNI_INDEXED_GETFUNC(Bridge, BridgeMax, BridgeMax, jdouble)
JNI_INDEXED_GETFUNCBOOL(Bridge, Enabled, Enabled)
JNI_INDEXED_SETFUNC(Bridge, Enabled, Enabled, jboolean)

JNIEXPORT jint JNICALL
Java_com_phidgets_BridgePhidget_getGain(JNIEnv *env, jobject obj, jint index)
{
	CPhidgetBridgeHandle h = (CPhidgetBridgeHandle)(uintptr_t)
	    (*env)->GetLongField(env, obj, handle_fid);
	int error;
	CPhidgetBridge_Gain v;
	if ((error = CPhidgetBridge_getGain(h, index, &v)))
		PH_THROW(error);
	return (jint)v;
}

JNI_INDEXED_SETFUNC(Bridge, Gain, Gain, jint)
JNI_GETFUNC(Bridge, DataRate, DataRate, jint)
JNI_SETFUNC(Bridge, DataRate, DataRate, jint)
JNI_GETFUNC(Bridge, DataRateMin, DataRateMin, jint)
JNI_GETFUNC(Bridge, DataRateMax, DataRateMax, jint)