mobile CCTV,mobile surveillance,police body worn cameras

 forgetPW
 registerNow
search
view: 823|reply: 6
打印 prevThread nextThread

前端 swInit 未定义

[copyURL]

2

主题

6

帖子

36

积分

newBie

Rank: 1

积分
36
jumpTo
owner
poston 2020-11-19 15:03 | authorOnly 回帖奖励 |倒序浏览 |阅读模式
需求是要在其他地方获取设备数据,因此需要对接设备接口,先照着你们的写一个测试的(js代码如下图),会报swInit未定义,想问下是哪里的问题:

本帖子中包含更多资源

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

x
reply

使用道具 report

1

主题

383

帖子

1466

积分

vipMem

Rank: 6Rank: 6

积分
1466
sofa
poston 2020-11-19 15:08 | authorOnly
jSW.swInit()    不是  swinit
reply agree Against

使用道具 report

2

主题

6

帖子

36

积分

newBie

Rank: 1

积分
36
bench
 Owner| poston 2020-11-19 15:19 | authorOnly
bai_315 post on2020-11-19 15:08
jSW.swInit()    不是  swinit

哦哦,好的
但是改正之后之后又报了下面的错,您再帮看下,是什么问题

本帖子中包含更多资源

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

x
reply agree Against

使用道具 report

1

主题

383

帖子

1466

积分

vipMem

Rank: 6Rank: 6

积分
1466
ground
poston 2020-11-19 15:32 | authorOnly
tangyue post on2020-11-19 15:19
哦哦,好的
但是改正之后之后又报了下面的错,您再帮看下,是什么问题

您那边先确定下web端是否部署好了 还有web插件是不是最新版
reply agree Against

使用道具 report

2

主题

6

帖子

36

积分

newBie

Rank: 1

积分
36
5#
 Owner| poston 2020-11-19 15:52 | authorOnly
bai_315 post on2020-11-19 15:32
您那边先确定下web端是否部署好了 还有web插件是不是最新版
  1. <script>
  2.     window.onload = function () {
  3.       // 初始化库, 使用web服务器域名
  4.       const initCfgParams = {
  5.         bocxws: true, //使用ocx实现的websocket
  6.         bManualLP: false //库内自动获取全部设备列表,手动获取设备列表
  7.       }

  8.       const initParams = ({
  9.         url: 'http://47.92.28.249:8081/', // bv_nginx.exe服务器地址
  10.         calltype: jSW.CallProtoType.HTTP,
  11.         config: initCfgParams,
  12.         oninit: onInitHasResult
  13.       })

  14.       const rc = jSW.swInit(initParams);
  15.     }

  16.     function onInitHasResult(rcInitResult){
  17.       if(rcInitResult == jSW.RcCode.RC_CODE_S_OK){
  18.         //在这之后才能调用其他接口,否则会报错,proto找不到等
  19.         initJSW()
  20.       }
  21.     }

  22.     let session = null;

  23.     function initJSW() {
  24.       if (session) { delete session; }

  25.       // 创建连接实例
  26.       session = new jSW.SWSession({
  27.         server: '47.92.28.249', /**ControlCenter服务器IP*/
  28.         port: 9701, /**ControlCenter服务器端口号*/
  29.         user: 'admin' /**ControlCenter服务器登录用户名*/
  30.       })

  31.       // 注册事件的回调函数
  32.       session.swAddCallBack('login', function (sender, event, jsonObj) {
  33.         console.log(sender, event, jsonObj)
  34.       })

  35.       session.swLogin('123456')
  36.     }

  37.     window.onbeforeunload = function () {
  38.       jSW.swDeInit()
  39.     }
  40. </script>
copycode
reply agree Against

使用道具 report

1

主题

383

帖子

1466

积分

vipMem

Rank: 6Rank: 6

积分
1466
6#
poston 2020-11-19 15:56 | authorOnly

url: 'http://47.92.28.249:8081/', // bv_nginx.exe服务器地址


把‘8081’后面的反斜杠去掉
reply agree Against

使用道具 report

2

主题

6

帖子

36

积分

newBie

Rank: 1

积分
36
7#
 Owner| poston 2020-11-19 17:05 | authorOnly
bai_315 post on2020-11-19 15:56
url: 'http://47.92.28.249:8081/', // bv_nginx.exe服务器地址

嗯嗯,好的
reply agree Against

使用道具 report

creditRule

QQ|wireless surveillance

GMT+8, 2024-5-17 03:19 , Processed in 0.059573 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

QuickReply backToTop BackToList