aboutsummaryrefslogtreecommitdiffstats
path: root/Java/com_phidgets_TextLEDPhidget.c
blob: f6f139c31714886e45f894c3b196f91c03694f27 (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
#include "../stdafx.h"
#include "phidget_jni.h"
#include "com_phidgets_TextLEDPhidget.h"
#include "../cphidgettextled.h"

JNI_LOAD(led, TextLED)
}

JNI_CREATE(TextLED)
JNI_GETFUNC(TextLED, Brightness, Brightness, jint)
JNI_SETFUNC(TextLED, Brightness, Brightness, jint)
JNI_GETFUNC(TextLED, RowCount, RowCount, jint)
JNI_GETFUNC(TextLED, ColumnCount, ColumnCount, jint)

JNIEXPORT void JNICALL
Java_com_phidgets_TextLEDPhidget_setDisplayString(JNIEnv *env, jobject obj, jint index, jstring v)
{
	CPhidgetTextLEDHandle h = (CPhidgetTextLEDHandle)(uintptr_t)
	    (*env)->GetLongField(env, obj, handle_fid);
	int error;
    jboolean iscopy;
    const char *textString = (*env)->GetStringUTFChars(
                env, v, &iscopy);

	if ((error = CPhidgetTextLED_setDisplayString(h, index, (char *)textString)))
		PH_THROW(error);

	(*env)->ReleaseStringUTFChars(env, v, textString);
}