mobile CCTV,mobile surveillance,police body worn cameras

 forgetPW
 registerNow
search
view: 2478|reply: 16
打印 prevThread nextThread

jna调用bvcsp传参问题

[copyURL]

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

积分
205
jumpTo
owner
poston 2021-1-6 15:47 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式
项目是JAVA的,使用jna调用dll和so,但对参数映射不是很懂,现在登录返回的错误码是-65535,参数错误,能看看传的参数哪里有问题么?
reply

使用道具 report

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

积分
205
sofa
 Owner| poston 2021-1-6 16:28 | 显示全部楼层
lihui2006 post on2021-1-6 16:08
是CUSDK还是安卓侧的?
您说明一下上下文。

用的是BVCSP SDK,调用BVCSP_Login()返回参数错误,java这边的参数映射不知怎么写,有没有相关的例子
reply agree Against

使用道具 report

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

积分
205
bench
 Owner| poston 2021-1-6 18:40 | 显示全部楼层
lihui2006 post on2021-1-6 17:00
您是安卓侧开发,还是WINDOWS平台客户端开发CUSDK?
bvcuSDK/bvcspSDK ? 什么平台下的版本

java平台,bvcspSDK64位
reply agree Against

使用道具 report

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

积分
205
ground
 Owner| poston 2021-1-7 09:24 | 显示全部楼层
tony258 post on2021-1-7 09:19
https://github.com/besovideo/bvc ... PTest/BVCSPTest.cpp

这个是C++的demo吧,有懂java的可以看看jna映射这块的问题么?
reply agree Against

使用道具 report

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

积分
205
5#
 Owner| poston 2021-1-7 10:32 | 显示全部楼层
lihui2006 post on2021-1-7 10:26
昨天研发答复了, java调用bvcsp没有提供demo

不是要demo,是看下问题传参的问题!
reply agree Against

使用道具 report

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

积分
205
6#
 Owner| poston 2021-1-7 11:49 | 显示全部楼层
调用库
  1. public interface VoiceLibrary extends StdCallLibrary {

  2.     VoiceLibrary INSTANCE = Native.load(
  3.             System.getProperty("user.dir")+"\\src\\main\\resources\\voice\\BVCSP_x64.dll", VoiceLibrary.class);

  4.     int BVCSP_Initialize(int bAutoHandle, int iTCPDataPort);

  5.     int BVCSP_Login(PointerByReference phSession, BVCSP_SessionParam pParam);

  6. }
copycode

登录调用
  1. public static void main(String[] args){
  2.         int result;
  3.         result= VoiceLibrary.INSTANCE.BVCSP_Initialize(1,0);
  4.         System.out.println(result);
  5.         PointerByReference pHSession=new PointerByReference();
  6.         Pointer hSession = pHSession.getValue();
  7.         BVCSP_SessionParam.ByReference sessionParam = new BVCSP_SessionParam.ByReference();
  8.         sessionParam.iSize = 500;
  9.         sessionParam.iTimeOut = 8000;
  10.         sessionParam.szClientID = "towercloud".getBytes();
  11.         sessionParam.szServerAddr = "192.168.1.173".getBytes();
  12.         sessionParam.szUserName = "admin".getBytes();
  13.         sessionParam.szPassword = "123456".getBytes();
  14.         sessionParam.szUserAgent = "bvcsp_towercloud".getBytes();
  15.         sessionParam.iClientType = 16;
  16.         sessionParam.iServerPort = 9701;
  17.         sessionParam.iCmdProtoType = 0;
  18.         sessionParam.OnEvent = new LoginCallbackFunction.OnEventImpl();
  19.         sessionParam.OnCommand = new LoginCallbackFunction.OnCommandImpl();
  20.         sessionParam.OnNotify = new LoginCallbackFunction.OnNotifyImpl();
  21.         sessionParam.OnDialogCmd = new LoginCallbackFunction.OnDialogCmdImpl();
  22.         sessionParam.stEntityInfo.pPUInfo.szName = "fang_CU".getBytes();

  23.         for (int i = 0; i < 4; ++i){
  24.             sessionParam.stEntityInfo.pChannelList[i] = new BVCU_PUCFG_ChannelInfo.ByReference();
  25.             sessionParam.stEntityInfo.pChannelList[i].iChannelIndex = i;
  26.             sessionParam.stEntityInfo.pChannelList[i].iMediaDir = 10;
  27.         }
  28.         sessionParam.stEntityInfo.iChannelCount = 4;

  29.         result=VoiceLibrary.INSTANCE.BVCSP_Login(pHSession,sessionParam);
  30.         System.out.println(result);
  31.     }
