Utils¶
Bases: object
Utils class provides utility functions.
This class contains helper functions for converting between enum types and their string representations, as well as data conversion utilities.
deviceTypeToString(deviceType)
staticmethod
¶
Convert EDeviceType enum to string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deviceType
|
int
|
The device type to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The corresponding string value. "" if unknown device type |
stringToDeviceType(deviceTypeStr)
staticmethod
¶
Convert string to EDeviceType.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
deviceTypeStr
|
string
|
The device type string to convert |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding type. GENERIC if unknown device type |
driverTypeToString(driverType)
staticmethod
¶
Convert EDriverType enum to string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
driverType
|
int
|
The driver type to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The corresponding string value. "" if unknown driver type |
stringToDriverType(driverTypeStr)
staticmethod
¶
Convert string to EDriverType.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
driverTypeStr
|
string
|
The driver type string to convert |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding type. INSCOPER_BOX if unknown driver type |
functionTypeToString(functionType)
staticmethod
¶
Convert EFunctionType enum to string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
functionType
|
int
|
The function type to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The corresponding string value. "" if unknown function type |
stringToFunctionType(functionTypeStr)
staticmethod
¶
Convert string to EFunctionType.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
functionTypeStr
|
string
|
The function type string to convert |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding type. SET if unknown function type |
paramTypeToString(paramType)
staticmethod
¶
Convert EParamType enum to string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paramType
|
int
|
The parameter type to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The corresponding string value. "" if unknown parameter type |
stringToParamType(paramTypeStr)
staticmethod
¶
Convert string to EParamType.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paramTypeStr
|
string
|
The parameter type string to convert |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding type. UINT8 if unknown parameter type |
subDeviceTypeToString(type)
staticmethod
¶
Convert ESubDeviceType enum to string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
int
|
The sub-device type to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The corresponding string value. "" if unknown sub-device type |
stringToSubDeviceType(typeStr)
staticmethod
¶
Convert string to ESubDeviceType.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
typeStr
|
string
|
The sub-device type string to convert |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding type. NONE if unknown sub-device type |
subDeviceStatusToString(status)
staticmethod
¶
Convert ESubDeviceStatus enum to string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
int
|
The sub-device status to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The corresponding string value. "UNKNOWN" if unknown sub-device status |
stringToSubDeviceStatus(statusStr)
staticmethod
¶
Convert string to ESubDeviceStatus..
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
statusStr
|
string
|
The sub-device status string to convert |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding status. UNKNOWN if unknown sub-device status |
functionStatusToString(status)
staticmethod
¶
Convert EFunctionStatus enum to string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
EFunctionStatus
|
The funciton status to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The corresponding string value. "UNKNOWN" if unknown function status |
stringToFunctionStatus(statusStr)
staticmethod
¶
Convert string to EFunctionStatus.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
statusStr
|
string
|
The function status string to convert |
required |
Returns:
| Type | Description |
|---|---|
EFunctionStatus
|
The corresponding status. UNKNOWN if unknown function status |
connectionTypeDescToString(connectionTypeDesc)
staticmethod
¶
Convert EConnectionTypeDesc enum to string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
connectionTypeDesc
|
int
|
The connection type to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The corresponding string value. "" if unknown connection type |
stringToConnectionTypeDesc(connectionTypeDescStr)
staticmethod
¶
Convert string to EConnectionTypeDesc.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
connectionTypeDescStr
|
string
|
The connection type string to convert |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding type. NONE if unknown connection type |
logLevelToString(logLevel)
staticmethod
¶
Convert ELogLevel enum to string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logLevel
|
int
|
The log level to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The corresponding string value |
stringToLogLevel(logLevelStr)
staticmethod
¶
Convert string to ELogLevel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
logLevelStr
|
string
|
The log level string to convert |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding log level |
dataToString(data)
staticmethod
¶
Convert data bytes to string.
Converts a vector of bytes into a string representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
list[int]
|
The vector of bytes to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The resulting string |
dataToInt(data)
staticmethod
¶
Convert data bytes to integer.
Converts a vector of bytes into an integer value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
list[int]
|
The vector of bytes to convert |
required |
Returns:
| Type | Description |
|---|---|
int
|
The resulting integer |
dataToDouble(data)
staticmethod
¶
Convert data bytes to double.
Converts a vector of bytes into a double value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
list[int]
|
The vector of bytes to convert |
required |
Returns:
| Type | Description |
|---|---|
float
|
The resulting double |
boxTypeToString(type)
staticmethod
¶
Convert EBoxType enum to string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
int
|
The device controller type to convert |
required |
Returns:
| Type | Description |
|---|---|
str
|
The corresponding string value. "UNKNOWN" if unknown device controller type |
stringToBoxType(boxTypeStr)
staticmethod
¶
Convert string to EBoxType.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
boxTypeStr
|
string
|
The device controller type string to convert |
required |
Returns:
| Type | Description |
|---|---|
int
|
The corresponding type. UNKNOWN if unknown device controller type |