nest.class.php
protected function getDefaultSerial($serial_number) {
        if (empty($serial_number)) {
            $devices_serials = $this->getDevices();
            if (count($devices_serials) == 0) {
                $devices_serials = $this->getDevices(DEVICE_TYPE_PROTECT);
            }
            $serial_number = $devices_serials[0];
        }
        return $serial_number;
    }
protected function getDefaultSerial($serial_number) {
        if (empty($serial_number)) {
            $devices_serials = $this->getDevices();
            if (count($devices_serials) == 0) {
                $devices_serials = $this->getDevices(DEVICE_TYPE_PROTECT);
            }
            $serial_number = $devices_serials[0];
        }
        return $serial_number;
    }
Either return the parameter as-is, or, if empty, return the serial number of the first device found in the user's account.

@param string $serial_number Serial number will be returned, if specified.

@return string Serial number of the first defined device.