protected static function getDeviceInfo($devices)
    {
        $infos = [];
        foreach ($devices as $device) {
            $sender = $device['_sender'];
            $port = static::getPort($device['data']);
            $ip = substr($sender, 0, strpos($sender, ':'));
            $client = static::getClientByDevice($device);
            $info = static::getClientInfo($client);
            $info = $info['root']['device'];

            // Skipping emulated wemo switch by fauxmo.
            if($info['deviceType'] !== 'urn:MakerMusingsArif:device:controllee:1') {
                $id = str_replace(' ', '_', strtolower($info['friendlyName']));
                $data = [
                    'id'           => $id,
                    'ip'           => $ip,
                    'port'         => $port,
                    'deviceType'   => $info['deviceType'],
                    'friendlyName' => $info['friendlyName'],
                    'modelName'    => $info['modelName'],
                    'UDN'          => $info['UDN']
                ];

                if (static::isBridge($info['modelName'])) {
                    $bridge = new Bridge($ip, $client);
                    $bridgeDevices = $bridge->getPairedDevices(true);

                    foreach ($bridgeDevices as $i => $bridgeDevice) {
                        $bridgeDevice['id'] = str_replace(' ', '_', strtolower($bridgeDevice['FriendlyName']));
                        $bridgeDevices[$i] = $bridgeDevice;
                    }

                    $data['class_name'] = Bridge::class;
                    $data['device'] = $bridgeDevices;
                } else if (static::isLightSwitch($info['modelName'])) {
                    $data['class_name'] = LightSwitch::class;
                } else if (static::isWemoSwitch($info['modelName'])) {
                    $data['class_name'] = WemoSwitch::class;
                } else if (static::isInsightSwitch($info['modelName'])) {
                    $data['class_name'] = InsightSwitch::class;
                } else if (static::isEmulatedWemoSwitch($info['modelName'])) {
                    $data['class_name'] = WemoSwitch::class;
                } else {
                    static::resolveOtherDevices($data, $info, $device);
                }

                $infos[] = $data;
            }
        }

        return $infos;
    }
protected static function getDeviceInfo($devices)
    {
        $infos = [];
        foreach ($devices as $device) {
            $sender = $device['_sender'];
            $port = static::getPort($device['data']);
            $ip = substr($sender, 0, strpos($sender, ':'));
            $client = static::getClientByDevice($device);
            $info = static::getClientInfo($client);
            $info = $info['root']['device'];

            // Skipping emulated wemo switch by fauxmo.
            if($info['deviceType'] !== 'urn:MakerMusingsArif:device:controllee:1') {
                $id = str_replace(' ', '_', strtolower($info['friendlyName']));
                $data = [
                    'id'           => $id,
                    'ip'           => $ip,
                    'port'         => $port,
                    'deviceType'   => $info['deviceType'],
                    'friendlyName' => $info['friendlyName'],
                    'modelName'    => $info['modelName'],
                    'UDN'          => $info['UDN']
                ];

                if (static::isBridge($info['modelName'])) {
                    $bridge = new Bridge($ip, $client);
                    $bridgeDevices = $bridge->getPairedDevices(true);

                    foreach ($bridgeDevices as $i => $bridgeDevice) {
                        $bridgeDevice['id'] = str_replace(' ', '_', strtolower($bridgeDevice['FriendlyName']));
                        $bridgeDevices[$i] = $bridgeDevice;
                    }

                    $data['class_name'] = Bridge::class;
                    $data['device'] = $bridgeDevices;
                } else if (static::isLightSwitch($info['modelName'])) {
                    $data['class_name'] = LightSwitch::class;
                } else if (static::isWemoSwitch($info['modelName'])) {
                    $data['class_name'] = WemoSwitch::class;
                } else if (static::isInsightSwitch($info['modelName'])) {
                    $data['class_name'] = InsightSwitch::class;
                } else if (static::isEmulatedWemoSwitch($info['modelName'])) {
                    $data['class_name'] = WemoSwitch::class;
                } else {
                    static::resolveOtherDevices($data, $info, $device);
                }

                $infos[] = $data;
            }
        }

        return $infos;
    }
protected static function getDeviceInfo ( $ devices ) { $ infos = [ ] ; foreach ( $ devices as $ device ) { $ sender = $ device [ '_sender' ] ; $ port = static :: getPort ( $ device [ 'data' ] ) ; $ ip = substr ( $ sender , 0 , strpos ( $ sender , ':' ) ) ; $ client = static :: getClientByDevice ( $ device ) ; $ info = static :: getClientInfo ( $ client ) ; $ info = $ info [ 'root' ] [ 'device' ] ; // Skipping emulated wemo switch by fauxmo. if ( $ info [ 'deviceType' ] !== 'urn:MakerMusingsArif:device:controllee:1' ) { $ id = str_replace ( ' ' , '_' , strtolower ( $ info [ 'friendlyName' ] ) ) ; $ data = [ 'id' => $ id , 'ip' => $ ip , 'port' => $ port , 'deviceType' => $ info [ 'deviceType' ] , 'friendlyName' => $ info [ 'friendlyName' ] , 'modelName' => $ info [ 'modelName' ] , 'UDN' => $ info [ 'UDN' ] ] ; if ( static :: isBridge ( $ info [ 'modelName' ] ) ) { $ bridge = new Bridge ( $ ip , $ client ) ; $ bridgeDevices = $ bridge -> getPairedDevices ( true ) ; foreach ( $ bridgeDevices as $ i => $ bridgeDevice ) { $ bridgeDevice [ 'id' ] = str_replace ( ' ' , '_' , strtolower ( $ bridgeDevice [ 'FriendlyName' ] ) ) ; $ bridgeDevices [ $ i ] = $ bridgeDevice ; } $ data [ 'class_name' ] = Bridge :: class ; $ data [ 'device' ] = $ bridgeDevices ; } else if ( static :: isLightSwitch ( $ info [ 'modelName' ] ) ) { $ data [ 'class_name' ] = LightSwitch :: class ; } else if ( static :: isWemoSwitch ( $ info [ 'modelName' ] ) ) { $ data [ 'class_name' ] = WemoSwitch :: class ; } else if ( static :: isInsightSwitch ( $ info [ 'modelName' ] ) ) { $ data [ 'class_name' ] = InsightSwitch :: class ; } else if ( static :: isEmulatedWemoSwitch ( $ info [ 'modelName' ] ) ) { $ data [ 'class_name' ] = WemoSwitch :: class ; } else { static :: resolveOtherDevices ( $ data , $ info , $ device ) ; } $ infos [ ] = $ data ; } } return $ infos ; }
Fetches device details

@param $devices

@return array
Fetches device details