⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 toscomm_wrap.cxx

📁 tinyos2.0版本驱动
💻 CXX
📖 第 1 页 / 共 3 页
字号:
JNIEXPORT jboolean JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1didEventOccur(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) {    jboolean jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    int arg2 ;    bool result;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     arg2 = (int)jarg2;     {        try {            result = (bool)(arg1)->didEventOccur(arg2);                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jboolean)result;     return jresult;}JNIEXPORT void JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1setDTR(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) {    NativeSerial *arg1 = (NativeSerial *) 0 ;    bool arg2 ;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     arg2 = jarg2 ? true : false;     {        try {            (arg1)->setDTR(arg2);                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return ;        }    }}JNIEXPORT void JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1setRTS(JNIEnv *jenv, jclass jcls, jlong jarg1, jboolean jarg2) {    NativeSerial *arg1 = (NativeSerial *) 0 ;    bool arg2 ;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     arg2 = jarg2 ? true : false;     {        try {            (arg1)->setRTS(arg2);                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return ;        }    }}JNIEXPORT jboolean JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1isDTR(JNIEnv *jenv, jclass jcls, jlong jarg1) {    jboolean jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    bool result;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     {        try {            result = (bool)(arg1)->isDTR();                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jboolean)result;     return jresult;}JNIEXPORT jboolean JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1isRTS(JNIEnv *jenv, jclass jcls, jlong jarg1) {    jboolean jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    bool result;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     {        try {            result = (bool)(arg1)->isRTS();                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jboolean)result;     return jresult;}JNIEXPORT jboolean JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1isCTS(JNIEnv *jenv, jclass jcls, jlong jarg1) {    jboolean jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    bool result;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     {        try {            result = (bool)(arg1)->isCTS();                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jboolean)result;     return jresult;}JNIEXPORT jboolean JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1isDSR(JNIEnv *jenv, jclass jcls, jlong jarg1) {    jboolean jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    bool result;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     {        try {            result = (bool)(arg1)->isDSR();                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jboolean)result;     return jresult;}JNIEXPORT jboolean JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1isRI(JNIEnv *jenv, jclass jcls, jlong jarg1) {    jboolean jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    bool result;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     {        try {            result = (bool)(arg1)->isRI();                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jboolean)result;     return jresult;}JNIEXPORT jboolean JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1isCD(JNIEnv *jenv, jclass jcls, jlong jarg1) {    jboolean jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    bool result;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     {        try {            result = (bool)(arg1)->isCD();                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jboolean)result;     return jresult;}JNIEXPORT void JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1sendBreak(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) {    NativeSerial *arg1 = (NativeSerial *) 0 ;    int arg2 ;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     arg2 = (int)jarg2;     {        try {            (arg1)->sendBreak(arg2);                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return ;        }    }}JNIEXPORT jlong JNICALL Java_net_tinyos_comm_TOSCommJNI_new_1NativeSerial(JNIEnv *jenv, jclass jcls, jstring jarg1) {    jlong jresult = 0 ;    char *arg1 ;    NativeSerial *result;        (void)jenv;    (void)jcls;    {        arg1 = 0;        if (jarg1) {            arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);            if (!arg1) return 0;        }    }    {        try {            result = (NativeSerial *)new NativeSerial((char const *)arg1);                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    *(NativeSerial **)&jresult = result;     {        if (arg1) jenv->ReleaseStringUTFChars(jarg1, arg1);     }    return jresult;}JNIEXPORT void JNICALL Java_net_tinyos_comm_TOSCommJNI_delete_1NativeSerial(JNIEnv *jenv, jclass jcls, jlong jarg1) {    NativeSerial *arg1 = (NativeSerial *) 0 ;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     {        try {            delete arg1;                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return ;        }    }}JNIEXPORT void JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1close(JNIEnv *jenv, jclass jcls, jlong jarg1) {    NativeSerial *arg1 = (NativeSerial *) 0 ;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     {        try {            (arg1)->close();                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return ;        }    }}JNIEXPORT jint JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1available(JNIEnv *jenv, jclass jcls, jlong jarg1) {    jint jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    int result;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     {        try {            result = (int)(arg1)->available();                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jint)result;     return jresult;}JNIEXPORT jint JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1read_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1) {    jint jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    int result;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     {        try {            result = (int)(arg1)->read();                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jint)result;     return jresult;}JNIEXPORT jint JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1read_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2, jint jarg3, jint jarg4) {    jint jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    signed char *arg2 ;    int arg3 ;    int arg4 ;    int result;    jbyte *jarr2 ;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     if (!SWIG_JavaArrayInSchar(jenv, &jarr2, &arg2, jarg2)) return 0;     arg3 = (int)jarg3;     arg4 = (int)jarg4;     {        try {            result = (int)(arg1)->read(arg2,arg3,arg4);                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jint)result;     SWIG_JavaArrayArgoutSchar(jenv, jarr2, arg2, jarg2);     delete [] arg2;     return jresult;}JNIEXPORT jint JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1write_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jint jarg2) {    jint jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    int arg2 ;    int result;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     arg2 = (int)jarg2;     {        try {            result = (int)(arg1)->write(arg2);                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jint)result;     return jresult;}JNIEXPORT jint JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1write_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jbyteArray jarg2, jint jarg3, jint jarg4) {    jint jresult = 0 ;    NativeSerial *arg1 = (NativeSerial *) 0 ;    signed char *arg2 ;    int arg3 ;    int arg4 ;    int result;    jbyte *jarr2 ;        (void)jenv;    (void)jcls;    arg1 = *(NativeSerial **)&jarg1;     if (!SWIG_JavaArrayInSchar(jenv, &jarr2, &arg2, jarg2)) return 0;     arg3 = (int)jarg3;     arg4 = (int)jarg4;     {        try {            result = (int)(arg1)->write((signed char const (*))arg2,arg3,arg4);                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = (jint)result;     SWIG_JavaArrayArgoutSchar(jenv, jarr2, arg2, jarg2);     delete [] arg2;     return jresult;}JNIEXPORT jstring JNICALL Java_net_tinyos_comm_TOSCommJNI_NativeSerial_1getTOSCommMap(JNIEnv *jenv, jclass jcls) {    jstring jresult = 0 ;    std::string result;        (void)jenv;    (void)jcls;    {        try {            result = NativeSerial::getTOSCommMap();                    } catch (comm_port_error &e) {            jclass clazz = jenv->FindClass("java/lang/Exception");            std::string s = "TOSComm JNI library runtime error: ";            s += + e.what();            jenv->ThrowNew( clazz, s.c_str() );            return 0;        }    }    jresult = jenv->NewStringUTF((&result)->c_str());     return jresult;}#ifdef __cplusplus}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -