Package com.dsi.ant.channel.ipc
Class ServiceResult
java.lang.Object
com.dsi.ant.channel.ipc.ServiceResult
- All Implemented Interfaces:
android.os.Parcelable
Used to send either success or (if a failure) the parcelable components of an
AntCommandFailedException over IPC.- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface android.os.Parcelable
android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final android.os.Parcelable.Creator<ServiceResult>For Parcelablestatic final ServiceResultUsed so a new invalid request result object never need to be allocatedstatic final ServiceResultUsed so a new no channel exists result object never need to be allocatedstatic final ServiceResultUsed so a new success result object never need to be allocatedFields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionServiceResult(android.os.Parcel source) Constructs a ServiceResult from a parcel.ServiceResult(AntCommandFailedException exception) Constructs a ServiceResult from anAntCommandFailedExceptionServiceResult(AntCommandFailureReason failureReason) Constructs a ServiceResult with aAntCommandFailureReason.ServiceResult(ChannelResponseMessage responseMessage) Constructs a ServiceResult with aChannelResponseMessage -
Method Summary
Modifier and TypeMethodDescriptionbooleanDoes the channel exist.intIf required, the ANT Message that triggered this result.A description of the result.What was the result.booleanDoes this result indicate success.static ServiceResultreadFrom(android.os.Bundle error) Extracts a ServiceError from the bundle, or nullvoidreadFromParcel(android.os.Parcel source) Set values to those in the provided ParceltoString()voidwriteTo(android.os.Bundle error) Places this ServiceError in the bundlevoidwriteToParcel(android.os.Parcel dest, int flags)
-
Field Details
-
SUCCESS_RESULT
Used so a new success result object never need to be allocated- Since:
- 4.0
-
NO_CHANNEL_RESULT
Used so a new no channel exists result object never need to be allocated- Since:
- 4.1
-
INVALID_REQUEST_RESULT
Used so a new invalid request result object never need to be allocated- Since:
- 4.1
-
CREATOR
For Parcelable- Since:
- 4.0
-
-
Constructor Details
-
ServiceResult
Constructs a ServiceResult with aAntCommandFailureReason.- Parameters:
failureReason- The failure reason for the ServiceResult.- Since:
- 4.0
-
ServiceResult
Constructs a ServiceResult with aChannelResponseMessage- Parameters:
responseMessage- The response message to create the result from.- Since:
- 4.0
-
ServiceResult
Constructs a ServiceResult from anAntCommandFailedException- 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
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
A description of the result.- Returns:
- The message to use when creating an exception.
- Since:
- 4.0
-
getFailureReason
What was the result.- Returns:
- The reason type sent by the ANT Radio Service.
- Since:
- 4.0
-
getAntMessage
If required, the ANT Message that triggered this result.- Returns:
- A raw ANT message.
- Since:
- 4.0
-
toString
-
describeContents
public int describeContents()- Specified by:
describeContentsin interfaceandroid.os.Parcelable
-
writeToParcel
public void writeToParcel(android.os.Parcel dest, int flags) - Specified by:
writeToParcelin interfaceandroid.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
-