如何通过rootservice.xml获取LG Smart TV的描述?

时间:2013-12-16 07:31:56

标签: upnp lg smart-tv ssdp

在通过UPnP / SSDP搜索LG电视时,我得到以下回复:

HTTP/1.1 200 OK
CACHE-CONTROL: max-age=172800
DATE: Mon Dec 16 06:31:03 2013 GMT
EXT:
LOCATION: http://<IP>:<PORT>/udap/api/data?target=rootservice.xml
SERVER: Linux/3.0.13 UDAP/1.0 47LN5750-UH/05.00.30
ST: udap:rootservice
USN: uuid:c8ffxxxx-xxxx-xxxx-xxxx-xxxx34b4c708::udap:rootservice

在此之后,当我尝试获取LG智能电视描述以了解设备信息,服务和时,使用上面提供的LOCATION URL。支持的命令,我收到“ 404 - Not Found ”错误。

以下是我的解密代码:

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://<IP>:<PORT>/udap/api/data?target=rootservice.xml"]
                                                               cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
                                                           timeoutInterval:10];

[request setHTTPMethod: @"GET"];

NSError *requestError;
NSURLResponse *urlResponse = nil;

NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&requestError];*

当我尝试访问UDAP服务返回的URL时,为什么会出现“404-Not Found”错误?

提前致谢

1 个答案:

答案 0 :(得分:2)

在执行HTTP GET时,尝试将HTTP标头User-Agent设置为UDAP/2.0

如果您想访问netrcu和其他服务,请查看UDAP规范http://developer.lgappstv.com/TV_HELP/index.jsp?topic=%2Flge.tvsdk.references.book%2Fhtml%2FUDAP%2FUDAP%2FLG+UDAP+2+0+Protocol+Specifications.htm

相关问题