SlideShare a Scribd company logo
1 of 93
Download to read offline
Wen Liao
UPnP 1.0 簡介
台北市
Disclaimer
投影片資料為作者整理資料及個人意見,沒有經
過嚴謹確認,請讀者自行斟酌
測試環境
測試環境
測試環境
測試環境
關於UPnP
● Universal Plug and Play
○ 一種網路通訊協定
○ 目的:萬用遙控器
■ 不用安裝Driver
■ 不用安裝指定的軟體
■ 適用於所有支援UPnP的設備
萬用遙控器??
http://en.wikipedia.org/wiki/File:Remote_controls.JPG
萬用遙控器要處理的問題
● 以家電的遙控器比喻
○ 每個家電按鈕不同,功能不同,使用方式不同
■ 就算同一種家電,不同廠牌,甚至同廠牌不同型號
一樣有相同的問題
○ 要怎麼知道現在有那幾台設備可以用?
■ A牌電風扇
■ B牌播放器
■ C牌電燈
○ 要怎麼知道設備狀態?
每個家電按鈕不同,功能不同,使用方式
不同
● 大家講好規矩
● 主導者:UPnP forum
■ 很多大頭
○ 規範Device control protocols
■ AV
■ 電燈控制
■ 印表機
■ …
要怎麼知道現在有那幾台設備可以用?
● 遙控器大喊一聲看誰答話
● 設備有事沒事跟大家說我還活著,以及提供的
服務
要怎麼知道設備狀態?
● 遙控器直接問
● 遙控器告訴設備說哪些狀態更動的時候要跟
我說,如
○ 播放器更動播放內容
○ ...
觀念
● 整個控制可以分成兩個角色
○ 遙控器
○ 設備
● 遙控器的按鈕,可以看成呼叫服務
○ 將溫度設定成25度
○ 切到下一個頻道
● 接樓上,所以這是一個遠端呼叫的概念。洋人
的話就是remote procedure call,簡稱RPC
進入正題
正名
● Control point
○ 你的遙控器啦
● Device
○ 被遙控的東西
UPnP Networks Steps
Addressing
Discover
Description
Event
Presentation
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
Control
什麼鬼?請講中文好嘛?
講中文:Control point篇
● 知道自己在那邊。(跳過Auto IP,一言難盡)
● 先知道自己是啥,以媒體播放器(media
render)為例
○ 問看看網路上有沒有媒體播放器,有的請發聲
○ 當然不是問完以後就沒事,搞不好上線後十三分鐘後
有另外一個媒體播放器上線,你也得知道吧?
● 從剛才報數的媒體播放器中知道他有提供哪
些服務。
● 開工如訂閱媒體播放器的播放狀態、播放影
片,調整音量等
● Presentation呢?沒這東西(煙)
講中文:Device篇
● 知道自己在那邊。(跳過Auto IP,一言難盡)
● 先知道自己是啥,以媒體播放器(media
render)為例
○ 定期公佈,告訴大家,我是是媒體播放器唷。以下是我
的服務...
○ 有人來問你是不是媒體播放器要回答我是
● 開工如處理播放影片,調整音量,接受訂閱
event當trigger時通知control point等
● Presentation呢?看實作,有的話,你可以用瀏
覽器連上去更改一些設定
名詞
● HTTP
○ Hypertext Transfer Protocol
● HTTPU
○ U就是UDP
● HTTPMU
○ M是Multicast
○ U還是UDP
● HTTPD
○ Daemon ,就是web server
名詞
● SSDP
○ Simple Service Discovery Protocol
● SOAP
○ Simple Object Access protocol
● GENA
○ General Event Notification Architecture
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
使用XML描述呼叫
遠端服務以及回傳
的結果
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
註冊要監聽的event以
及當event被觸發回傳
使用的通訊協定
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
Device有設定Presentation
URL的話總要有個提供網
頁的web server吧?
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
通知大家
● Control point:
○ 哪邊有「我要的服務」的device?有的話
該一聲
● Device
○ 我還沒死
○ 我要閃人了
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
無聊的方塊圖
TCP
IP
UDP
HTTP HTTPU HTTPMU
SOAP GENA HTTPD SSDP
UPnP Device Architecture
Device Control Protocols
APP/Libraries
Device 回應 control
point的詢問
http://upnp.org/sdcps-and-certification/standards/device-architecture-documents/
沒fu? 來看範例
Step 1:
Control point 找到
Device
場景一:Device
自行宣傳
6個封包?那6個?
● UPnP規範,device 自我宣傳要有
○ 3個root device
○ 任意個embedded device (不討論)
○ 任意個service
來看封包:
淺紅底文字的是發送端封包
內容
Notification type
Device advertisement: root device (1)
Notification sub type
Unique service name
Root device description
URL!
Device advertisement: root device (2)
UUID
Device advertisement: root device (3)
device type
Device advertisement: AVT service
Device advertisement: CM service
Device advertisement: RCS service
場景二:Control point自
己問
Control point
Device
先看Control Point封包
等待秒數
Search type:
這邊全找,也可以指定
特定type
插花:指名MediaServer和
MediaRender坐檯 (各一個封包)
再看Device response
Device response順序和
自我宣傳差別只有NT換
成ST以及沒有NTS描述
● NT: Notification type
● ST: Service type
● NTS: Notification sub type
Service type
Device response: root device (1)
Device response: root device (2)
Device response: root device (3)
Device response: AVT service
Device response: CM service
Device response: RCS service
場景三:Device 離線
基本上就是把場景一的keep alive換成
byebye。另外有規範要送超過兩次以避
免漏掉。
Device offline: root device (1)
Device offline: root device (2)
Device offline: root device (3)
Device offline: AVT Service
Device offline: CM Service
Device offline: RCS Service
Step 2:
Control point
取得 Device資訊
很簡單,前面的封包都
有Location URL。
用瀏覽器開一下吧
UPnP 架構版號Device 描述
UPnP 架構版本
Device描述
● 設備類型
● 產品資訊
● 辨別UUID
● 提供服務
● ….
提供Icon給control point使用
提供的服務:AVT, CM, RCS
服務提供的資訊
Type 和ID使用UPnP
定的標準要遵守規範
服務提供的資訊
真正描述提供服務的
地方
服務提供的資訊
你要送命令的URL
服務提供的資訊
c
訂閱要監聽event的
URL
有Action name和paramter,像不像
function call啊?
開啟scpd.xml URL
來看封包:
淺紅底文字的是發送端封包
內容
淺藍底文字的是接收端
封包內容
Control point取得 Location URL
HTTP GET
HTTP Response
Device description
Control point取得AVT的服務描述
HTTP GET
HTTP Response
Device description
device
服
務
視
覺
化
Step 3:
Control point 控制
Device
以GetTransportInfo為例
參數 Instance ID
回傳目前
state、status和
播放速度
按下這個送出request
後的畫面
來看封包:
淺紅底文字的是發送端封包
內容
淺藍底文字的是接收端
封包內容
看封包時間:Contronl point的action
Post到描述XML指定的control URL
Action name
參數: Instance ID:0
看封包時間:Device repsonse
回傳state為Stop
回傳狀態為OK
播放速度為1
Step 3:
Control point 取得
Device event資訊
直接看封包:
淺紅底文字的是發送端封包
內容
淺藍底文字的是接收端
封包內容
Control point 訂閱監聽事件
告訴Device event要往那
邊送
Subscription ID
還記得EventSubURL嗎?
Device 送出event,Control point回應
Subscription ID和上
頁相同
資料變動
Device 停止播放送出event,Control
point回應
資料變動
Subscription ID和上
頁相同
Control point可以放棄註冊
還記得EventSubURL嗎?
要unsubscribe的 ID
總結
● UPnP 提供預先定義好的規範,讓不同的是設
備不需要驅動程式,特殊軟體就可以透過網路
操作
● UPnP透過SSDP讓control point能夠找出網路
的Device
● UPnP透過GENA讓control point能夠被動接受
device送出來的事件
參考資料
● UPnP Forum 文件
○ 包含MediaRender

