00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "common.h"
00022 #include "net_threebit_jvr_dcb.h"
00023
00024
00025
00026
00027
00028
00029 JNIEXPORT jint JNICALL Java_net_threebit_jvr_dcb_open
00030 (JNIEnv *e, jclass c, jstring name, jint flags)
00031 {
00032 JVR_ENTER;
00033 char *namep = (char*) e->GetStringUTFChars(name,NULL);
00034 int ret = dcb_open(namep,flags);
00035 if (ret == -1) {
00036 jvr_throw(JVR_THROW_DG,"dcb_open(\"%s\",%d) failed",namep,flags);
00037 }
00038 e->ReleaseStringUTFChars(name,namep);
00039 JVR_EXIT; return ret;
00040 }
00041
00042
00043
00044
00045
00046
00047 JNIEXPORT jint JNICALL Java_net_threebit_jvr_dcb_close
00048 (JNIEnv *e, jclass c, jint dev)
00049 {
00050 JVR_ENTER;
00051 int ret = dcb_close(dev);
00052 if (ret == -1) {
00053 jvr_throw(JVR_THROW_DG,"dcb_close(%d) failed. errno = %d",dev,errno);
00054 }
00055 JVR_EXIT; return ret;
00056 }
00057
00058
00059
00060
00061
00062
00063 JNIEXPORT jint JNICALL Java_net_threebit_jvr_dcb_delconf
00064 (JNIEnv *e, jclass c, jint dev, jint confID)
00065 {
00066 JVR_ENTER;
00067 int ret = dcb_delconf(dev,confID);
00068 if (ret == -1) {
00069 jvr_throw(JVR_THROW_DG,"dcb_delconf(%d,%d) failed: %s",dev,confID,ATDV_ERRMSGP(dev));
00070 }
00071 JVR_EXIT; return ret;
00072 }
00073
00074
00075
00076
00077
00078
00079 JNIEXPORT jlong JNICALL Java_net_threebit_jvr_dcb_monconf
00080 (JNIEnv *e, jclass c, jint dev, jint confID)
00081 {
00082 JVR_ENTER;
00083 long ts;
00084 int ret = dcb_monconf(dev,confID,&ts);
00085 if (ret == -1) {
00086 jvr_throw(JVR_THROW_DG,"dcb_monconf(%d,%d) failed: %s",dev,confID,ATDV_ERRMSGP(dev));
00087 JVR_EXIT; return -1;
00088 }
00089 JVR_EXIT; return ts;
00090 }
00091
00092
00093
00094
00095
00096
00097 JNIEXPORT jint JNICALL Java_net_threebit_jvr_dcb_unmonconf
00098 (JNIEnv *e, jclass c, jint dev, jint confID)
00099 {
00100 JVR_ENTER;
00101 int ret = dcb_unmonconf(dev,confID);
00102 if (ret == -1) {
00103 jvr_throw(JVR_THROW_DG,"dcb_unmonconf(%d,%d) failed: %s",dev,confID,ATDV_ERRMSGP(dev));
00104 }
00105 JVR_EXIT; return ret;
00106 }
00107