diff --git a/app.js b/app.js
index e5bc8db..dbb9f86 100644
--- a/app.js
+++ b/app.js
@@ -10,8 +10,9 @@ var fs = require('fs');
var OUTPUT_FILE = "result.txt";
var LOGIN_USER = "admin";
-var LOGIN_PWD = "PIN CODE";
+var LOGIN_PWD = "160973";
var HNAP_URL = "http://192.168.1.128/HNAP1";
+//var HNAP_URL = "http://192.168.0.60/HNAP1";
var POLLING_INTERVAL = 60000;
soapclient.login(LOGIN_USER, LOGIN_PWD, HNAP_URL).done(function (status) {
@@ -22,12 +23,14 @@ soapclient.login(LOGIN_USER, LOGIN_PWD, HNAP_URL).done(function (status) {
throw "Login failed!";
}
start();
+ //read();
});
function start(){
- soapclient.on().done(function (result){
+ soapclient.getInternetSettings().done(function (result){
+ //soapclient.on().done(function (result){
console.log(result);
- read();
+ //read();
})
}
diff --git a/js/soapclient.js b/js/soapclient.js
index ef16bf4..4c9a935 100644
--- a/js/soapclient.js
+++ b/js/soapclient.js
@@ -2,6 +2,7 @@ var md5 = require('./hmac_md5');
var request = require('then-request');
var DOMParser = require('xmldom').DOMParser;
var fs = require("fs");
+var AES = require('./AES');
var HNAP1_XMLNS = "http://purenetworks.com/HNAP1/";
var HNAP_METHOD = "POST";
@@ -104,7 +105,7 @@ exports.temperature = function () {
return soapAction("GetCurrentTemperature", "CurrentTemperature", requestBody("GetCurrentTemperature", moduleParameters(3)));
};
-exports.radioSettings = function () {
+exports.getAPClientSettings = function () {
return soapAction("GetAPClientSettings", "GetAPClientSettingsResult", requestBody("GetAPClientSettings", radioParameters("RADIO_2.4GHz")));
};
@@ -132,13 +133,89 @@ exports.triggerWirelessSiteSurvey = function () {
return soapAction("SetTriggerWirelessSiteSurvey", "SetTriggerWirelessSiteSurveyResult", requestBody("SetTriggerWirelessSiteSurvey", radioParameters("RADIO_2.4GHz")));
};
+exports.latestDetection = function () {
+ return soapAction("GetLatestDetection", "GetLatestDetectionResult", requestBody("GetLatestDetection", moduleParameters(2)));
+};
+
+exports.reboot = function () {
+ return soapAction("Reboot", "RebootResult", requestBody("Reboot", ""));
+};
+
+exports.isDeviceReady = function () {
+ return soapAction("IsDeviceReady", "IsDeviceReadyResult", requestBody("IsDeviceReady", ""));
+};
+
+exports.getModuleSchedule = function () {
+ return soapAction("GetModuleSchedule", "GetModuleScheduleResult", requestBody("GetModuleSchedule", moduleParameters(0)));
+};
+
+exports.getModuleEnabled = function () {
+ return soapAction("GetModuleEnabled", "GetModuleEnabledResult", requestBody("GetModuleEnabled", moduleParameters(0)));
+};
+
+exports.getModuleGroup = function () {
+ return soapAction("GetModuleGroup", "GetModuleGroupResult", requestBody("GetModuleGroup", groupParameters(0)));
+};
+
+exports.getScheduleSettings = function () {
+ return soapAction("GetScheduleSettings", "GetScheduleSettingsResult", requestBody("GetScheduleSettings", ""));
+};
+
+exports.setFactoryDefault = function () {
+ return soapAction("SetFactoryDefault", "SetFactoryDefaultResult", requestBody("SetFactoryDefault", ""));
+};
+
+exports.setFactoryDefault = function () {
+ return soapAction("SetFactoryDefault", "SetFactoryDefaultResult", requestBody("SetFactoryDefault", ""));
+};
+
+exports.getWLanRadios = function () {
+ return soapAction("GetWLanRadios", "GetWLanRadiosResult", requestBody("GetWLanRadios", ""));
+};
+
+exports.getInternetSettings = function () {
+ return soapAction("GetInternetSettings", "GetInternetSettingsResult", requestBody("GetInternetSettings", ""));
+};
+
+exports.setAPClientSettings = function () {
+ return soapAction("SetAPClientSettings", "SetAPClientSettingsResult", requestBody("SetAPClientSettings", APClientParameters()));
+};
+
+exports.settriggerADIC = function () {
+ return soapAction("SettriggerADIC", "SettriggerADICResult", requestBody("SettriggerADIC", ""));
+};
+
+function APClientParameters(group) {
+ return "true"+
+ "RADIO_2.4GHz"+
+ "CiscoHome_ext"+
+ "C8:D7:19:4D:F9:F0"+
+ "0"+
+ ""+
+ ""+
+ "WPA2-PSK"+
+ ""+
+ "AES"+
+ ""+
+ ""+
+ ""+
+ ""+AES.AES_Encrypt128("lotusnotes", HNAP_AUTH.PrivateKey)+"";
+}
+
+function testParameters(group) {
+ return "" + group + "";
+}
+
+function groupParameters(group) {
+ return "" + group + "";
+}
function temperatureSettingsParameters(module) {
return moduleParameters(module) +
"TemperatureMonitor 3" +
"Temperature Monitor 3" +
- "90" +
+ "80" +
"Not Available" +
- "false";
+ "true";
}
function powerWarningParameters() {
return "28" +
@@ -170,7 +247,9 @@ function getHnapAuth(SoapAction, privateKey) {
}
function readResponseValue(body, elementName) {
- var doc = new DOMParser().parseFromString(body);
- var node = doc.getElementsByTagName(elementName).item(0);
- return (node) ? node.firstChild.nodeValue : "ERROR";
+ if(body && elementName) {
+ var doc = new DOMParser().parseFromString(body);
+ var node = doc.getElementsByTagName(elementName).item(0);
+ return (node) ? node.firstChild.nodeValue : "ERROR";
+ }
}
\ No newline at end of file