Class ServiceResult

java.lang.Object
com.dsi.ant.channel.ipc.ServiceResult
All Implemented Interfaces:
android.os.Parcelable

public class ServiceResult extends Object implements android.os.Parcelable
Used to send either success or (if a failure) the parcelable components of an AntCommandFailedException over IPC.
Since:
4.0
  • Field Details

    • SUCCESS_RESULT

      public static final ServiceResult SUCCESS_RESULT
      Used so a new success result object never need to be allocated
      Since:
      4.0
    • NO_CHANNEL_RESULT

      public static final ServiceResult NO_CHANNEL_RESULT
      Used so a new no channel exists result object never need to be allocated
      Since:
      4.1
    • INVALID_REQUEST_RESULT

      public static final ServiceResult INVALID_REQUEST_RESULT
      Used so a new invalid request result object never need to be allocated
      Since:
      4.1
    • CREATOR

      public static final android.os.Parcelable.Creator<ServiceResult> CREATOR
      For Parcelable
      Since:
      4.0
  • Constructor Details

    • ServiceResult

      public ServiceResult(AntCommandFailureReason failureReason)
      Constructs a ServiceResult with a AntCommandFailureReason.
      Parameters:
      failureReason - The failure reason for the ServiceResult.
      Since:
      4.0
    • ServiceResult

      public ServiceResult(ChannelResponseMessage responseMessage)
      Constructs a ServiceResult with a ChannelResponseMessage
      Parameters:
      responseMessage - The response message to create the result from.
      Since:
      4.0
    • ServiceResult

      public ServiceResult(AntCommandFailedException exception)
      Constructs a ServiceResult from an AntCommandFailedException
      Parameters:
      exception - The exception to create the result from.
      Since:
      4.0
    • ServiceResult

      public ServiceResult(android.os.Parcel source)
      Constructs a ServiceResult from a parcel.
      Parameters:
      source - The parcel that contains a ServiceResult.
      Since:
      4.0
  • Method Details

    • readFrom

      public static ServiceResult readFrom(android.os.Bundle error)
      Extracts a ServiceError from the bundle, or null
      Since:
      4.0
    • writeTo

      public void writeTo(android.os.Bundle error)
      Places this ServiceError in the bundle
      Since:
      4.0
    • isSuccess

      public boolean isSuccess()
      Does this result indicate success. If this is true, then none of the other details will be set.
      Returns:
      True if this result is successful.
      Since:
      4.0
    • channelExists

      public boolean channelExists()
      Does the channel exist.
      Returns:
      True if channel exists, false otherwise.
      Since:
      4.1
    • getDetailMessage

      public String getDetailMessage()
      A description of the result.
      Returns:
      The message to use when creating an exception.
      Since:
      4.0
    • getFailureReason

      public AntCommandFailureReason getFailureReason()
      What was the result.
      Returns:
      The reason type sent by the ANT Radio Service.
      Since:
      4.0
    • getAntMessage

      public AntMessageParcel getAntMessage()
      If required, the ANT Message that triggered this result.
      Returns:
      A raw ANT message.
      Since:
      4.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Since:
      4.0
    • describeContents

      public int describeContents()
      Specified by:
      describeContents in interface android.os.Parcelable
    • writeToParcel

      public void writeToParcel(android.os.Parcel dest, int flags)
      Specified by:
      writeToParcel in interface android.os.Parcelable
    • readFromParcel

      public void readFromParcel(android.os.Parcel source)
      Set values to those in the provided Parcel
      Parameters:
      source - Parceled version of an ServiceResultParcel.
      Since:
      4.0