Discovery
in package
implements
CollectionInterface
FinalYes
Table of Contents
Interfaces
- CollectionInterface
- Manage a group of devices.
Properties
- $collection : CollectionInterface
- $discovered : bool
- $multicastAddress : string
- $networkInterface : string|int|null
Methods
- __construct() : mixed
- addDevice() : $this
- Add a device to this collection.
- addIp() : $this
- Add a device to this collection using its IP address
- clear() : $this
- Remove all devices from this collection.
- getDevices() : array<string|int, DeviceInterface>
- Get all of the devices on the current network
- getLogger() : LoggerInterface
- Get the logger currently in use.
- getMulticastAddress() : string
- Get the multicast address to use for SSDP discovery.
- getNetworkInterface() : string|int|null
- Get the network interface currently in use
- setLogger() : void
- setMulticastAddress() : $this
- Set the multicast address to use for SSDP discovery.
- setNetworkInterface() : $this
- Set the network interface to use for SSDP discovery.
- discoverDevices() : void
- Get all the devices on the current network.
Properties
$collection
private
CollectionInterface
$collection
$discovered
private
bool
$discovered
= false
$multicastAddress
private
string
$multicastAddress
= "239.255.255.250"
$networkInterface
private
string|int|null
$networkInterface
= null
Methods
__construct()
public
__construct([CollectionInterface|null $collection = null ]) : mixed
Parameters
- $collection : CollectionInterface|null = null
addDevice()
Add a device to this collection.
public
addDevice(DeviceInterface $device) : $this
Parameters
- $device : DeviceInterface
-
The device to add
Return values
$thisaddIp()
Add a device to this collection using its IP address
public
addIp(string $address) : $this
Parameters
- $address : string
-
The IP address of the device to add
Return values
$thisclear()
Remove all devices from this collection.
public
clear() : $this
Return values
$thisgetDevices()
Get all of the devices on the current network
public
getDevices() : array<string|int, DeviceInterface>
Return values
array<string|int, DeviceInterface>getLogger()
Get the logger currently in use.
public
getLogger() : LoggerInterface
Return values
LoggerInterfacegetMulticastAddress()
Get the multicast address to use for SSDP discovery.
public
getMulticastAddress() : string
Return values
stringgetNetworkInterface()
Get the network interface currently in use
public
getNetworkInterface() : string|int|null
Return values
string|int|nullsetLogger()
public
setLogger(LoggerInterface $logger) : void
Parameters
- $logger : LoggerInterface
setMulticastAddress()
Set the multicast address to use for SSDP discovery.
public
setMulticastAddress(string $multicastAddress) : $this
Parameters
- $multicastAddress : string
-
The address to use
Return values
$thissetNetworkInterface()
Set the network interface to use for SSDP discovery.
public
setNetworkInterface(string|int $networkInterface) : $this
See the documentation on IP_MULTICAST_IF at http://php.net/manual/en/function.socket-get-option.php
Parameters
- $networkInterface : string|int
-
The interface to use
Return values
$thisdiscoverDevices()
Get all the devices on the current network.
private
discoverDevices(SocketInterface $socket) : void
Parameters
- $socket : SocketInterface
-
An instance to send the discovery request via