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

fix: add missing function #22

Merged
merged 1 commit into from
Aug 7, 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
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public static void SetHostProductId(String productId) throws LexFloatClientExcep
*/
public static void SetPermissionFlag(int flags) throws LexFloatClientException {
int status;
status = LexFloatClientNative.SetProductId(flags);
if (LA_OK != status) {
status = LexFloatClientNative.SetPermissionFlag(flags);
if (LF_OK != status) {
throw new LexFloatClientException(status);
}
}
Expand Down Expand Up @@ -319,6 +319,25 @@ public static int GetHostLicenseExpiryDate() throws LexFloatClientException {
throw new LexFloatClientException(status);
}
}

/**
* 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;

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 value of the floating client metadata.
*
Expand Down Expand Up @@ -371,6 +390,7 @@ public static void RequestFloatingLicense() throws LexFloatClientException {
}
/**
* Sends the request to lease the license from the LexFloatServer for offline usage.
* The maximum value of lease duration is configured in the config.yml of LexFloatServer.
*
* @param leaseDuration
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ public static String getErrorMessage(int errorCode) {

/*
* CODE: LF_E_SYSTEM_PERMISSION
*
* MESSAGE: Insufficient system permissions.
*/
public static final int LF_E_SYSTEM_PERMISSION = 59;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public interface CallbackType extends Callback {

public static native int SetHostProductId(String productId);

public static native int GetHostConfigInternal(ByteBuffer hostconfig, int length);

public static native int SetHostUrl(String hostUrl);

public static native int SetFloatingLicenseCallback(CallbackType callback);
Expand All @@ -38,6 +36,8 @@ public interface CallbackType extends Callback {

public static native int GetFloatingClientLibraryVersion(ByteBuffer libraryVersion, int length);

public static native int GetHostConfigInternal(ByteBuffer hostconfig, int length);

public static native int GetHostProductVersionName(ByteBuffer name, int length);

public static native int GetHostProductVersionDisplayName(ByteBuffer name, int length);
Expand All @@ -51,6 +51,8 @@ public interface CallbackType extends Callback {
public static native int GetHostLicenseExpiryDate(IntByReference expiryDate);

public static native int GetFloatingClientMetadata(String key, ByteBuffer value, int length);

public static native int GetFloatingLicenseMode(ByteBuffer mode, int length);

public static native int GetFloatingClientMeterAttributeUses(String name, IntByReference uses);

Expand Down
Loading