0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-21 17:07:55 +01:00

Refactored openap

This commit is contained in:
peteruithoven 2014-02-04 14:34:03 +01:00
parent 42e43c9a38
commit 1523ba3227
2 changed files with 26 additions and 28 deletions

View File

@ -91,6 +91,21 @@ function NetworkAPI() {
});
};
this.openAP = function() {
console.log("NetworkAPI:openAP");
$.ajax({
url: _wifiboxCGIBinURL + "/network/openap",
type: "POST",
dataType: 'json',
timeout: _timeoutTime,
success: function(response){
console.log("NetworkAPI:openAP response: ",response);
}
}).fail(function() {
console.log("NetworkAPI:openAP: timeout (normal behavior)");
});
};
this.signin = function() {
$.ajax({
url: self.wifiboxCGIBinURL + "/network/signin",

View File

@ -361,33 +361,16 @@ function NetworkPanel() {
this.createAP = function() {
console.log("createAP");
if (communicateWithWifibox) {
// save network related settings and on complete, create access point
_self.saveSettings(_self.readForm(),function(success) {
if(!success) return;
setAPModeState(AP_MODE_STATE.CREATING_AP,"");
_api.openAP();
// save network related settings and on complete, create access point
_self.saveSettings(_self.readForm(),function(success) {
if(!success) return;
setAPModeState(AP_MODE_STATE.CREATING_AP); // get latest substituted ssid
$.ajax({
url: _wifiboxCGIBinURL + "/network/openap",
type: "POST",
dataType: 'json',
timeout: _timeoutTime,
success: function(response){
console.log("Settings:createAP response: ",response);
}
}).fail(function() {
console.log("Settings:createAP: timeout (normal behavior)");
//clearTimeout(self.retrySaveSettingsDelay);
//self.retrySaveSettingsDelay = setTimeout(function() { self.saveSettings() },self.retryDelay); // retry after delay
});
setAPModeState(AP_MODE_STATE.CREATING_AP,"");
// after switching wifi network or creating a access point we delay the status retrieval
// because the webserver needs time to switch
clearTimeout(_retrieveNetworkStatusDelay);
_retrieveNetworkStatusDelay = setTimeout(function() { _self.retrieveNetworkStatus(true); }, _retrieveNetworkStatusDelayTime);
});
}
};*/
// after switching wifi network or creating a access point we delay the status retrieval
// because the webserver needs time to switch it's status
clearTimeout(_retrieveNetworkStatusDelay);
_retrieveNetworkStatusDelay = setTimeout(function() { _self.retrieveNetworkStatus(true); }, _retrieveNetworkStatusDelayTime);
});
};
}