0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-25 02:27:56 +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() { this.signin = function() {
$.ajax({ $.ajax({
url: self.wifiboxCGIBinURL + "/network/signin", url: self.wifiboxCGIBinURL + "/network/signin",

View File

@ -361,33 +361,16 @@ function NetworkPanel() {
this.createAP = function() { this.createAP = function() {
console.log("createAP"); 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 // after switching wifi network or creating a access point we delay the status retrieval
_self.saveSettings(_self.readForm(),function(success) { // because the webserver needs time to switch it's status
if(!success) return; clearTimeout(_retrieveNetworkStatusDelay);
setAPModeState(AP_MODE_STATE.CREATING_AP); // get latest substituted ssid _retrieveNetworkStatusDelay = setTimeout(function() { _self.retrieveNetworkStatus(true); }, _retrieveNetworkStatusDelayTime);
$.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);
});
}
};*/
} }