This package contains the public API of the library.
public interface IClaySDK
An interface defining the behavior of the library.
Modifier and Type | Method and Description |
java.lang.String | getPublicKey()Returns the BASE64 encoding of the PublicKey generated in the initialization step of the SDK |
void | openDoor(java.lang.String mkey, boolean encrypted, ILockDiscoveryCallback callback)Sends a command to open a door using the provided mkey |
java.lang.String getPublicKey() throws ClayException
Returns the BASE64 encoding of the PublicKey generated in the initialization step of the SDK.
BASE64 string encoding of the PublicKey
ClayException - An exception when the getPublicKey operation fails.
void openDoor(java.lang.String mkey, ILockDiscoveryCallback callback) throws ClayException
Sends a command to open a door using the provided mkey
mkey | The MKEY which should be used to open a door |
callback | A callback to notify the client about the result of the operation |
ClayException - Exception thrown when the operation fails.
public interface ILockDiscoveryCallback
Modifier and Type | Method and Description |
void | onFailure(ClayException exception)Callback method when the operation has failed |
void | onPeripheralFound()Callback method called when a BLE peripheral is found |
void | onSuccess()Callback method when the operation has succeeded |
void onPeripheralFound()
Callback method called when a BLE peripheral is found
void onSuccess()
Callback method when the opening operation has succeeded
void onFailure(ClayException exception)
Callback method when the opening operation has succeeded
exception | The ClayException caught and returned for processing |
public final class ClaySDK extends java.lang.Object
The point of entry in the library. Use this class to obtain an instance of IClaySDK and use it from that point onward to interact with the ClaySDK.
CONSTRUCTOR AND DESCRIPTION |
ClaySDK() |
Modifier and Type | Method and Description |
static IClaySDK | init(android.content.Context context)Static initializer of the library. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public ClaySDK()
public static IClaySDK init(android.content.Context context)
Static initializer of the library. It creates an IClaySDK instance with which the client consuming the library should interact from that point onwards
context | The Context in which the library is being used |
An instance of IClaySDK providing the behavior to interact with the library
java.lang.Object java.lang.Enum<ClayErrorCode> com.myclay.claysdk.api.error.ClayErrorCode
java.io.Serializable, java.lang.Comparable<ClayErrorCode>
Constant | Description |
DECRYPT_FAILED_ERROR | Decryption of the mkey did not succeed |
GENERIC_ERROR | Generic error |
INVALID_BASE64_MKEY | The BASE64 encoding of the mkey is invalid |
INVALID_MKEY_ERROR | The supplied mkey has an invalid format |
INVALID_PRIVATE_KEY_ERROR | The private key used to decrypt an encrypted mkey is invalid |
PRIVATE_KEY_IS_EMPTY_ERROR | The private key used for decryption is empty |
PRIVATE_KEY_IS_NULL_ERROR | The private key used for decryption is null |
Modifier and Type | Method and Description |
int | getValue() |
static ClayErrorCode | valueOf(java.lang.String name)Returns the enum constant of this type with the specified name. |
static ClayErrorCode[] | values()Returns an array containing the constants of this enum type, in the order they are declared. |
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
getClass, notify, notifyAll, wait, wait, wait
public static ClayErrorCode[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ClayErrorCode c : ClayErrorCode.values()) System.out.println(c);
An array containing the constants of this enum type, in the order they are declared
public static ClayErrorCode valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
name | the name of the enum constant to be returned |
the enum constant with the specified name
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name java.lang.NullPointerException - if the argument is null
public int getValue()
java.lang.Object java.lang.Throwable java.lang.Exception com.myclay.claysdk.api.error.ClayException
java.io.Serializable
CONSTRUCTOR AND DESCRIPTION |
ClayException(ClayErrorCode errorCode)Creates a new ClayException using the error code supplied as a parameter. |
ClayException(com.saltosystems.justinmobile.sdk.exceptions.SaltoException exception)Creates a new ClayException based on a SaltoException |
Modifier and Type | Method and Description |
int | getErrorCode()Getter for the errorCode property |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public ClayException(ClayErrorCode errorCode)
Creates a new ClayException using the error code supplied as a parameter. The message is inferred internally
errorCode | The error code of the exception |
public ClayException(com.saltosystems.justinmobile.sdk.exceptions.SaltoException exception)
Creates a new ClayException based on a SaltoException
exception | The SaltoException used to construct this ClayException |
public int getErrorCode()
Getter for the errorCode property
The error code of the exception.