Skip to content

Commit 6999c07

Browse files
committed
feat: add function get-floating-license-mode
1 parent 6f28501 commit 6999c07

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

cryptlex/lexfloatclient/lexfloatclient.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def SetFloatingClientMetadata(key, value):
103103

104104
@staticmethod
105105
def GetFloatingClientLibraryVersion():
106-
"""Gets the floating client library version.
106+
"""Gets the mode of the floating license (online or offline).
107107
108108
Raises:
109109
LexFloatClientException
@@ -266,6 +266,23 @@ def GetFloatingClientMeterAttributeUses(name):
266266
return uses.value
267267
else:
268268
raise LexFloatClientException(status)
269+
270+
@staticmethod
271+
def GetFloatingLicenseMode():
272+
"""Gets the mode of the floating license (online or offline).
273+
274+
Raises:
275+
LexActivatorException
276+
277+
Returns:
278+
ActivationMode: mode of floating license.
279+
"""
280+
buffer_size = 256
281+
buffer = LexFloatClientNative.get_ctype_string_buffer(buffer_size)
282+
status = LexFloatClientNative.GetFloatingLicenseMode(buffer,buffer_size)
283+
if status != LexFloatStatusCodes.LF_OK:
284+
raise LexFloatClientException(status)
285+
return LexFloatClientNative.byte_to_string(buffer.value)
269286

270287
@staticmethod
271288
def RequestFloatingLicense():

cryptlex/lexfloatclient/lexfloatclient_native.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ def byte_to_string(input):
139139
GetHostProductVersionDisplayName.argtypes = [STRTYPE, c_uint32]
140140
GetHostProductVersionDisplayName.restype = c_int
141141

142+
GetFloatingLicenseMode = library.GetFloatingLicenseMode
143+
GetFloatingLicenseMode.argtypes = [STRTYPE, c_uint32]
144+
GetFloatingLicenseMode.restype = c_int
145+
142146
GetHostProductVersionFeatureFlag = library.GetHostProductVersionFeatureFlag
143147
GetHostProductVersionFeatureFlag.argtypes = [CSTRTYPE, POINTER(c_uint32), STRTYPE, c_uint32]
144148
GetHostProductVersionFeatureFlag.restype = c_int

0 commit comments

Comments
 (0)