Permalink
Browse files

samsung 2011 support added

  • Loading branch information...
1 parent 31ce1eb commit 9bf4fd75e8ac5a6a83783fbe53addc59ea5a9b25 @nkashyap committed Oct 17, 2013
View
@@ -5,7 +5,7 @@
* Website: http://nkashyap.github.io/console.io/
* Author: Nisheeth Kashyap
* Email: nisheeth.k.kashyap@gmail.com
- * Date: 2013-10-04
+ * Date: 2013-10-17
*/
code {
View
@@ -5,7 +5,7 @@
* Website: http://nkashyap.github.io/console.io/
* Author: Nisheeth Kashyap
* Email: nisheeth.k.kashyap@gmail.com
- * Date: 2013-10-04
+ * Date: 2013-10-17
*/
/**

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -5,7 +5,7 @@
* Website: http://nkashyap.github.io/console.io/
* Author: Nisheeth Kashyap
* Email: nisheeth.k.kashyap@gmail.com
- * Date: 2013-10-04
+ * Date: 2013-10-17
*/
var ConsoleIO = ("undefined" === typeof module ? {} : module.exports);
@@ -2576,8 +2576,8 @@ ConsoleIO.version = "0.2.2";
'prototype.trim': !!String.prototype.trim
},
"JSON": {
- 'parse': !!JSON.parse,
- 'stringify': !!JSON.stringify
+ 'parse': !!global.JSON && !!global.JSON.parse,
+ 'stringify': !!global.JSON && !!global.JSON.stringify
}
}
}
@@ -3132,6 +3132,7 @@ ConsoleIO.version = "0.2.2";
var styles = [
'background-color: rgba(244, 244, 244, 0.9)',
+ 'background-color: rgb(244, 244, 244)',
'color: black',
'z-index: 5000',
'overflow: auto',

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -6,10 +6,9 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Console.IO - HTTP - Test Page</title>
<link rel="stylesheet" href="main.css" type="text/css">
- <script type="text/javascript" src="main.js"></script>
</head>
<body>
-<div id="wrapper" style="background-image: url(https://raw.github.com/nkashyap/console.io/master/resources/images/console.io.png);">
+<div id="wrapper" style="background-image: url(https://raw.github.com/nkashyap/console.io/master/resources/images/console.io.png); background-color:#FFFFFF; height: 400px;">
<h1 id="ConnectionMode">Info: </h1>
<ul id="log"></ul>
<div id="debug"></div>
@@ -19,5 +18,6 @@ <h1 id="ConnectionMode">Info: </h1>
<div>Console.IO</div>
</div>
</div>
+<script type="text/javascript" src="main.js"></script>
</body>
</html>
@@ -0,0 +1,155 @@
+/**
+ * Created with IntelliJ IDEA.
+ * User: nisheeth
+ * Date: 10/04/13
+ * Time: 21:38
+ * To change this template use File | Settings | File Templates.
+ */
+
+(function client() {
+ return {
+ configure: function configure(exports, global) {
+ var files = ["$MANAGER_WIDGET/Common/webapi/1.0/deviceapis.js"],
+ connectionWatch = {
+ onconnect: function (type) {
+ exports.console.info(type + " is connected successfully");
+ },
+ ondisconnect: function (type) {
+ exports.console.info(type + " is disconnected");
+ }
+ };
+
+ //global.alert = exports.console.info;
+
+ exports.client.CONST = {
+ NETWORK: {
+ '0': 'WIFI',
+ '1': 'LAN'
+ }
+ };
+
+ exports.transport.on('device:status', function () {
+ exports.client.onStatus(exports, global);
+ });
+
+ function errorCallback() {
+ exports.console.exception(arguments);
+ }
+
+ function load() {
+ exports.console.log('deviceapis.js loaded', typeof global.deviceapis);
+ exports.client.api = global.deviceapis;
+
+ if (!exports.serialNumber) {
+ exports.serialNumber = exports.client.api.tv.info.getDeviceID();
+ exports.storage.addItem('serialNumber', exports.serialNumber, 365);
+ }
+
+ try {
+ exports.client.api.network.getAvailableNetworks(function networkSuccess(networks) {
+ exports.util.forEach(networks, function (network) {
+ network.setWatchListener(connectionWatch, errorCallback);
+ });
+ }, errorCallback);
+ } catch (e) {
+ exports.console.exception(e);
+ }
+
+ exports.client.register();
+ }
+
+ if (!global.deviceapis) {
+ exports.util.require(files, load);
+ } else {
+ load();
+ }
+ },
+
+ getDeviceFamily: function getDeviceFamily(exports) {
+ var api = exports.client.api;
+ if (api) {
+ switch (api.tv.info.getProduct()) {
+ case api.tv.info.PRODUCT_TYPE_TV:
+ return 'TV';
+ case api.tv.info.PRODUCT_TYPE_BD:
+ return 'Blue-ray player';
+ case api.tv.info.PRODUCT_TYPE_MONITOR:
+ return 'Monitor';
+ }
+ }
+ },
+
+ onStatus: function onStatus(exports, global) {
+ var api = exports.client.api,
+ info = [],
+ queryParams = exports.util.getQueryParams(),
+ device = {
+ family: exports.client.getDeviceFamily(exports),
+ modelName: api.tv.info.getModel(),
+ serialNumber: api.tv.info.getDeviceID(),
+ platform: api.platform,
+ firmware: api.tv.info.getFirmware(),
+ esnWidevine: api.tv.info.getESN('WIDEVINE'),
+ apiVersion: api.ver,
+ country: api.tv.info.getCountry(),
+ language: api.tv.info.getLanguage()
+ },
+ network = {
+ mode: exports.transport.connectionMode,
+ network: exports.client.CONST.NETWORK[api._plugin("Network", "GetActiveType")]
+ };
+
+ try {
+ device.version = api.tv.info.getVersion();
+ } catch (e) {}
+
+ if (queryParams.totalMemory) {
+ device.totalMemory = queryParams.totalMemory;
+ }
+
+ exports.util.forEachProperty(api.tv.info.getTimeZone(), function (value, property) {
+ device['timeZone.' + property] = value;
+ });
+
+ info.push({ device: device });
+ info.push({ connection: network });
+ info.push({ document: { cookie: global.document.cookie }});
+ info.push({ navigator: exports.client.jsonify(global.navigator) });
+ info.push({ location: exports.client.jsonify(global.location) });
+ info.push({ screen: exports.client.jsonify(global.screen) });
+
+ function callBack() {
+ exports.transport.emit('status', { info: info.concat(exports.client.getMore()) });
+ }
+
+ if (api.network && api.network.getAvailableNetworks) {
+ api.network.getAvailableNetworks(function (networks) {
+
+ network.interfaces = networks.length;
+ exports.util.every(networks, function (net) {
+ if (net.isActive()) {
+ network.mac = net.mac;
+ network.ip = net.ip;
+ network.ipMode = net.ipMode;
+ network.dns = net.dns;
+ network.dnsMode = net.dnsMode;
+ network.gateway = net.gateway;
+ network.netmask = net.subnetMask;
+ return false;
+ }
+
+ return true;
+ });
+
+ callBack();
+
+ }, function errorCallback(e) {
+ exports.console.exception(e);
+ callBack();
+ });
+ } else {
+ callBack();
+ }
+ }
+ };
+}());
View
@@ -512,8 +512,8 @@
'prototype.trim': !!String.prototype.trim
},
"JSON": {
- 'parse': !!JSON.parse,
- 'stringify': !!JSON.stringify
+ 'parse': !!global.JSON && !!global.JSON.parse,
+ 'stringify': !!global.JSON && !!global.JSON.stringify
}
}
}
View
@@ -220,6 +220,7 @@
var styles = [
'background-color: rgba(244, 244, 244, 0.9)',
+ 'background-color: rgb(244, 244, 244)',
'color: black',
'z-index: 5000',
'overflow: auto',

0 comments on commit 9bf4fd7

Please sign in to comment.