Skip to content

Commit

Permalink
[ares-generate] Add templates for signage pofiles
Browse files Browse the repository at this point in the history
  • Loading branch information
THIEM VAN NGUYEN/LGEDV webOS FRAMEWORK Thiem.nguyen SERVICE PART authored and nguyen-van-quang committed Jan 2, 2025
1 parent 60b24e8 commit 9a83292
Show file tree
Hide file tree
Showing 784 changed files with 288,612 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
applicationInfo(
{
"applicationName" : "Test App",
"version" : 1.0111,
"releaseDate" : "2015-03-16",
"developer" : "Developer",
"isDomainUse" : false,
"server" : {
"ip" : "192.168.137.1",
"port" : 8080,
"secured" : false,
"domain" : ""
}
}
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<html>
<head>
<title>Refresh Application without reboot Sample</title>

<script type="text/javascript" src="./js/cordova/2.7.0/cordova.webos.js"></script>
<script type="text/javascript" src="./js/cordova-cd/signage.js"></script>
<script type="text/javascript" src="./js/cordova-cd/storage.js"></script>
<script type="text/javascript" src="./js/cordova-cd/configuration.js"></script>
<script type="text/javascript" src="./js/cordova-cd/deviceInfo.js"></script>
<script type="text/javascript" src="./js/cordova-cd/inputSource.js"></script>
<script type="text/javascript" src="./js/cordova-cd/power.js"></script>
<script type="text/javascript" src="./js/cordova-cd/sound.js"></script>
<script type="text/javascript" src="./js/cordova-cd/video.js"></script>
<script src="script.js"></script>

<link rel="stylesheet" type="text/css" href="./style.css">

</head>

<body bgcolor=#FFFFFF>

<div id="inputForm">

Application Info File Path : <br><textarea id='jsonFilePath' style='font-size: 75%' rows=1></textarea>
<br><button onclick="getServerAppInfo()" style='font-size: 100%;'>Get Server Application Information</button>
<br><button onclick="refrestApplication()" style='font-size: 100%;'>Update and restart Application</button>
<br>

<div id = "status"></div>
<div id = "remoteSettings"></div>
<div id = "serverSettings"></div>
</div>

<div id="localAppInfo"></div>
<div id="serverAppInfo"></div>
<div id = "downlaodJSON"></div>

<script src="applicationInfo.json"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
var INTERNAL_JSON_FILE_SERVER = 'file://internal/applicationInfo_Server.json',
INTERNAL_JSON_FILE_LCOAL = 'file://internal/applicationInfo.json',
CONSTANT_PATH = "/procentric/scap/application",
localAppInformation,
serverAppInformation,
storage = new Storage(),
configuration = new Configuration();

// SCAP Failure Callback Function
function failureCb(cbObject) {
var errorCode = cbObject.errorCode;
var errorText = cbObject.errorText;
document.getElementById("status").innerHTML = "Error Code [" + errorCode + "]: " + errorText;
}

// Get device server settings
function getServerSettings() {
function successCb(cbObject) {
document.getElementById("serverSettings").innerHTML = "Current Server Settings : <br>"
+ "IP : " + cbObject.serverIp + "<br>"
+ "Port : " + cbObject.serverPort + "<br>"
+ "HTTPS : " + cbObject.secureConnection + "<br>"
+ "LaunchMode : " + cbObject.appLaunchMode + "<br>"
+ "Domain Mode : " + cbObject.fqdnMode + "<br>"
+ "Domain : " + (cbObject.fqdnAddr === "" ? "[NOT INPUTTED]" : cbObject.fqdnAddr);
}
configuration.getServerProperty(successCb, failureCb);
}

// Get Application information from applicationInfo.json in device
function applicationInfo(obj) {
console.log("APP INFO : " + JSON.stringify(obj));
localAppInformation = obj;
document.getElementById("localAppInfo").innerHTML = "Local Installed Application Settings : <br>"
+ "Application Name : " + localAppInformation.applicationName + "<br>"
+ "Version : " + localAppInformation.version + "<br>"
+ "Developer : " + localAppInformation.developer + "<br>"
+ "Release Date : " + localAppInformation.releaseDate + "<br><br>";
}


/*
Get Application information from JSON file
JSON Format :
**************************************************************
applicationInfo(
{
"applicationName" : "Test App",
"version" : 1.0111,
"releaseDate" : "2015-03-16",
"developer" : "Developer",
"isDomainUse" : false,
"server" : {
"ip" : "192.168.137.1",
"port" : 8080,
"secured" : false,
"domain" : "TEST"
}
}
);
applicationName, version, releaseDate, developer : For using this application(just print).
You can implement some application validation method such as compare version, check developer, etc...
( Example : compareVersion() )
isDomainUse, server : For using set server property.
**************************************************************
*/
function getServerAppInfo() {
var downloadComplete = function() {
document.getElementById("status").innerHTML = "JSON file download complete.<br>";

/////////////////////////////////////////////////////////////////////////////////
//
// Get settings from downloaded json file
//

var getServerAppInformation = function(cbObject) {
document.getElementById("downlaodJSON").innerHTML = "Downloaded JSON Data : <br>"
+ cbObject.data + "<br><br>";

//////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Parse applicationInfo.json file and set server settings
//

console.log(cbObject.data.slice(18, (cbObject.data.length - 3)))
serverAppInformation = JSON.parse(cbObject.data.slice(17, (cbObject.data.length - 3)));
document.getElementById("serverAppInfo").innerHTML = "Server Application Settings : <br>"
+ "Application Name : " + serverAppInformation.applicationName + "<br>"
+ "Version : " + serverAppInformation.version + "<br>"
+ "Developer : " + serverAppInformation.developer + "<br>"
+ "Release Date : " + serverAppInformation.releaseDate + "<br><br>";
var options = {
serverIp : serverAppInformation.server.ip,
serverPort : serverAppInformation.server.port,
secureConnection : serverAppInformation.server.secured,
appLaunchMode : Configuration.AppMode.LOCAL,
fqdnMode : serverAppInformation.isDomainUse,
fqdnAddr : serverAppInformation.server.domain
};
compareVersion();
setServerSettings(options);

//
//////////////////////////////////////////////////////////////////////////////////////////////////////
};

// Read file from the start, read the whole file, and read as text.
var readOptions = {
path : INTERNAL_JSON_FILE_SERVER,
position : 0,
length : 1024,
encoding : 'utf8'
};
storage.readFile(getServerAppInformation, failureCb, readOptions);

//
/////////////////////////////////////////////////////////////////////////////////
}
var downloadOptions = {
source : document.getElementById('jsonFilePath').value,
destination : INTERNAL_JSON_FILE_SERVER
};

// Download json file from remote
storage.copyFile(downloadComplete, failureCb, downloadOptions);
}

// Set device's server settings for download new application
function changeRemoteSettings() {
if (document.getElementById("remoteMode").value == "IP and Port") {
console.log("IP")
document.getElementById("remoteSettings").innerHTML = ""
+ "IP : <textarea id='ip' style='font-size: 75%;' rows=1></textarea><br>"
+ "Port : <textarea id='port' style='font-size: 75%;' rows=1></textarea><br>"
+ "<button onclick='setServerSettings(" + '"IP"' + ")' style='font-size: 100%;'>Set Server Settings</button>";
}

else if (document.getElementById("remoteMode").value == "Domain") {
console.log("DOMAIN")
document.getElementById("remoteSettings").innerHTML = ""
+ "URL : <textarea id='serverURL' style='font-size: 100%;' rows=1></textarea><br>"
+ "<input type='checkbox' id = 'https'>HTTPS<br>"
+ "<button onclick='setServerSettings(" + '"DOMAIN"' + ")' style='font-size: 100%;'>Set Server Settings</button>";
}
}

// Set device server settings
function setServerSettings(param) {
var options = param;
function successCb() {
getServerSettings();
document.getElementById("status").innerHTML += "Set up server settings.";
}
configuration.setServerProperty(successCb, failureCb, options);
}

// Compare application version from device and from server
function compareVersion() {
if (localAppInformation.version < serverAppInformation.version) {
document.getElementById("status").innerHTML += "New application version detected.<br>"
}
else {
document.getElementById("status").innerHTML += "Latest application is installed.<br>"
}
}

// Restart updated application
function refrestApplication() {
var successCb = function(cbObject) {
document.getElementById("status").innerHTML = "Application Update complete.<br>"
+ "Application will be restart......";
function restartApplication() {
function successCb() {
document.getElementById("status").innerHTML = "Restart Complete."
}

configuration.restartApplication(successCb, failureCb);
};
restartApplication();
};

var options = {
to : Storage.AppMode.REMOTE,
recovery : false
};

var storage = new Storage();
storage.upgradeApplication(successCb, failureCb, options);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
body {
padding: 0px;
border: 0px;
margin: 0px;
}

#inputForm {
width: 48%;
height: 100%;
background-color: #ffaaaa;
font-size: 300%;
float: left;
padding : 1%;
}

#remoteSettings {
font-size: 75%
}
#serverSettings {
font-size: 75%
}

#localAppInfo {
width: 48%;
height: 28%;
float: right;
background-color: #ffffaa;
font-size: 300%;
padding : 1%;
}
#serverAppInfo {
width: 48%;
height: 53%;
float: right;
background-color: #aaffaa;
font-size: 300%;
padding : 1%;
}

#status {
font-size: 75%
}

#downlaodJSON {
width: 48%;
height: 13%;
position: absolute;
bottom: 0px;
right: 0px;
padding: 1%;
font-size: 150%;
background-color: #aaaaff;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/***
*
* clockTable.js
* Draw backlight schedule table to right side of screen
*
*/
// Draw Table right side
function drawScheduleTable(){
document.getElementById('clock').innerHTML = "";
for(var H=0; H<24; H++) {
document.getElementById('clock').innerHTML += "<div id = clockTable" + H + ">";
document.getElementById('clockTable' + H).setAttribute("width", "792px");
document.getElementById('clockTable' + H).setAttribute("height", "33px");
for (var M=0; M<6; M++) {
document.getElementById('clock').innerHTML += "<div id = clockTable" + H + "_" + M + " class='clock_segment'>";
document.getElementById('clockTable' + H + '_' + M).setAttribute("background-color", "#000000");
document.getElementById('clockTable' + H + '_' + M).setAttribute("border", "solid");
document.getElementById('clockTable' + H + '_' + M).setAttribute("border-color", "#0000FF");
}
document.getElementById('clock').innerHTML += "</div>";
}
}


