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

Constructor Summary
protected ResponsePacket()
           
protected ResponsePacket(int command, int status, int identifier)
           
 
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.
protected  void linkToPushedNotification(PushNotificationManager notificationManager)
           
protected  void setCommand(int command)
           
protected  void setIdentifier(int identifier)
           
protected  void setStatus(int status)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponsePacket

protected ResponsePacket()

ResponsePacket

protected ResponsePacket(int command,
                         int status,
                         int identifier)
Method Detail

linkToPushedNotification

protected void linkToPushedNotification(PushNotificationManager notificationManager)

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)

setCommand

protected void setCommand(int command)

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

setStatus

protected void setStatus(int status)

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

setIdentifier

protected void setIdentifier(int identifier)

getMessage

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

Returns:
a humand-friendly error message


Copyright © 2013. All Rights Reserved.