More Related Content

What's hot

DPDK IPSec performance benchmark ~ Georgii Tkachuk
DPDK IPSec performance benchmark ~ Georgii TkachukDPDK IPSec performance benchmark ~ Georgii Tkachuk
DPDK IPSec performance benchmark ~ Georgii TkachukIntel
 
DPDK: Multi Architecture High Performance Packet Processing
DPDK: Multi Architecture High Performance Packet ProcessingDPDK: Multi Architecture High Performance Packet Processing
DPDK: Multi Architecture High Performance Packet ProcessingMichelle Holley
 
用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver艾鍗科技
 
Linux MMAP & Ioremap introduction
Linux MMAP & Ioremap introductionLinux MMAP & Ioremap introduction
Linux MMAP & Ioremap introductionGene Chang
 
Share the Experience of Using Embedded Development Board
Share the Experience of Using Embedded Development BoardShare the Experience of Using Embedded Development Board
Share the Experience of Using Embedded Development BoardJian-Hong Pan
 
COSCUP 2020 RISC-V 32 bit linux highmem porting
COSCUP 2020 RISC-V 32 bit linux highmem portingCOSCUP 2020 RISC-V 32 bit linux highmem porting
COSCUP 2020 RISC-V 32 bit linux highmem portingEric Lin
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
 
eMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overvieweMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overviewVijayGESYS
 
Understanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panicUnderstanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panicJoseph Lu
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013Wave Digitech
 
Hyper-V を使おう
Hyper-V を使おうHyper-V を使おう
Hyper-V を使おうwataken44
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device driversHoucheng Lin
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequenceHoucheng Lin
 

What's hot (20)

DPDK IPSec performance benchmark ~ Georgii Tkachuk
DPDK IPSec performance benchmark ~ Georgii TkachukDPDK IPSec performance benchmark ~ Georgii Tkachuk
DPDK IPSec performance benchmark ~ Georgii Tkachuk
 
DPDK: Multi Architecture High Performance Packet Processing
DPDK: Multi Architecture High Performance Packet ProcessingDPDK: Multi Architecture High Performance Packet Processing
DPDK: Multi Architecture High Performance Packet Processing
 
Introduction to Linux Drivers
Introduction to Linux DriversIntroduction to Linux Drivers
Introduction to Linux Drivers
 
用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver
 
レシピの作り方入門
レシピの作り方入門レシピの作り方入門
レシピの作り方入門
 
Linux MMAP & Ioremap introduction
Linux MMAP & Ioremap introductionLinux MMAP & Ioremap introduction
Linux MMAP & Ioremap introduction
 
Share the Experience of Using Embedded Development Board
Share the Experience of Using Embedded Development BoardShare the Experience of Using Embedded Development Board
Share the Experience of Using Embedded Development Board
 
COSCUP 2020 RISC-V 32 bit linux highmem porting
COSCUP 2020 RISC-V 32 bit linux highmem portingCOSCUP 2020 RISC-V 32 bit linux highmem porting
COSCUP 2020 RISC-V 32 bit linux highmem porting
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
Linux Internals - Part III
Linux Internals - Part IIILinux Internals - Part III
Linux Internals - Part III
 
I2C Drivers
I2C DriversI2C Drivers
I2C Drivers
 
eMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overvieweMMC Embedded Multimedia Card overview
eMMC Embedded Multimedia Card overview
 
Introduction to Linux
Introduction to LinuxIntroduction to Linux
Introduction to Linux
 
Ext4 filesystem(1)
Ext4 filesystem(1)Ext4 filesystem(1)
Ext4 filesystem(1)
 
Linux I2C
Linux I2CLinux I2C
Linux I2C
 
Understanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panicUnderstanding a kernel oops and a kernel panic
Understanding a kernel oops and a kernel panic
 
U-Boot presentation 2013
U-Boot presentation  2013U-Boot presentation  2013
U-Boot presentation 2013
 
Hyper-V を使おう
Hyper-V を使おうHyper-V を使おう
Hyper-V を使おう
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
 

Viewers also liked

GNU AS簡介
GNU AS簡介GNU AS簡介
GNU AS簡介Wen Liao
 
GNU ld的linker script簡介
GNU ld的linker script簡介GNU ld的linker script簡介
GNU ld的linker script簡介Wen Liao
 
Hello world在那邊?背景說明
Hello world在那邊?背景說明Hello world在那邊?背景說明
Hello world在那邊?背景說明Wen Liao
 
GNU Make, Autotools, CMake 簡介
GNU Make, Autotools, CMake 簡介GNU Make, Autotools, CMake 簡介
GNU Make, Autotools, CMake 簡介Wen Liao
 
Trace 程式碼之皮
Trace 程式碼之皮Trace 程式碼之皮
Trace 程式碼之皮Wen Liao
 
From Home Enabled Personal Media To Instant Personal Media Sharing
From Home Enabled Personal Media To Instant Personal Media SharingFrom Home Enabled Personal Media To Instant Personal Media Sharing
From Home Enabled Personal Media To Instant Personal Media Sharingguest829cce0
 
康軒中自二下Ppt經典款ch5 3實驗
康軒中自二下Ppt經典款ch5 3實驗康軒中自二下Ppt經典款ch5 3實驗
康軒中自二下Ppt經典款ch5 3實驗fbw41598
 
康軒中自二下Ppt經典款ch5 2
康軒中自二下Ppt經典款ch5 2康軒中自二下Ppt經典款ch5 2
康軒中自二下Ppt經典款ch5 2fbw41598
 
康軒中自二下Ppt經典款ch1 1
康軒中自二下Ppt經典款ch1 1康軒中自二下Ppt經典款ch1 1
康軒中自二下Ppt經典款ch1 1fbw41598
 
Guide to GStreamer Application Development Manual: CH1 to CH10
Guide to GStreamer Application Development Manual: CH1 to CH10Guide to GStreamer Application Development Manual: CH1 to CH10
Guide to GStreamer Application Development Manual: CH1 to CH10Wen Liao
 
Testing in python 2.7.3
Testing in python 2.7.3Testing in python 2.7.3
Testing in python 2.7.3Wen Liao
 
康軒中自二下Ppt經典款ch5重點整理
康軒中自二下Ppt經典款ch5重點整理康軒中自二下Ppt經典款ch5重點整理
康軒中自二下Ppt經典款ch5重點整理fbw41598
 
GNU gettext簡介 - 以C語言為範例
GNU gettext簡介 - 以C語言為範例GNU gettext簡介 - 以C語言為範例
GNU gettext簡介 - 以C語言為範例Wen Liao
 
康軒中自二下Ppt經典款ch6科普閱讀up
康軒中自二下Ppt經典款ch6科普閱讀up康軒中自二下Ppt經典款ch6科普閱讀up
康軒中自二下Ppt經典款ch6科普閱讀upfbw41598
 
故事:自由軟體和 Richard Stallman
故事:自由軟體和 Richard Stallman故事:自由軟體和 Richard Stallman
故事:自由軟體和 Richard StallmanWen Liao
 
康軒中自二下Ppt經典款ch6重點整理
康軒中自二下Ppt經典款ch6重點整理康軒中自二下Ppt經典款ch6重點整理
康軒中自二下Ppt經典款ch6重點整理fbw41598
 
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
A Brief Introduction to Regular Expression with Python 2.7.3 Standard LibraryA Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
A Brief Introduction to Regular Expression with Python 2.7.3 Standard LibraryWen Liao
 

Viewers also liked (20)

GNU AS簡介
GNU AS簡介GNU AS簡介
GNU AS簡介
 
GNU ld的linker script簡介
GNU ld的linker script簡介GNU ld的linker script簡介
GNU ld的linker script簡介
 
Hello world在那邊?背景說明
Hello world在那邊?背景說明Hello world在那邊?背景說明
Hello world在那邊?背景說明
 
GNU Make, Autotools, CMake 簡介
GNU Make, Autotools, CMake 簡介GNU Make, Autotools, CMake 簡介
GNU Make, Autotools, CMake 簡介
 
from Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Worksfrom Source to Binary: How GNU Toolchain Works
from Source to Binary: How GNU Toolchain Works
 
Trace 程式碼之皮
Trace 程式碼之皮Trace 程式碼之皮
Trace 程式碼之皮
 
How A Compiler Works: GNU Toolchain
How A Compiler Works: GNU ToolchainHow A Compiler Works: GNU Toolchain
How A Compiler Works: GNU Toolchain
 
From Home Enabled Personal Media To Instant Personal Media Sharing
From Home Enabled Personal Media To Instant Personal Media SharingFrom Home Enabled Personal Media To Instant Personal Media Sharing
From Home Enabled Personal Media To Instant Personal Media Sharing
 
康軒中自二下Ppt經典款ch5 3實驗
康軒中自二下Ppt經典款ch5 3實驗康軒中自二下Ppt經典款ch5 3實驗
康軒中自二下Ppt經典款ch5 3實驗
 
康軒中自二下Ppt經典款ch5 2
康軒中自二下Ppt經典款ch5 2康軒中自二下Ppt經典款ch5 2
康軒中自二下Ppt經典款ch5 2
 
康軒中自二下Ppt經典款ch1 1
康軒中自二下Ppt經典款ch1 1康軒中自二下Ppt經典款ch1 1
康軒中自二下Ppt經典款ch1 1
 
Guide to GStreamer Application Development Manual: CH1 to CH10
Guide to GStreamer Application Development Manual: CH1 to CH10Guide to GStreamer Application Development Manual: CH1 to CH10
Guide to GStreamer Application Development Manual: CH1 to CH10
 
Testing in python 2.7.3
Testing in python 2.7.3Testing in python 2.7.3
Testing in python 2.7.3
 
康軒中自二下Ppt經典款ch5重點整理
康軒中自二下Ppt經典款ch5重點整理康軒中自二下Ppt經典款ch5重點整理
康軒中自二下Ppt經典款ch5重點整理
 
What Can Compilers Do for Us?
What Can Compilers Do for Us?What Can Compilers Do for Us?
What Can Compilers Do for Us?
 
GNU gettext簡介 - 以C語言為範例
GNU gettext簡介 - 以C語言為範例GNU gettext簡介 - 以C語言為範例
GNU gettext簡介 - 以C語言為範例
 
康軒中自二下Ppt經典款ch6科普閱讀up
康軒中自二下Ppt經典款ch6科普閱讀up康軒中自二下Ppt經典款ch6科普閱讀up
康軒中自二下Ppt經典款ch6科普閱讀up
 
故事:自由軟體和 Richard Stallman
故事:自由軟體和 Richard Stallman故事:自由軟體和 Richard Stallman
故事:自由軟體和 Richard Stallman
 
康軒中自二下Ppt經典款ch6重點整理
康軒中自二下Ppt經典款ch6重點整理康軒中自二下Ppt經典款ch6重點整理
康軒中自二下Ppt經典款ch6重點整理
 
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
A Brief Introduction to Regular Expression with Python 2.7.3 Standard LibraryA Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
A Brief Introduction to Regular Expression with Python 2.7.3 Standard Library
 

More from Wen Liao

Hello world 的一生
Hello world 的一生Hello world 的一生
Hello world 的一生Wen Liao
 
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Notes on oracle solaris 11.3 linkers  and libraries guide  chapter oneNotes on oracle solaris 11.3 linkers  and libraries guide  chapter one
Notes on oracle solaris 11.3 linkers and libraries guide chapter oneWen Liao
 
開放街圖 自助旅行的好幫手
開放街圖   自助旅行的好幫手開放街圖   自助旅行的好幫手
開放街圖 自助旅行的好幫手Wen Liao
 
A successful git branching model 導讀
A successful git branching model 導讀A successful git branching model 導讀
A successful git branching model 導讀Wen Liao
 
淺談Debian套件打包
淺談Debian套件打包淺談Debian套件打包
淺談Debian套件打包Wen Liao
 
從組裝軟體中談談軟體發展管理
從組裝軟體中談談軟體發展管理從組裝軟體中談談軟體發展管理
從組裝軟體中談談軟體發展管理Wen Liao
 
軟體組裝心得分享
軟體組裝心得分享軟體組裝心得分享
軟體組裝心得分享Wen Liao
 
Introduce to Linux command line
Introduce to Linux command lineIntroduce to Linux command line
Introduce to Linux command lineWen Liao
 

More from Wen Liao (8)

Hello world 的一生
Hello world 的一生Hello world 的一生
Hello world 的一生
 
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
Notes on oracle solaris 11.3 linkers  and libraries guide  chapter oneNotes on oracle solaris 11.3 linkers  and libraries guide  chapter one
Notes on oracle solaris 11.3 linkers and libraries guide chapter one
 
開放街圖 自助旅行的好幫手
開放街圖   自助旅行的好幫手開放街圖   自助旅行的好幫手
開放街圖 自助旅行的好幫手
 
A successful git branching model 導讀
A successful git branching model 導讀A successful git branching model 導讀
A successful git branching model 導讀
 
淺談Debian套件打包
淺談Debian套件打包淺談Debian套件打包
淺談Debian套件打包
 
從組裝軟體中談談軟體發展管理
從組裝軟體中談談軟體發展管理從組裝軟體中談談軟體發展管理
從組裝軟體中談談軟體發展管理
 
軟體組裝心得分享
軟體組裝心得分享軟體組裝心得分享
軟體組裝心得分享
 
Introduce to Linux command line
Introduce to Linux command lineIntroduce to Linux command line
Introduce to Linux command line
 

UPnP 1.0 簡介