// Change value of schedule table
function changeScheduleTable(H, M, value) {
console.log("Change color");
document.getElementById('clockTable' + H + '_' + parseInt(M/10)).innerText = value;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!--
Sample SCAP Template Application
Simple Backlight Scheduling
-->

<HTML>
<HEAD>
<TITLE>Display Backlight Scheduling Sample App</TITLE>

<!-- Include SCAP Library -->

<script type="text/javascript" src="./js/cordova/2.7.0/cordova.webos.js"></script>
<script type="text/javascript" src="./js/cordova-cd/signage.js"></script>
<script type="text/javascript" src="./js/cordova-cd/storage.js"></script>
<script type="text/javascript" src="./js/cordova-cd/configuration.js"></script>
<script type="text/javascript" src="./js/cordova-cd/deviceInfo.js"></script>
<script type="text/javascript" src="./js/cordova-cd/inputSource.js"></script>
<script type="text/javascript" src="./js/cordova-cd/power.js"></script>
<script type="text/javascript" src="./js/cordova-cd/sound.js"></script>
<script type="text/javascript" src="./js/cordova-cd/video.js"></script>

<!-- Script Files -->
<script src = './setanddelete.js'></script>
<script src = './scheduler.js'></script>
<script src = './clockTable.js'></script>
<script src = './remocon.js'></script>

<!-- Style File -->
<link rel="stylesheet" type="text/css" href="./style.css">
</HEAD>

<BODY bgcolor = #FFFFFF onload = 'init()'>
<!-- Popup Windows -->
<div id = 'popupWindow'></div>
<div id = 'helpWindow'></div>

<!-- Text Area -->
<div id = 'appTitle'>Display Backlight Scheduling Sample App<br>Blue Button to open help</div>
<div id = 'rotateSpeed'></div>
<div id = 'currentTime'></div>

<!-- Left Controller Side -->
<div id = 'controllerTitle'>Backlight Scheduler</div>
<div id = 'clockTitle'>Schedule Information</div>
<div id = 'controllerInfo'></div>
<div id = 'controller'></div>
<div id = 'halfbar'></div>

<!-- Right Time Table Side -->
<div id = 'clock'></div>
<div id = 'clockMinute'></div>
<div id = 'clockHour'></div>
<div id = 'controllerRuler'></div>
<div id = 'controllerArrowRotate'>
<div id = 'controllerSelectedTime'></div>
</div>
</BODY>
</HTML>
Loading

0 comments on commit 9a83292

Please sign in to comment.