LG smartTV 设备信息查询

LG smartTV 设备信息查询方法可依据 LG 开发者网站,大体可分为两种方式:

1. API > Luna Service API

1.1 API > Luna Service API > TV Device Information

获取电视型号modelName,固件版本firmwareVersion,超高清UHD,开发工具版本sdkVersion

webOS.service.request("luna://com.webos.service.tv.systemproperty", {
        method: "getSystemInfo",
        parameters: {
            "keys": ["modelName", "firmwareVersion", "UHD", "sdkVersion"]
            "keys": ["modelName", "sdkVersion"]
        },
        onComplete: function (inResponse) {
            var isSucceeded = inResponse.returnValue;

            if (isSucceeded) {
                console.log("webOS TV Device Information: " + JSON.stringify(inResponse));
                var tvModel = inResponse.modelName;  //smartTV 电视型号
                console.log("tvModel: " + tvModel);
                var firmwareVersion = inResponse.firmwareVersion;  //固件版本 = 操作系统版本,即webOS操作系统版本
                console.log("firmwareVersion : " + firmwareVersion );
                var UHD = inResponse.UHD;  //是否支持超高清分辨率,"true": 支持;"false": 不支持
                console.log("UHD : " + UHD );
                var sdkVersion = inResponse.sdkVersion;  //webOS TV SDK version,即开发工具webOS TV IDE版本
                console.log("sdkVersion : " + sdkVersion );
            } else {
                console.log("Failed to get TV device information");
                return;
            }
        }
    });
1.2 API > Luna Service API > Device Unique ID

获取设备唯一ID UID

    webOS.service.request("luna://com.webos.service.sm", {
        method: "deviceid/getIDs",
        parameters: {
            "idType": ["LGUDID"]
        },
        onSuccess: function (inResponse) {
            console.log("webOS TV DeviceID: " + JSON.stringify(inResponse));
            var tvUID = inResponse.idList[0].idValue;  //设备唯一ID
            console.log("tvUID: " + tvUID);
        },
        onFailure: function (inError) {
            console.log("Failed to get tvUID information");
            console.log("[" + inError.errorCode + "]: " + inError.errorText);
            return;
        }
    });

2. API > webOSTV.js > webOS

获取电视型号modelName,系统版本osVersion,超高清uhd,开发工具版本sdkVersion

function recordLog(logDetail,logLevel,errorCode,sendImmediately,keepOldCash){
	console.log(logDetail);		
}

recordLog("The manufacturer is LG",99);
webOS.deviceInfo(function (device) {
	var tvModel = device.modelName;  //smartTV 电视型号
	recordLog("The tvModel is " + tvModel,99);
	var osVersion = device.version;  //webOS操作系统版本
	recordLog("The osVersion is " + osVersion,99);
	var sdkVersion = device.sdkVersion;  //webOS TV SDK version,即开发工具webOS TV IDE版本
	recordLog("The sdkVersion is " + sdkVersion,99);
	var uhd = device.uhd;  //是否支持超高清分辨率,"true": 支持;"false": 不支持
	recordLog("The uhd is " + uhd,99);
});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值