|
- function testGPS(isGetGps) {
- if (null == session) {
- alert('无效的连接');
- return;
- }
- var gps = session.swGetPuChanel('PU_29378359', 65536);
- if (null == gps) {
- alert('没有该设备通道');
- return ;
- }
- if (isGetGps) {
- gps.swOpen({
- repeat: 10,
- interval: 2000,
- callback: OnGetGPS
- });
- } else {
- gps.swClose();
- }
- }
copycode- function OnGetGPS(options, response) {
- if (response.emms.code == jSW.RcCode.RC_CODE_S_OK) {
- var data = response.gps;
- document.getElementById('msg').innerHTML = 'orientationstate:' + data.orientationstate
- + '<br/>long:' + data.long
- + '<br/>lat:' + data.lat
- + '<br/>height:' + data.height
- + '<br/>speed:' + data.speed
- + '<br/>time:' + data.sttime.year + '-' + data.sttime.month + '-' + data.sttime.day + ' ' + data.sttime.hour + ':' + data.sttime.minute + ':' + data.sttime.second
- + '<br/>starcount:' + data.starcount;
- var gps_tmp = "data.long:"+data.long+"data.lat:"+data.lat;
- console.log("OnGetGPS.gps_tmp:"+gps_tmp);
- }
- }
copycode 不会用回掉函数,请指教,谢谢
|
|