完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我为AgU2702A示波器的IVI-C驱动程序编写了一个JNI Wrapper。
驱动程序DLL称为AgU2701A.dll。 包装器工作正常,除非我在我的java应用程序中使用两个不同的线程。 当我拨打电话时 AgU2701A_GetAttributeViString他们将成功并向我提供所需的信息,例如 驱动程序描述或驱动程序修 但是,调用AgU2701A_SetAttributeViReal64来设置水平“每条记录的时间”失败,状态为0x80000000。 如果我只从一个Java线程使用相同的包装器DLL,一切正常。 作为我在JNI dll中如何实现此包装器的示例,请观察:JNIEXPORT jobject JNICALL Java_com_test_setAttributeViReal64(JNIEnv * env,jclass obj,jobject Vi,jstring RepCapIdentifier,jlong AttributeId,jdouble AttributeValue){//返回值的字段。 jobject viStatusWrapperObjectRetVal = NULL; ViBoolean lock = 0; const char * repCapIdentifier; if(globalWrappersInitialized){jint viSession = getViSessionId(env,Vi); repCapIdentifier = env-> GetStringUTFChars(RepCapIdentifier,0); //本机驱动程序调用。 status = AgU2701A_LockSession(viSession,& lock); status = AgU2701A_SetAttributeViReal64(viSession,repCapIdentifier,(ViAttr)AttributeId,(ViReal64)AttributeValue); AgU2701A_UnlockSession(viSession,& lock); //准备返回值。 viStatusWrapperObjectRetVal = env-> NewObject(viStatusWrapperClass,viStatusWrapperConstructor,status); } else {throwIviCException(env,NOT_INITIALIZED_MESSAGE); } return viStatusWrapperObjectRetVal; 我不知道这个错误代码号是什么意思,因为getError,error_mossage或query_error无法识别它。 如果有人知道这里发生了什么,请随时提交,我会检查。 此致,MaikEdited:Kiamur于2012年3月19日上午11:11 以上来自于谷歌翻译 以下为原文 Hi, I wrote a JNI Wrapper around the IVI-C driver for the AgU2702A oscilloscope. The driver dll is called AgU2701A.dll. The wrapper works fine unless I use it from two different threads in my java application. When I do calls to e.g. AgU2701A_GetAttributeViString they will succed and give me the requested information like e.g. driver description or driver revision. However, a call to AgU2701A_SetAttributeViReal64 for setting up the horizontal "time per record" fails with status 0x80000000. If I use the same wrapper dll from just one Java thread, everything works fine. As an example of how I implemented this wrapper in my JNI dll watch this: JNIEXPORT jobject JNICALL Java_com_test_setAttributeViReal64 (JNIEnv *env, jclass obj, jobject Vi, jstring RepCapIdentifier, jlong AttributeId, jdouble AttributeValue) { // Field for return value. jobject viStatusWrapperObjectRetVal = NULL; ViBoolean lock = 0; const char *repCapIdentifier; if(globalWrappersInitialized) { jint viSession = getViSessionId(env, Vi); repCapIdentifier = env->GetStringUTFChars(RepCapIdentifier, 0); // Native driver call. status = AgU2701A_LockSession(viSession, &lock); status = AgU2701A_SetAttributeViReal64 (viSession, repCapIdentifier, (ViAttr) AttributeId, (ViReal64) AttributeValue); AgU2701A_UnlockSession(viSession, &lock); // Prepare return value. viStatusWrapperObjectRetVal = env->NewObject(viStatusWrapperClass, viStatusWrapperConstructor, status); } else { throwIviCException(env, NOT_INITIALIZED_MESSAGE); } return viStatusWrapperObjectRetVal; } I have no idea what this error code number means because it is not recognized by getError, error_mossage or query_error. Please, if somebody has an idea what is going on here, feel free to submit it and I'll check. Regards, Maik Edited by: Kiamur on Mar 19, 2012 11:11 AM |
|
相关推荐
1个回答
|
|
嗨再次,我认为我的问题是IviConfigurationServer.dll。
我在流程资源管理器中查看了我的Java App,发现只有当前Java线程调用init()或init_withOptions()函数时才会加载IviConfigurationServer.dll。 之后,仍然加载IviConfigurationServer.dll,一切正常。 不幸的是,当Java线程完成时,IviConfigurationServer.dll被卸载。 所有其他示波器相关的dll似乎在整个Java应用程序生命周期中都存在。 我在“IVI-3.5:配置服务器规范”文档中找到了第3.8章“避免配置服务器”,据说可以在没有IviCopnfigurationServer.dll的情况下使用该驱动程序。 至少这是我从这些方面读到的。 任何人都可以确认,没有Ivi配置服务器就可以使用AgU2701A驱动程序吗? 这里有人可以与我分享任何经验吗? 不幸的是,这一章非常不具体。 例如。 是的“应用程序必须明确指定IVI-C DLL的位置,或IVI-COM类的ProgID。” - 什么是IVI-C dll? 驱动程序DLL或IviConfigurationServer.dll? - “指定位置”是什么意思? 我想我必须自己加载所有需要的库,不是吗? - 什么都需要的库? 只有AgU2701A.dll? - 我是否必须通过GetProcAddress()函数获取我想要使用的函数的所有名称? 请问有人至少回答我的一些问题吗? 此致,MaikEdited:Kiamur于2012年3月19日上午11:12 以上来自于谷歌翻译 以下为原文 Hi again, I think that my problem is the IviConfigurationServer.dll. I watched my Java App in a process explorer and found out, that the IviConfigurationServer.dll is only loaded if the current Java thread calls the init() or init_withOptions() function. After that and with the IviConfigurationServer.dll still loaded, everything works fine. Unfortunately, the IviConfigurationServer.dll is unloaded, when the Java thread finishes. All other oscilloscope related dlls seem to be present during the whole Java application lifetime. I found chapter 3.8 "Avoiding the Configuration Server" in the "IVI-3.5: Configuration Server Specification" document, where it is said that it is possible to use the driver without the IviCopnfigurationServer.dll. At least this is what I read from these lines. Can anybody confirm, that it is possible to use the AgU2701A driver without the Ivi config server? Has anybody here any experience that he can share with me? Unfortunately that chapter is very unspecific. E.g. is says "The application program must explicitly specify the location of the IVI-C DLL, or the ProgID of the IVI-COM class." - What IVI-C dll is meant? the driver dll or the IviConfigurationServer.dll? - What is meant by "specify the location"?. I think I have to load all needed libraries myself, havn't I? - What are all needed libs? Only the AgU2701A.dll? - Do I have to get all the names of the functions I want to use via the GetProcAddress() function? Can please somebody answer at least some of my questions? Regards, Maik Edited by: Kiamur on Mar 19, 2012 11:12 AM |
|
|
|
只有小组成员才能发言,加入小组>>
1283 浏览 0 评论
2371 浏览 1 评论
2189 浏览 1 评论
2062 浏览 5 评论
2946 浏览 3 评论
1104浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
751浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
922浏览 0评论
1284浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-22 22:05 , Processed in 1.560374 second(s), Total 77, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号