Back to index

d-push  2.0
Public Member Functions
WebserviceDevice Class Reference

List of all members.

Public Member Functions

 ListDevicesDetails ()
 Returns a list of all known devices of the Request::GetGETUser()
 RemoveDevice ($deviceId)
 Remove all state data for a device of the Request::GetGETUser()
 WipeDevice ($deviceId)
 Marks a device of the Request::GetGETUser() to be remotely wiped.
 ResyncDevice ($deviceId)
 Marks a a device of the Request::GetGETUser() for resynchronization.

Detailed Description

Definition at line 47 of file webservicedevice.php.


Member Function Documentation

Returns a list of all known devices of the Request::GetGETUser()

public

Returns:
array

Definition at line 55 of file webservicedevice.php.

                                         {
        $user = Request::GetGETUser();
        $devices = ZPushAdmin::ListDevices($user);
        $output = array();

        ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceDevice::ListDevicesDetails(): found %d devices of user '%s'", count($devices), $user));
        ZPush::GetTopCollector()->AnnounceInformation(sprintf("Retrieved details of %d devices", count($devices)), true);

        foreach ($devices as $devid)
            $output[] = ZPushAdmin::GetDeviceDetails($devid, $user);

        return $output;
    }

Here is the call graph for this function:

Remove all state data for a device of the Request::GetGETUser()

Parameters:
string$deviceIdthe device id

public

Returns:
boolean
Exceptions:
SoapFault

Definition at line 78 of file webservicedevice.php.

                                            {
        $deviceId = preg_replace("/[^A-Za-z0-9]/", "", $deviceId);
        ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceDevice::RemoveDevice('%s'): remove device state data of user '%s'", $deviceId, Request::GetGETUser()));

        if (! ZPushAdmin::RemoveDevice(Request::GetGETUser(), $deviceId)) {
            ZPush::GetTopCollector()->AnnounceInformation(ZLog::GetLastMessage(LOGLEVEL_ERROR), true);
            throw new SoapFault("ERROR", ZLog::GetLastMessage(LOGLEVEL_ERROR));
        }

        ZPush::GetTopCollector()->AnnounceInformation(sprintf("Removed device id '%s'", $deviceId), true);
        return true;
    }

Here is the call graph for this function:

Marks a a device of the Request::GetGETUser() for resynchronization.

Parameters:
string$deviceIdthe device id

public

Returns:
boolean
Exceptions:
SoapFault

Definition at line 122 of file webservicedevice.php.

                                            {
        $deviceId = preg_replace("/[^A-Za-z0-9]/", "", $deviceId);
        ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceDevice::ResyncDevice('%s'): mark device of user '%s' for resynchronization", $deviceId, Request::GetGETUser()));

        if (! ZPushAdmin::ResyncDevice(Request::GetGETUser(), $deviceId)) {
            ZPush::GetTopCollector()->AnnounceInformation(ZLog::GetLastMessage(LOGLEVEL_ERROR), true);
            throw new SoapFault("ERROR", ZLog::GetLastMessage(LOGLEVEL_ERROR));
        }

        ZPush::GetTopCollector()->AnnounceInformation(sprintf("Resync requested - device id '%s'", $deviceId), true);
        return true;
    }

Here is the call graph for this function:

Marks a device of the Request::GetGETUser() to be remotely wiped.

Parameters:
string$deviceIdthe device id

public

Returns:
boolean
Exceptions:
SoapFault

Definition at line 100 of file webservicedevice.php.

                                          {
        $deviceId = preg_replace("/[^A-Za-z0-9]/", "", $deviceId);
        ZLog::Write(LOGLEVEL_INFO, sprintf("WebserviceDevice::WipeDevice('%s'): mark device of user '%s' for remote wipe", $deviceId, Request::GetGETUser()));

        if (! ZPushAdmin::WipeDevice(Request::GetAuthUser(), Request::GetGETUser(), $deviceId)) {
            ZPush::GetTopCollector()->AnnounceInformation(ZLog::GetLastMessage(LOGLEVEL_ERROR), true);
            throw new SoapFault("ERROR", ZLog::GetLastMessage(LOGLEVEL_ERROR));
        }

        ZPush::GetTopCollector()->AnnounceInformation(sprintf("Wipe requested - device id '%s'", $deviceId), true);
        return true;
    }

Here is the call graph for this function:


The documentation for this class was generated from the following file: