mobile CCTV,mobile surveillance,police body worn cameras

 forgetPW
 registerNow
search
12
backToList newPost
Owner: ZTO
打印 prevThread nextThread

jna调用bvcsp传参问题

[copyURL]

6

主题

175

帖子

1258

积分

vipMem

Rank: 6Rank: 6

积分
1258
11#
poston 2021-1-7 10:37 | authorOnly
哦,好的,那具体问题代码可贴在这里我们看看。
reply agree Against

使用道具 report

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

积分
205
12#
 Owner| poston 2021-1-7 11:49 | authorOnly
调用库
  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

0

主题

22

帖子

90

积分

member

Rank: 2

积分
90
13#
poston 2021-1-8 16:07 | authorOnly
昨天的参数传递失败问题找到原因了

本帖子中包含更多资源

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

x
reply agree Against

使用道具 report

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

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


本帖子中包含更多资源

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

x
reply agree Against

使用道具 report

13

主题

49

帖子

205

积分

midMem

Rank: 3Rank: 3

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

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

使用道具 report

60

主题

1413

帖子

5805

积分

Moderator

Rank: 7Rank: 7Rank: 7

积分
5805
16#
poston 2021-1-11 10:09 | authorOnly
我们从来没搞过jna,的确没有,我们平台都是C++接口的,从来没有JAVA的接口。
reply agree Against

使用道具 report

0

主题

22

帖子

90

积分

member

Rank: 2

积分
90
17#
poston 2021-1-11 10:48 | authorOnly
ZTO post on2021-1-8 16:21
方便把工程发过来么,这边加了还是不行,怀疑是参数映射没对

我写的demo,仅传参成功(传参方法即回复中方式),依然无法正常使用,
回调时在java层出现内存问题。
(使用jnaerator工具)
reply agree Against

使用道具 report

12
backToList newPost

creditRule

QQ|wireless surveillance

GMT+8, 2024-5-5 21:36 , Processed in 0.059567 second(s), 18 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

QuickReply backToTop BackToList