diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClient.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClient.java index db09553..ca0ef52 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClient.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClient.java @@ -293,6 +293,31 @@ public static int GetHostLicenseExpiryDate() throws LexFloatClientException { } } + /** + * Gets the mode of the floating license (online or offline). + * + * @return mode - Returns the floating license mode. + * @throws LexFloatClientException + * @throws UnsupportedEncodingException + */ + public static String GetFloatingLicenseMode() throws LexFloatClientException, UnsupportedEncodingException { + int status; + if (Platform.isWindows()) { + CharBuffer buffer = CharBuffer.allocate(256); + status = LexFloatClientNative.GetFloatingLicenseMode(buffer, 256); + if (LF_OK == status) { + return buffer.toString().trim(); + } + } else { + ByteBuffer buffer = ByteBuffer.allocate(256); + status = LexFloatClientNative.GetFloatingLicenseMode(buffer, 256); + if (LF_OK == status) { + return new String(buffer.array(), "UTF-8").trim(); + } + } + throw new LexFloatClientException(status); + } + /** * Gets the meter attribute uses consumed by the floating client. * diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientNative.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientNative.java index 90cd0e3..3f82ad8 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientNative.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientNative.java @@ -60,6 +60,10 @@ public interface CallbackType extends Callback { public static native int GetHostLicenseMeterAttribute(WString name, IntByReference allowedUses, IntByReference totalUses, IntByReference grossUses); public static native int GetHostLicenseExpiryDate(IntByReference expiryDate); + + public static native int GetFloatingLicenseMode(ByteBuffer mode, int length); + + public static native int GetFloatingLicenseMode(CharBuffer mode, int length); public static native int GetFloatingClientMeterAttributeUses(String name, IntByReference uses);