Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add GetFloatingLicenseMode() method to LexFloatClient #19

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/main/java/com/cryptlex/lexfloatclient/LexFloatClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down