javapns.notification
Class ResponsePacket

java.lang.Object
  extended by javapns.notification.ResponsePacket

public class ResponsePacket
extends Object

A response packet, as described in Apple's enhanced notification format.

Author:
Sylvain Pedneault

Method Summary
 int getCommand()
          Returns the response's command number.
 int getIdentifier()
          Returns the response's identifier, which matches the pushed notification's.
 String getMessage()
          Returns a humand-friendly error message, as documented by Apple.
 int getStatus()
          Returns the response's status code (see getMessage() for a human-friendly status message instead).
 boolean isErrorResponsePacket()
          Determine if this packet is an error-response packet.
 boolean isValidErrorMessage()
          Determine if this packet is a valid error-response packet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCommand

public int getCommand()
Returns the response's command number. It should be 8 for all error responses.

Returns:
the response's command number (which should be 8)

isErrorResponsePacket

public boolean isErrorResponsePacket()
Determine if this packet is an error-response packet.

Returns:
true if command number is 8, false otherwise

getStatus

public int getStatus()
Returns the response's status code (see getMessage() for a human-friendly status message instead).

Returns:
the response's status code

isValidErrorMessage

public boolean isValidErrorMessage()
Determine if this packet is a valid error-response packet. To be valid, it must be an error-response packet (command number 8) and it must have a non-zero status code.

Returns:
true if command number is 8 and status code is not 0, false otherwise

getIdentifier

public int getIdentifier()
Returns the response's identifier, which matches the pushed notification's.

Returns:
the response's identifier

getMessage

public String getMessage()
Returns a humand-friendly error message, as documented by Apple.

Returns:
a humand-friendly error message