logging added.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
;; available through upnp-device-type.
|
||||
|
||||
(require racket/list
|
||||
simple-log
|
||||
racket/string
|
||||
"device.rkt"
|
||||
"ssdp.rkt")
|
||||
@@ -24,7 +25,7 @@
|
||||
upnp-device-type
|
||||
upnp-device-services)
|
||||
|
||||
(define-logger upnp)
|
||||
(sl-def-log upnp-query)
|
||||
|
||||
(define device-kind-table
|
||||
'((media-renderer
|
||||
@@ -141,7 +142,7 @@
|
||||
(with-handlers
|
||||
([exn:fail?
|
||||
(lambda (exception)
|
||||
(log-upnp-warning
|
||||
(warn-upnp-query
|
||||
"unable to read UPnP description ~a: ~a"
|
||||
(ssdp-response-location (car responses) "<unknown>")
|
||||
(exn-message exception))
|
||||
@@ -175,11 +176,25 @@
|
||||
;; device tree is filtered afterwards.
|
||||
(define (query-upnp-devices [kinds-value 'all]
|
||||
#:interface [interface #f]
|
||||
#:dns? [dns? #f])
|
||||
#:dns? [dns? #f]
|
||||
#:mx [mx 3]
|
||||
#:timeout [timeout #f]
|
||||
#:repeat [repeat 3])
|
||||
(dbg-upnp-query
|
||||
"Querying UPnP devices kinds=~s interface=~a dns?=~a mx=~a timeout=~a repeat=~a"
|
||||
kinds-value
|
||||
(or interface "default")
|
||||
dns?
|
||||
mx
|
||||
(or timeout "default")
|
||||
repeat)
|
||||
(let* ([kinds (normalize-kinds kinds-value)]
|
||||
[responses
|
||||
(ssdp-discover (search-target kinds)
|
||||
#:interface interface)]
|
||||
#:interface interface
|
||||
#:mx mx
|
||||
#:timeout timeout
|
||||
#:repeat repeat)]
|
||||
[groups (ssdp-group-responses responses)]
|
||||
[devices
|
||||
(append-map
|
||||
|
||||
Reference in New Issue
Block a user