public function normaliseDevices($pending = false)
    {
        try {
            $this->originalDevices = json_decode($this->getClient()->request('GET', 'devices')->getBody());
        } catch (\Exception $e) {
            dd($e->getMessage());
        }

        $this->devices = [];
        $this->pendingDevices= [];

        foreach ($this->originalDevices as $estimoteDevice) {

            $tmp = new \stdClass;
            $tmp->id = $estimoteDevice->identifier;
            $tmp->deviceType = $estimoteDevice->hardware_type;
            $tmp->alias = $estimoteDevice->shadow->name;
            $tmp->uniqueId = $estimoteDevice->identifier;
            $tmp->profiles = ['EDDYSTONE'];
            $tmp->url = '';

            if (!empty($estimoteDevice->pending_settings->advertisers->eddystone_url)) {
                $this->pendingDevices[$tmp->uniqueId] = clone $tmp;
                $this->pendingDevices[$tmp->uniqueId]->url = $estimoteDevice->pending_settings->advertisers->eddystone_url[0]->url;
            }

            $this->devices[$tmp->uniqueId] = clone $tmp;
            if (!empty($estimoteDevice->settings->advertisers->eddystone_url)) {
                $this->devices[$tmp->uniqueId]->url = $estimoteDevice->settings->advertisers->eddystone_url[0]->url;
            }

        }

        return ($pending) ? $this->pendingDevices : $this->devices;
    }
public function normaliseDevices($pending = false)
    {
        try {
            $this->originalDevices = json_decode($this->getClient()->request('GET', 'devices')->getBody());
        } catch (\Exception $e) {
            dd($e->getMessage());
        }

        $this->devices = [];
        $this->pendingDevices= [];

        foreach ($this->originalDevices as $estimoteDevice) {

            $tmp = new \stdClass;
            $tmp->id = $estimoteDevice->identifier;
            $tmp->deviceType = $estimoteDevice->hardware_type;
            $tmp->alias = $estimoteDevice->shadow->name;
            $tmp->uniqueId = $estimoteDevice->identifier;
            $tmp->profiles = ['EDDYSTONE'];
            $tmp->url = '';

            if (!empty($estimoteDevice->pending_settings->advertisers->eddystone_url)) {
                $this->pendingDevices[$tmp->uniqueId] = clone $tmp;
                $this->pendingDevices[$tmp->uniqueId]->url = $estimoteDevice->pending_settings->advertisers->eddystone_url[0]->url;
            }

            $this->devices[$tmp->uniqueId] = clone $tmp;
            if (!empty($estimoteDevice->settings->advertisers->eddystone_url)) {
                $this->devices[$tmp->uniqueId]->url = $estimoteDevice->settings->advertisers->eddystone_url[0]->url;
            }

        }

        return ($pending) ? $this->pendingDevices : $this->devices;
    }
public function normaliseDevices ( $ pending = false ) { try { $ this -> originalDevices = json_decode ( $ this -> getClient ( ) -> request ( 'GET' , 'devices' ) -> getBody ( ) ) ; } catch ( \ Exception $ e ) { dd ( $ e -> getMessage ( ) ) ; } $ this -> devices = [ ] ; $ this -> pendingDevices = [ ] ; foreach ( $ this -> originalDevices as $ estimoteDevice ) { $ tmp = new \ stdClass ; $ tmp -> id = $ estimoteDevice -> identifier ; $ tmp -> deviceType = $ estimoteDevice -> hardware_type ; $ tmp -> alias = $ estimoteDevice -> shadow -> name ; $ tmp -> uniqueId = $ estimoteDevice -> identifier ; $ tmp -> profiles = [ 'EDDYSTONE' ] ; $ tmp -> url = '' ; if ( ! empty ( $ estimoteDevice -> pending_settings -> advertisers -> eddystone_url ) ) { $ this -> pendingDevices [ $ tmp -> uniqueId ] = clone $ tmp ; $ this -> pendingDevices [ $ tmp -> uniqueId ] -> url = $ estimoteDevice -> pending_settings -> advertisers -> eddystone_url [ 0 ] -> url ; } $ this -> devices [ $ tmp -> uniqueId ] = clone $ tmp ; if ( ! empty ( $ estimoteDevice -> settings -> advertisers -> eddystone_url ) ) { $ this -> devices [ $ tmp -> uniqueId ] -> url = $ estimoteDevice -> settings -> advertisers -> eddystone_url [ 0 ] -> url ; } } return ( $ pending ) ? $ this -> pendingDevices : $ this -> devices ; }
Normalise Estimote return array to match up to expected for BlockBeacon

@param boolean $pending
@return array
Normalise Estimote return array to match up to expected for BlockBeacon