MirrorLink(三 UPNP)-- 使用
1、使用libupnp,首先发现设备:
可以获取到一些信息:
ApplicationServer相关信息:
serviceType : urn:schemas-upnp-org:service:TmApplicationServer:1
serviceId : urn:upnp-org:serviceId:TmApplicationServer1
SCPDURL : http://192.168.42.129:4004/tmapplicationserver.xml
controlURL : http://192.168.42.129:4004/TmApplicationServer-control
eventSubURL : http://192.168.42.129:4004/TmApplicationServer-eventing
2、ClientProfile相关信息
serviceType : urn:schemas-upnp-org:service:TmClientProfile:1...
Subscribing to serviceId : urn:upnp-org:serviceId:TmClientProfile1
Subscribing to serviceId : urn:upnp-org:serviceId:TmClientProfile1...
Subscribing to SCPDURL : http://192.168.42.129:4004/tmclientprofile.xml...
Subscribing to controlURL : http://192.168.42.129:4004/TmClientProfile1-control...
Subscribing to eventSubURL : http://192.168.42.129:4004/TmClientProfile1-eventing
二、然后通过这些url去获取其他的详细信息:
1、GetMaxNumProfiles,获取最大支持的profile数量,一般为1,那么说明profileID为0
<u:GetMaxNumProfilesResponse xmlns:u="urn:schemas-upnp-org:service:TmClientProfile:1">
<NumProfilesAllowed>1</NumProfilesAllowed>^M
</u:GetMaxNumProfilesResponse>
2、使用profileID=0调用SetClientProfile
3、之后就可以调用GetApplicationList获取所有application列表
<?xml version="1.0"?>
<u:GetApplicationListResponse xmlns:u="urn:schemas-upnp-org:service:TmApplicationServer:1">
<AppListing><appList><app><appID>0x4</appID><name>Bluetooth HFP</name><description>Bluetooth HFP Audio</description><allowedProfileIDs>0</allowedProfileIDs><remotingInfo><protocolID>BTHFP</protocolID><direction>bi</direction></remotingInfo><audioInfo><audioType>phone</audioType><contentCategory>0x1</contentCategory><contentRules>0x0</contentRules><trustLevel>0x80</trustLevel></audioInfo><resourceStatus>free</resourceStatus></app><app><appID>0x3</appID><name>Bluetooth A2DP</name><description>Bluetooth A2DP Audio Server</description><allowedProfileIDs>0</allowedProfileIDs><remotingInfo><protocolID>BTA2DP</protocolID><direction>out</direction></remotingInfo><audioInfo><audioType>application</audioType><contentCategory>0x2</contentCategory><contentRules>0x0</contentRules><trustLevel>0x80</trustLevel></audioInfo><resourceStatus>free</resourceStatus></app><app><appID>0x5</appID><name>RTP Server 99</name><description>RTP Audio Server</description><allowedProfileIDs>0</allowedProfileIDs><remotingInfo><protocolID>RTP</protocolID><format>99</format><direction>out</direction><audioIPL>4800</audioIPL><audioMPL>9600</audioMPL></remotingInfo><appInfo><appCategory>0xf0000001</appCategory><trustLevel>0x80</trustLevel></appInfo><audioInfo><audioType>application</audioType><contentCategory>0x2</contentCategory><contentRules>0x0</contentRules><trustLevel>0x80</trustLevel></audioInfo><resourceStatus>free</resourceStatus></app><app><appID>0x6</appID><name>RTP Server 98</name><description>RTP Audio Server</description><allowedProfileIDs>0</allowedProfileIDs><remotingInfo><protocolID>RTP</protocolID><format>98</format><direction>out</direction><audioIPL>4800</audioIPL><audioMPL>9600</audioMPL></remotingInfo><appInfo><appCategory>0xf0000001</appCategory><trustLevel>0x80</trustLevel></appInfo><audioInfo><audioType>application</audioType><contentCategory>0x2</contentCategory><contentRules>0x0</contentRules><trustLevel>0x80</trustLevel></audioInfo><resourceStatus>free</resourceStatus></app><app><appID>0x7</appID><name>RTP Client 99</name><description>RTP Audio Client</description><allowedProfileIDs>0</allowedProfileIDs><remotingInfo><protocolID>RTP</protocolID><format>99</format><direction>in</direction><audioIPL>4800</audioIPL><audioMPL>9600</audioMPL></remotingInfo><appInfo><appCategory>0xf0000002</appCategory><trustLevel>0x80</trustLevel></appInfo><audioInfo><audioType>phone</audioType><contentCategory>0x10</contentCategory><contentRules>0x0</contentRules><trustLevel>0x80</trustLevel></audioInfo><resourceStatus>free</resourceStatus></app><app><appID>0x8</appID><name>RTP Client 98</name><description>RTP Audio Client</description><allowedProfileIDs>0</allowedProfileIDs><remotingInfo><protocolID>RTP</protocolID><format>98</format><direction>in</direction><audioIPL>4800</audioIPL><audioMPL>9600</audioMPL></remotingInfo><appInfo><appCategory>0xf0000002</appCategory><trustLevel>0x80</trustLevel></appInfo><audioInfo><audioType>phone</audioType><contentCategory>0x10</contentCategory><contentRules>0x0</contentRules><trustLevel>0x80</trustLevel></audioInfo><resourceStatus>free</resourceStatus></app><app><appID>0x9</appID><name>Device Attestation</name><allowedProfileIDs>0</allowedProfileIDs><remotingInfo><protocolID>DAP</protocolID></remotingInfo><appInfo><appCategory>0xf0000001</appCategory><trustLevel>0x0</trustLevel></appInfo><resourceStatus>free</resourceStatus></app><app><appID>0xa</appID><name>Common Data Bus</name><description>CDB Server Endpoint</description><allowedProfileIDs>0</allowedProfileIDs><remotingInfo><protocolID>CDB</protocolID><format>1.1</format></remotingInfo><appInfo><appCategory>0xf0000000</appCategory><trustLevel>0x80</trustLevel></appInfo><resourceStatus>free</resourceStatus></app>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod>
<ds:Reference URI="">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod>
<ds:DigestValue>pAijzscQ7RO3w/PwNyDLvYgLKps=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
ydcWz3u/32wDEVbG7D/hB8/P0TG0KL2Plt3y8zMIg95LRsKNcafX/nR40/JLH/bfCtg4lmrgoHCq
3OJvtrhZUhm6cRS/WnyX0WX8mZR9d0clt4q7SYKDVbO8kLX9yL4/HspvACAZtMYd6y6ODKP6s/DM
niJwsDgfpEoR1u8JBDEA6GtzElTgdZdIws3QlM/IzEQm0K4BVVlkUxF4QmBVIQiLymp+6rNWWtd8
U2K3mRtaEwUhHVG8on0xNCyx+7+WgrbQHp5eLBirVEw4gXxMXp5UEIH17CPbHw5le1tRsPz9es1K
ip8JDw0EChmxEmdLn/Om3s34vibLWpyBWBPH9g==
</ds:SignatureValue>
</ds:Signature></appList>
</AppListing>
</u:GetApplicationListResponse>
4、然后可以根据app相关信息调用函数GetCertifiedApplicationsList、GetApplicationCertificateInfo、GetApplicationStatus、LaunchApplication和TerminateApplication
<?xml version="1.0"?>
<u:GetCertifiedApplicationsList xmlns:u="urn:schemas-upnp-org:service:TmApplicationServer:1">
<AppCertFilter>*</AppCertFilter>
<ProfileID>0</ProfileID>
</u:GetCertifiedApplicationsList><?xml version="1.0"?>
<u:GetCertifiedApplicationsListResponse xmlns:u="urn:schemas-upnp-org:service:TmApplicationServer:1">
<CertifiedAppList>0x2,0xb</CertifiedAppList>
</u:GetCertifiedApplicationsListResponse><?xml version="1.0"?>
<u:LaunchApplication xmlns:u="urn:schemas-upnp-org:service:TmApplicationServer:1">
<AppID>0x2</AppID>
<ProfileID>0</ProfileID>
</u:LaunchApplication><?xml version="1.0"?>
<u:TerminateApplication xmlns:u="urn:schemas-upnp-org:service:TmApplicationServer:1">
<AppID>0x2</AppID>
<ProfileID>0</ProfileID>
</u:TerminateApplication><?xml version="1.0"?>
<u:GetApplicationCertificateInfo xmlns:u="urn:schemas-upnp-org:service:TmApplicationServer:1">
<AppID>0x6</AppID>
</u:GetApplicationCertificateInfo><?xml version="1.0"?>
<u:GetApplicationCertificateInfoResponse xmlns:u="urn:schemas-upnp-org:service:TmApplicationServer:1">
<AppCertification></AppCertification>
</u:GetApplicationCertificateInfoResponse><?xml version="1.0"?>
<u:GetApplicationStatus xmlns:u="urn:schemas-upnp-org:service:TmApplicationServer:1">
<AppID>0x6</AppID>
</u:GetApplicationStatus><?xml version="1.0"?>
<u:GetApplicationStatusResponse xmlns:u="urn:schemas-upnp-org:service:TmApplicationServer:1">
<AppStatus><appStatusList><appStatus><appID>0x6</appID><status><profileID>0</profileID><statusType>Notrunning</statusType></status></appStatus>
</appStatusList>
</AppStatus>
</u:GetApplicationStatusResponse>解析以后:
<?xml version="1.0"?>
<u:GetApplicationStatusResponse xmlns:u="urn:schemas-upnp-org:service:TmApplicationServer:1">
<AppStatus><appStatusList><appStatus><appID>0x6</appID><status><profileID>0</profileID><statusType>Notrunning</statusType></status></appStatus>
</appStatusList>
</AppStatus>
</u:GetApplicationStatusResponse>
三、libupnp的编译
libupnp 来源于http://pupnp.sourceforge.net/,其有多个版本可以下载;
如libupnp版本1.8.4下载后为libupnp-1.8.4.tar.bz2,需要将其放置到Ubuntu中进行解压,libupnp的文档也在此压缩档中;
解压方式是:
.tar.gz 格式解压为 tar -zxvf xx.tar.gz
.tar.bz2 格式解压为 tar -jxvf xx.tar.bz2
编译
系统要求
libpthread程序包 --由于threadutil使用了pthread线程,所以这个包要提前安装
编译
核心库的编译
$ cd $(LIBUPNP) 进入libupnp根目录
$ ./configure #默认配置下,会将include文件安在/usr/local/include/upnp目录
#将lib文件安装在/usr/local/lib目录下
$ make #编译核心库
$ sudo make install
四、libupnp库的修改
由于usb断开时,upnp发送断开太慢,所以需要进行修改:
1、\libupnp-1.8.4\upnp\src\inc\upnpapi.h(socket读写超时设置成2s)
2、libupnp-1.8.4\upnp\src\inc\httpreadwrite.h(http超时设置成2s)
3、libupnp-1.8.4\upnp\src\genlib\net\http\httpreadwrite.c(connect非阻塞模式timeout由5s修改成2s)
4、libupnp-1.8.4\configure(connect修改成非阻塞模式)
MirrorLink(三 UPNP)-- 使用相关推荐
- UPnP协议介绍和Android代码实现
UPnP协议介绍 一. UPnP简介 英文名称:Universal Plug and Play 中文译名:通用即插即用 UPnP是由"通用即插即用论坛"(UPnP™ Forum)推 ...
- UPnP协议编程实践
本专题主要是介绍UPnP的工作原理和基本概念,包括SSDP.GENA和FXPP等基本协议,以及在Linux下如何使用Intel提供的UPnP开发包实现UPnP控制点和设备.本文是这个专题的第一篇,主要 ...
- 虚拟服务器设置upnp,TP-Link路由器如何设置UPNP开启【设置步骤】
本文介绍了TP-Link路由器设置UPNP开启的方法.UPnP是一种用于电脑和智能设备(或仪器)的常见对等网络连接的体系结构.当路由器打开UPNP功能后,如果用户电脑中的软件也支持UPNP协议,路由器 ...
- 播放dlna服务器上文件,群晖使用教程:DLNA/UPnP协议和Kodi在多设备上播放媒体文件...
摘要: 起始缘由:使用Transmission下载到文件夹里的电影在电视上的Kodi文件未更新(如图)如何安装Transmission(bt/PT软件)教程 https://ww... 起始缘由:使用 ...
- P2P技术详解(三):P2P中的NAT穿越(打洞)方案详解(进阶分析篇)
目录 1.NAT和NAPT 2.NAT带来的问题 3.P2P通信穿越NAT的技术.方法 4.NAT穿越技术1:应用层网关 4.1.原理 4.2.限制 5.NAT穿越技术2:中间件技术 5.1.原理 5 ...
- 群晖NAS的公网、NAT、DDNS、证书等配置三
群晖搭建属于个人邮箱服务器案例 一.软硬件环境 群晖920+(系统版本DSM7.1) 黑群.白群原理上可以安装mail套件就可以,我是白群,其他品牌NAS也可以参考一下思路. J4125软路由(PVE ...
- CallStranger UPnP 漏洞曝光,影响数十亿台设备
执行摘要 随着物联网的不断发展,物联网安全也越来越受到关注.自 2016 年下半年的 Mirai 僵尸网络攻击 事件之后,物联网相关的威胁层出不穷,多个在野漏洞被攻击者所利用,多个僵尸网络相继被研究人 ...
- GPRS/NFC/ 红外线/ 传感器/ 串口 ,DLNA/UPnP 等
移植bluetooth和wifi,bluez移植. <深入理解Android:Wi-Fi,NFC和GPS>章节连载[节选]-- http://blog.csdn.net/Innost/a ...
- DLNA介绍(包含UPnP,2011/6/20 更新)
这部分的内容大多来源于网络及官方文档,依照自己的翻译理解整理所成.东西比較多,从头慢慢看还是能够懂个大概的. 文件夹: 一.DNLA的建立 二.DLNA的成员 三.DLNA标准的制定 四.DLNA的设 ...
最新文章
- NLP诗词生成模型数据准备及实战
- PHP ‘ext/soap/soap.c’权限许可和访问控制
- 给自定义控件(Web Control)添加事件的几种方法。前两种方法可以不实现IPostBackEventHandler...
- redis数据持久化到mysql_Redis【数据持久化篇】
- oracle段管理方式设为自动,oracle自动段管理ASSM笔记
- 配置和使用OCS 2007会议功能
- mysql 分组统计 取最大值_(Mysql)sql分组取最大值问题
- 《南溪的python灵隐笔记》——有趣的Munch字典库
- 人脸检测(五)--adaboost总结,整理
- 依赖注入(DI)入门
- 51单片机自学好找工作吗,怎样学才能找到适合的工作
- ubuntu安装ulipad
- SPSS教程-t检验怎么做?
- 基于arduino ws2812b简单的渐变代码
- Vue项目中使用富文本编辑器
- 自定义注解加aop切面实现动态修改方法参数
- quartz表删除顺序
- lzg_ad:XPE开发工具使用说明
- Tensorflow中 tf.train.exponential_decay() 等实现学习率衰减
- GXOI/GZOI2019题解