aboutsummaryrefslogtreecommitdiffstats
path: root/Java/com_phidgets_LEDPhidget.c
blob: 20097b9d2318babd9e1454c8faf4c122d1814895 (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
#include "../stdafx.h"
#include "phidget_jni.h"
#include "com_phidgets_LEDPhidget.h"
#include "../cphidgetled.h"

JNI_LOAD(accel, LED)
}

JNI_CREATE(LED)
JNI_INDEXED_GETFUNC(LED, DiscreteLED, DiscreteLED, jint)
JNI_INDEXED_SETFUNC(LED, DiscreteLED, DiscreteLED, jint)
JNI_GETFUNC(LED, LEDCount, LEDCount, jint)

JNIEXPORT jint JNICALL
Java_com_phidgets_LEDPhidget_getCurrentLimit(JNIEnv *env, jobject obj)
{
	CPhidgetLEDHandle h = (CPhidgetLEDHandle)(uintptr_t)
	    (*env)->GetLongField(env, obj, handle_fid);
	int error;
	CPhidgetLED_CurrentLimit v;
	if ((error = CPhidgetLED_getCurrentLimit(h, &v)))
		PH_THROW(error);
	return (jint)v;
}
JNI_SETFUNC(LED, CurrentLimit, CurrentLimit, jint)

JNIEXPORT jint JNICALL
Java_com_phidgets_LEDPhidget_getVoltage(JNIEnv *env, jobject obj)
{
	CPhidgetLEDHandle h = (CPhidgetLEDHandle)(uintptr_t)
	    (*env)->GetLongField(env, obj, handle_fid);
	int error;
	CPhidgetLED_Voltage v;
	if ((error = CPhidgetLED_getVoltage(h, &v)))
		PH_THROW(error);
	return (jint)v;
}
JNI_SETFUNC(LED, Voltage, Voltage, jint)