Bugfixes
This commit is contained in:
parent
01f6f960dc
commit
116233d81a
@ -245,7 +245,7 @@ function show_device_long(Device $device, $level=0) {
|
|||||||
);
|
);
|
||||||
printf("{$indent} \e[32m%s\e[0m\n", $device->getUrl());
|
printf("{$indent} \e[32m%s\e[0m\n", $device->getUrl());
|
||||||
foreach ($device->getServices() as $service) {
|
foreach ($device->getServices() as $service) {
|
||||||
printf("{$indent} + \e[36m%s\e[0m\n{$indent} \e[32m%s\e[0m\n", $service->getServiceType(), $service->getServiceUrl());
|
printf("{$indent} + \e[36m%s\e[0m\n{$indent} \e[32m%s\e[0m\n", $service->getServiceType(), $service->getUrl());
|
||||||
}
|
}
|
||||||
foreach ($device->getDevices() as $subdevice) {
|
foreach ($device->getDevices() as $subdevice) {
|
||||||
show_device_long($subdevice, $level+1);
|
show_device_long($subdevice, $level+1);
|
||||||
@ -253,5 +253,5 @@ function show_device_long(Device $device, $level=0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function show_results_json(Discovery $discovery) {
|
function show_results_json(Discovery $discovery) {
|
||||||
echo json_encode($discovery, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)."\n";
|
echo json_encode($discovery->jsonSerialize())."\n";
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,11 @@ class Device implements JsonSerializable
|
|||||||
return $this->modelDescription;
|
return $this->modelDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the device description URL
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getUrl()
|
public function getUrl()
|
||||||
{
|
{
|
||||||
return $this->specUrl;
|
return $this->specUrl;
|
||||||
|
@ -72,7 +72,7 @@ class Discovery implements IteratorAggregate, JsonSerializable
|
|||||||
|
|
||||||
public function jsonSerialize()
|
public function jsonSerialize()
|
||||||
{
|
{
|
||||||
return $this->devices;
|
return array_values($this->devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,12 @@ class Service implements JsonSerializable
|
|||||||
return $this->scpdUrl;
|
return $this->scpdUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getServiceUrl()
|
/**
|
||||||
|
* Get the service description URL
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUrl()
|
||||||
{
|
{
|
||||||
if (strpos($this->scpdUrl,"://")!==false) {
|
if (strpos($this->scpdUrl,"://")!==false) {
|
||||||
return $this->scpdUrl;
|
return $this->scpdUrl;
|
||||||
|
Loading…
Reference in New Issue
Block a user