mirror of
https://github.com/Doodle3D/doodle3d-connect.git
synced 2024-12-25 18:13:48 +01:00
ConnectAPI: made checking local optional
This commit is contained in:
parent
79e201c3ff
commit
b533b28e00
@ -16,6 +16,8 @@ function ConnectAPI() {
|
|||||||
this.boxDisapeared; // a box disappeared
|
this.boxDisapeared; // a box disappeared
|
||||||
//this.boxUpdated; // a box is updated / changed
|
//this.boxUpdated; // a box is updated / changed
|
||||||
|
|
||||||
|
this.checkLocal = true; // check for wired and access point boxes
|
||||||
|
|
||||||
var _apiURL = "http://connect.doodle3d.com/api";
|
var _apiURL = "http://connect.doodle3d.com/api";
|
||||||
var _networkAPI = new NetworkAPI();
|
var _networkAPI = new NetworkAPI();
|
||||||
var _timeoutTime = 3000;
|
var _timeoutTime = 3000;
|
||||||
@ -80,7 +82,9 @@ function ConnectAPI() {
|
|||||||
|
|
||||||
_self.list(function(foundBoxes) {
|
_self.list(function(foundBoxes) {
|
||||||
//console.log(" foundBoxes: ",foundBoxes);
|
//console.log(" foundBoxes: ",foundBoxes);
|
||||||
foundBoxes.push(_wiredBox); // always check for a wired box
|
if(_self.checkLocal) {
|
||||||
|
foundBoxes.push(_wiredBox); // check for a wired box
|
||||||
|
}
|
||||||
updateList(foundBoxes);
|
updateList(foundBoxes);
|
||||||
if(_running) {
|
if(_running) {
|
||||||
clearTimeout(_refreshDelay);
|
clearTimeout(_refreshDelay);
|
||||||
@ -88,6 +92,7 @@ function ConnectAPI() {
|
|||||||
}
|
}
|
||||||
}, function() {
|
}, function() {
|
||||||
console.log("ConnectAPI list retrieve failed");
|
console.log("ConnectAPI list retrieve failed");
|
||||||
|
if(_self.checkLocal) {
|
||||||
// if web is not accessible try to find a box as an accesspoint
|
// if web is not accessible try to find a box as an accesspoint
|
||||||
// if not found, we look for a wired box
|
// if not found, we look for a wired box
|
||||||
_networkAPI.alive(_apBox.localip,_boxTimeoutTime,function() {
|
_networkAPI.alive(_apBox.localip,_boxTimeoutTime,function() {
|
||||||
@ -95,6 +100,7 @@ function ConnectAPI() {
|
|||||||
}, function() {
|
}, function() {
|
||||||
updateList([_wiredBox]);
|
updateList([_wiredBox]);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
if(_running) {
|
if(_running) {
|
||||||
clearTimeout(_refreshDelay);
|
clearTimeout(_refreshDelay);
|
||||||
_refreshDelay = setTimeout(_self.refresh, _refreshInterval);
|
_refreshDelay = setTimeout(_self.refresh, _refreshInterval);
|
||||||
|
Loading…
Reference in New Issue
Block a user