|
|
@ -84,47 +84,30 @@ function onRequest(context) {
|
|
|
|
viewModel["model"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_MODEL"];
|
|
|
|
viewModel["model"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_MODEL"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]) {
|
|
|
|
if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]) {
|
|
|
|
if (deviceType == "android") {
|
|
|
|
|
|
|
|
viewModel["BatteryLevel"] = {};
|
|
|
|
viewModel["BatteryLevel"] = {};
|
|
|
|
viewModel["BatteryLevel"]["value"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["BATTERY_LEVEL"];
|
|
|
|
viewModel["BatteryLevel"]["value"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["BATTERY_LEVEL"];
|
|
|
|
|
|
|
|
|
|
|
|
viewModel["internalMemory"] = {};
|
|
|
|
viewModel["internalMemory"] = {};
|
|
|
|
viewModel["internalMemory"]["total"] = Math.
|
|
|
|
viewModel["internalMemory"]["total"] = replaceNaNVal(Math.
|
|
|
|
round(filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] * 100) / 100;
|
|
|
|
round(filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] * 100) / 100);
|
|
|
|
if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] != 0) {
|
|
|
|
if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] != 0) {
|
|
|
|
viewModel["internalMemory"]["usage"] = filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] -
|
|
|
|
viewModel["internalMemory"]["usage"] = replaceNaNVal(Math.round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] -
|
|
|
|
filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_AVAILABLE_MEMORY"];
|
|
|
|
filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_AVAILABLE_MEMORY"]) * 100) / 100);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
viewModel["internalMemory"]["usage"] = 0;
|
|
|
|
viewModel["internalMemory"]["usage"] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
viewModel["externalMemory"] = {};
|
|
|
|
viewModel["externalMemory"] = {};
|
|
|
|
viewModel["externalMemory"]["total"] = Math.
|
|
|
|
viewModel["externalMemory"]["total"] = replaceNaNVal(Math.
|
|
|
|
round(filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] * 100) / 100;
|
|
|
|
round(filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] * 100) / 100);
|
|
|
|
if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] != 0) {
|
|
|
|
if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] != 0) {
|
|
|
|
viewModel["externalMemory"]["usage"] = Math.
|
|
|
|
viewModel["externalMemory"]["usage"] = replaceNaNVal(Math.
|
|
|
|
round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] -
|
|
|
|
round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] -
|
|
|
|
filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_AVAILABLE_MEMORY"])
|
|
|
|
filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_AVAILABLE_MEMORY"])
|
|
|
|
/ filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] * 10000) / 100;
|
|
|
|
/ filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] * 10000) / 100);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
viewModel["externalMemory"]["usage"] = 0;
|
|
|
|
viewModel["externalMemory"]["usage"] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (deviceType == "ios") {
|
|
|
|
|
|
|
|
viewModel["BatteryLevel"] = {};
|
|
|
|
|
|
|
|
viewModel["BatteryLevel"]["value"] = Math. round(filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["BatteryLevel"] * 10000) / 100;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
viewModel["internalMemory"] = {};
|
|
|
|
|
|
|
|
viewModel["internalMemory"]["total"] = Math.
|
|
|
|
|
|
|
|
round(filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] * 100) / 100;
|
|
|
|
|
|
|
|
if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] != 0) {
|
|
|
|
|
|
|
|
viewModel["internalMemory"]["usage"] = Math.
|
|
|
|
|
|
|
|
round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] -
|
|
|
|
|
|
|
|
filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["AvailableDeviceCapacity"])
|
|
|
|
|
|
|
|
/ filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] * 10000) / 100;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
viewModel["internalMemory"]["usage"] = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -158,32 +141,32 @@ function onRequest(context) {
|
|
|
|
|
|
|
|
|
|
|
|
viewModel["ramUsage"] = {};
|
|
|
|
viewModel["ramUsage"] = {};
|
|
|
|
if (filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] != 0) {
|
|
|
|
if (filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] != 0) {
|
|
|
|
viewModel["ramUsage"]["value"] = Math.
|
|
|
|
viewModel["ramUsage"]["value"] = replaceNaNVal(Math.
|
|
|
|
round((filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] -
|
|
|
|
round((filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] -
|
|
|
|
filteredDeviceData["latestDeviceInfo"]["availableRAMMemory"])
|
|
|
|
filteredDeviceData["latestDeviceInfo"]["availableRAMMemory"])
|
|
|
|
/ filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] * 10000) / 100;
|
|
|
|
/ filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] * 10000) / 100);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
viewModel["ramUsage"]["value"] = 0;
|
|
|
|
viewModel["ramUsage"]["value"] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
viewModel["internalMemory"] = {};
|
|
|
|
viewModel["internalMemory"] = {};
|
|
|
|
viewModel["internalMemory"]["total"] = Math.
|
|
|
|
viewModel["internalMemory"]["total"] = replaceNaNVal(Math.
|
|
|
|
round(filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] * 100) / 100;
|
|
|
|
round(filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] * 100) / 100);
|
|
|
|
if (filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] != 0) {
|
|
|
|
if (filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] != 0) {
|
|
|
|
viewModel["internalMemory"]["usage"] = filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] -
|
|
|
|
viewModel["internalMemory"]["usage"] = replaceNaNVal(Math.round((filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] -
|
|
|
|
filteredDeviceData["latestDeviceInfo"]["internalAvailableMemory"];
|
|
|
|
filteredDeviceData["latestDeviceInfo"]["internalAvailableMemory"]) * 100) / 100);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
viewModel["internalMemory"]["usage"] = 0;
|
|
|
|
viewModel["internalMemory"]["usage"] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
viewModel["externalMemory"] = {};
|
|
|
|
viewModel["externalMemory"] = {};
|
|
|
|
viewModel["externalMemory"]["total"] = Math.
|
|
|
|
viewModel["externalMemory"]["total"] = replaceNaNVal(Math.
|
|
|
|
round(filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] * 100) / 100;
|
|
|
|
round(filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] * 100) / 100);
|
|
|
|
if (filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] != 0) {
|
|
|
|
if (filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] != 0) {
|
|
|
|
viewModel["externalMemory"]["usage"] = Math.
|
|
|
|
viewModel["externalMemory"]["usage"] = replaceNaNVal(Math.
|
|
|
|
round((filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] -
|
|
|
|
round((filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] -
|
|
|
|
filteredDeviceData["latestDeviceInfo"]["externalAvailableMemory"])
|
|
|
|
filteredDeviceData["latestDeviceInfo"]["externalAvailableMemory"])
|
|
|
|
/ filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] * 10000) / 100;
|
|
|
|
/ filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] * 10000) / 100);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
viewModel["externalMemory"]["usage"] = 0;
|
|
|
|
viewModel["externalMemory"]["usage"] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -216,4 +199,11 @@ function onRequest(context) {
|
|
|
|
deviceViewData["isCloud"] = devicemgtProps['isCloud'];
|
|
|
|
deviceViewData["isCloud"] = devicemgtProps['isCloud'];
|
|
|
|
deviceViewData["anchor"] = encodeURI(JSON.stringify({ "device" : { "id" : deviceId, "type" : deviceType}}));
|
|
|
|
deviceViewData["anchor"] = encodeURI(JSON.stringify({ "device" : { "id" : deviceId, "type" : deviceType}}));
|
|
|
|
return deviceViewData;
|
|
|
|
return deviceViewData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function replaceNaNVal(val){
|
|
|
|
|
|
|
|
if(isNaN(val)){
|
|
|
|
|
|
|
|
return "N/A";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|