dilanua 8 years ago
parent 3a7dbb81ea
commit 4947664b4b

@ -52,16 +52,11 @@ function onRequest(context) {
longitude: device["properties"]["LONGITUDE"] longitude: device["properties"]["LONGITUDE"]
}; };
} else if (device["type"] == "android") { } else if (device["type"] == "android") {
viewModel["deviceName"] = device["name"];
viewModel["deviceIdentifier"] = device["deviceIdentifier"]; viewModel["deviceIdentifier"] = device["deviceIdentifier"];
viewModel["imei"] = device["properties"]["IMEI"]; viewModel["deviceName"] = device["name"];
viewModel["model"] = device["deviceInfo"]["deviceModel"];
viewModel["vendor"] = device["deviceInfo"]["vendor"];
viewModel["owner"] = device["owner"]; viewModel["owner"] = device["owner"];
viewModel["ownership"] = device["ownership"]; viewModel["ownership"] = device["ownership"];
viewModel["lastUpdatedTime"] = device["deviceInfo"]["updatedTime"]. viewModel["imei"] = device["properties"]["IMEI"];
substr(0, device["deviceInfo"]["updatedTime"].indexOf("+"));
var osBuildDate = device["properties"]["OS_BUILD_DATE"]; var osBuildDate = device["properties"]["OS_BUILD_DATE"];
if (osBuildDate != null && osBuildDate != "0") { if (osBuildDate != null && osBuildDate != "0") {
viewModel["os_build_date"] = new Date(osBuildDate * 1000); viewModel["os_build_date"] = new Date(osBuildDate * 1000);
@ -79,41 +74,49 @@ function onRequest(context) {
} }
} }
deviceInfo = info; deviceInfo = info;
viewModel["BatteryLevel"] = {};
viewModel["BatteryLevel"]["value"] = device["deviceInfo"]["batteryLevel"];
viewModel["cpuUsage"] = {}; if (device["deviceInfo"]) {
viewModel["cpuUsage"]["value"] = device["deviceInfo"]["cpuUsage"]; viewModel["model"] = device["deviceInfo"]["deviceModel"];
viewModel["vendor"] = device["deviceInfo"]["vendor"];
viewModel["lastUpdatedTime"] = device["deviceInfo"]["updatedTime"].
substr(0, device["deviceInfo"]["updatedTime"].indexOf("+"));
viewModel["ramUsage"] = {}; viewModel["BatteryLevel"] = {};
if (device["deviceInfo"]["totalRAMMemory"] != 0) { viewModel["BatteryLevel"]["value"] = device["deviceInfo"]["batteryLevel"];
viewModel["ramUsage"]["value"] = Math.
round((device["deviceInfo"]["totalRAMMemory"] - device["deviceInfo"]["availableRAMMemory"])
/ device["deviceInfo"]["totalRAMMemory"] * 10000) / 100;
} else {
viewModel["ramUsage"]["value"] = 0;
}
viewModel["internalMemory"] = {}; viewModel["cpuUsage"] = {};
viewModel["externalMemory"] = {}; viewModel["cpuUsage"]["value"] = device["deviceInfo"]["cpuUsage"];
viewModel["internalMemory"]["total"] = Math.
round(device["deviceInfo"]["internalTotalMemory"] * 100) / 100; viewModel["ramUsage"] = {};
if (device["deviceInfo"]["internalTotalMemory"] != 0) { if (device["deviceInfo"]["totalRAMMemory"] != 0) {
viewModel["internalMemory"]["usage"] = Math. viewModel["ramUsage"]["value"] = Math.
round((device["deviceInfo"]["internalTotalMemory"] - device["deviceInfo"]["internalAvailableMemory"]) round((device["deviceInfo"]["totalRAMMemory"] - device["deviceInfo"]["availableRAMMemory"])
/ device["deviceInfo"]["internalTotalMemory"] * 10000) / 100; / device["deviceInfo"]["totalRAMMemory"] * 10000) / 100;
} else { } else {
viewModel["internalMemory"]["usage"] = 0; viewModel["ramUsage"]["value"] = 0;
} }
viewModel["externalMemory"]["total"] = Math. viewModel["internalMemory"] = {};
round(device["deviceInfo"]["externalTotalMemory"] * 100) / 100; viewModel["externalMemory"] = {};
if (device["deviceInfo"]["externalTotalMemory"] != 0) { viewModel["internalMemory"]["total"] = Math.
viewModel["externalMemory"]["usage"] = Math. round(device["deviceInfo"]["internalTotalMemory"] * 100) / 100;
round((device["deviceInfo"]["externalTotalMemory"] - device["deviceInfo"]["externalAvailableMemory"]) if (device["deviceInfo"]["internalTotalMemory"] != 0) {
/ device["deviceInfo"]["externalTotalMemory"] * 10000) / 100; viewModel["internalMemory"]["usage"] = Math.
} else { round((device["deviceInfo"]["internalTotalMemory"] - device["deviceInfo"]["internalAvailableMemory"])
viewModel["externalMemory"]["usage"] = 0; / device["deviceInfo"]["internalTotalMemory"] * 10000) / 100;
} else {
viewModel["internalMemory"]["usage"] = 0;
}
viewModel["externalMemory"]["total"] = Math.
round(device["deviceInfo"]["externalTotalMemory"] * 100) / 100;
if (device["deviceInfo"]["externalTotalMemory"] != 0) {
viewModel["externalMemory"]["usage"] = Math.
round((device["deviceInfo"]["externalTotalMemory"] - device["deviceInfo"]["externalAvailableMemory"])
/ device["deviceInfo"]["externalTotalMemory"] * 10000) / 100;
} else {
viewModel["externalMemory"]["usage"] = 0;
}
} }
} else if (device["type"] == "windows") { } else if (device["type"] == "windows") {
viewModel["imei"] = device["properties"]["IMEI"]; viewModel["imei"] = device["properties"]["IMEI"];

Loading…
Cancel
Save