copycode


参数定义
  1. public class BVCSP_SessionParam extends Structure {
  2.     // 本结构体的大小,分配者应初始化为sizeof(BVCSP_ServerParam)
  3.     public int iSize;

  4.     // 用户自定义数据。通常用于回调通知
  5.     public Pointer pUserData;

  6.     // 用户类型。 见 BVCSP_CLIENT_TYPE_*
  7.     public int  iClientType;

  8.     // 一个通道能够同时被打开几路流。 iClientType为PU时有效,0:不限制个数。库内最大支持64
  9.     public int  iMaxChannelOpenCount;

  10.     /* 登录实体的具体信息
  11.        注意: 这里BVCSP_EntityInfo中的指针,库内会根据iClientType类型深拷贝。 */
  12.     public BVCSP_EntityInfo.ByValue stEntityInfo = new BVCSP_EntityInfo.ByValue();

  13.     // Server地址,只支持IP地址,如127.0.0.1,域名需上层转换为IP地址
  14.     public byte[]  szServerAddr = new byte[128];

  15.     // Server端口号
  16.     public int  iServerPort;

  17.    
  18.     public byte[] szClientID = new byte[32];

  19.     // 应用程序名称。该名称被Server端记录到Log中
  20.     public byte[] szUserAgent = new byte[32];

  21.     // 登录用户名
  22.     public byte[] szUserName = new byte[32];

  23.     // 登录密码
  24.     public byte[] szPassword = new byte[64];

  25.     // Ukey ID。从UKey中获得的UKeyID。登录验证中使用。如果为空,表示没有UKey
  26.     public byte[] szUKeyID = new byte[32];

  27.     // Ukey 授权码。 从UKey中获得的验证授权码。如果为空,表示没有UKey授权码
  28.     public byte[] szUkeyCode = new byte[64];

  29.     /* 与Server之间命令通道使用的传输层协议类型,参见BVCU_PROTOTYPE_*。
  30.       目前仅支持 UDP 和 TCP */
  31.     public int iCmdProtoType;

  32.     // 命令超过iTimeOut未收到回响则认为失败,单位毫秒。必须>0 默认:30*1000毫秒
  33.     public int iTimeOut;

  34.    
  35.     public LoginCallbackFunction.OnEvent OnEvent;


  36.     public LoginCallbackFunction.OnCommand OnCommand;

  37.    
  38.     public LoginCallbackFunction.OnNotify OnNotify;

  39.    
  40.     public LoginCallbackFunction.OnDialogCmd OnDialogCmd;

  41.     // 保留,必须初始化为0
  42.     public int iReserved[] = new int[4];

  43.     @Override
  44.     protected List<String> getFieldOrder() {
  45.         return Arrays.asList("iSize","pUserData","iClientType","iMaxChannelOpenCount","stEntityInfo","szServerAddr",
  46.                 "iServerPort","szClientID","szUserAgent","szUserName","szPassword","szUKeyID","szUkeyCode",
  47.                 "iCmdProtoType","iTimeOut","OnEvent","OnCommand","OnNotify","OnDialogCmd","iReserved");
  48.     }

  49.     public static class ByReference extends BVCSP_SessionParam implements Structure.ByReference {}
  50.     public static class ByValue extends BVCSP_SessionParam implements Structure.ByValue {}
  51. }
copycode
reply agree Against

使用道具 report

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

积分
205
7#
 Owner| poston 2021-1-8 16:08 | 显示全部楼层
在bvcu的sdk看到有封装的代码,能把这块封装的打包出来64位的么?下图的CBVCU和CBVCUSndCmd
主要就是需要接群聊的群组和人员管理那块,语音视频暂不需要使用的


本帖子中包含更多资源

pls login 才可以下载或查看,没有帐号?registerNow

x
reply agree Against

使用道具 report

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

积分
205
8#
 Owner| poston 2021-1-8 16:21 | 显示全部楼层
tony258 post on2021-1-8 16:07
昨天的参数传递失败问题找到原因了

方便把工程发过来么,这边加了还是不行,怀疑是参数映射没对
reply agree Against

使用道具 report

creditRule

QQ|wireless surveillance

GMT+8, 2024-5-19 07:29 , Processed in 0.062502 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

QuickReply backToTop BackToList