Android reference

package

com.myclay.claysdk.api

This package contains the public API of the library.

interface

IClaySDK

public interface IClaySDK

An interface defining the behavior of the library.

METHOD SUMMARY
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
METHOD DETAIL
getPublicKey()

java.lang.String getPublicKey()
                    throws ClayException

Returns the BASE64 encoding of the PublicKey generated in the initialization step of the SDK.

returns

BASE64 string encoding of the PublicKey

THROWS

ClayException – An exception when the getPublicKey operation fails.

openDoor()

void openDoor(java.lang.String mkey,
              ILockDiscoveryCallback callback)
         throws ClayException

Sends a command to open a door using the provided mkey

Parameters
mkey The MKEY which should be used to open a door
callback A callback to notify the client about the result of the operation
THROWS

ClayException – Exception thrown when the operation fails.

interface

ILockDiscoveryCallback

public interface ILockDiscoveryCallback

METHOD SUMMARY
Modifier and Type Method and Description
void onFailure(ClayException exception)
Callback method when the opening operation has failed
void onPeripheralFound()
Callback method called when a BLE peripheral is found
void onSuccess()
Callback method when the opening operation has succeeded
METHOD DETAIL
onPeripheralFound()

void onPeripheralFound()

Callback method called when a BLE peripheral is found

onSuccess()

void onSuccess()

Callback method when the opening operation has succeeded

onFailure()

void onFailure(ClayException exception)

Callback method when the opening operation has succeeded

Parameters
exception The ClayException caught and returned for processing
class

ClaySDK

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 SUMMARY
CONSTRUCTOR AND DESCRIPTION
ClaySDK()
METHOD SUMMARY
Modifier and Type Method and Description
static IClaySDK init(android.content.Context context)
Static initializer of the library.
Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

CONSTRUCTOR DETAIL

public ClaySDK()

METHOD DETAIL
init()

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

Parameters
context The Context in which the library is being used
Returns

An instance of IClaySDK providing the behavior to interact with the library

package

com.myclay.claysdk.api.error

Enum

ClayErrorCode

java.lang.Object
     java.lang.Enum<ClayErrorCode>
              com.myclay.claysdk.api.error.ClayErrorCode

All Implemented Interfaces:

java.io.Serializable, java.lang.Comparable<ClayErrorCode>

Enum Constant Summary
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
METHOD SUMMARY
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.
Methods inherited from class java.lang.Enum

clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

METHOD DETAIL
values()

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);

returns

An array containing the constants of this enum type, in the order they are declared

valueOf()

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.)

Parameters
name the name of the enum constant to be returned
returns

the enum constant with the specified name

THROWS

java.lang.IllegalArgumentException – if this enum type has no constant with the specified name
java.lang.NullPointerException – if the argument is null

getValue()

public int getValue()

Exception

ClayException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.myclay.claysdk.api.error.ClayException

All Implemented Interfaces:

java.io.Serializable

CONSTRUCTOR SUMMARY
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
METHOD SUMMARY
Modifier and Type Method and Description
int getErrorCode()
Getter for the errorCode property
Methods inherited from class java.lang.Throwable

addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

CONSTRUCTOR DETAIL
ClayErrorCode()

public ClayException(ClayErrorCode errorCode)

Creates a new ClayException using the error code supplied as a parameter. The message is inferred internally

Parameters
errorCode The error code of the exception
ClayException()

public ClayException(com.saltosystems.justinmobile.sdk.exceptions.SaltoException exception)

Creates a new ClayException based on a SaltoException

Parameters
exception The SaltoException used to construct this ClayException
METHOD DETAIL
getErrorCode()

public int getErrorCode()

Getter for the errorCode property

Returns

The error code of the exception.