mobile CCTV,mobile surveillance,police body worn cameras

 forgetPW
 registerNow
search
view: 865|reply: 2
打印 prevThread nextThread

如何通过GPS回调函数OnGetGPS() 返回数据?

[copyURL]

14

主题

25

帖子

114

积分

member

Rank: 2

积分
114
jumpTo
owner
poston 2020-6-16 17:23 | authorOnly 回帖奖励 |倒序浏览 |阅读模式
  1. function testGPS(isGetGps) {
  2.     if (null == session) {
  3.         alert('无效的连接');
  4.         return;
  5.     }
  6.     var gps = session.swGetPuChanel('PU_29378359', 65536);
  7.     if (null == gps) {
  8.         alert('没有该设备通道');
  9.         return ;
  10.     }

  11.     if (isGetGps) {
  12.         gps.swOpen({
  13.             repeat: 10,
  14.             interval: 2000,
  15.             callback: OnGetGPS
  16.         });
  17.     } else {
  18.         gps.swClose();
  19.     }
  20. }
copycode
  1.     function OnGetGPS(options, response) {
  2.         if (response.emms.code == jSW.RcCode.RC_CODE_S_OK) {
  3.             var data = response.gps;
  4.             document.getElementById('msg').innerHTML = 'orientationstate:' + data.orientationstate
  5.                     + '<br/>long:' + data.long
  6.                     + '<br/>lat:' + data.lat
  7.                     + '<br/>height:' + data.height
  8.                     + '<br/>speed:' + data.speed
  9.                     + '<br/>time:' + data.sttime.year + '-' + data.sttime.month + '-' + data.sttime.day + ' ' + data.sttime.hour + ':' + data.sttime.minute + ':' + data.sttime.second
  10.                     + '<br/>starcount:' + data.starcount;
  11.             var gps_tmp = "data.long:"+data.long+"data.lat:"+data.lat;
  12.             console.log("OnGetGPS.gps_tmp:"+gps_tmp);

  13.         }
  14.     }
copycode
不会用回掉函数,请指教,谢谢
reply

使用道具 report

2

主题

98

帖子

394

积分

midMem

Rank: 3Rank: 3

积分
394
sofa
poston 2020-6-16 17:45 | authorOnly
有什么报错吗
reply agree Against

使用道具 report

60

主题

1415

帖子

5819

积分

Moderator

Rank: 7Rank: 7Rank: 7

积分
5819
bench
poston 2020-6-16 18:06 | authorOnly
其实,多阅读下我们的DEMO,里面就是大量的例子,此外,百度看看,保证10分钟就理解了。
reply agree Against

使用道具 report

creditRule

QQ|wireless surveillance

GMT+8, 2024-5-17 02:41 , Processed in 0.053713 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

QuickReply backToTop BackToList