Get Version¶
This example demonstrates how to retrieve the version of the API and the connected device controller's firmware. It also serves as a check that the device controller is connected and can be controlled by the API.
Overview¶
The API exposes dedicated methods to query version information:
| Method | Description |
|---|---|
getVersion() |
Returns the version string of the API |
getFirmwareVersion() |
Returns the firmware version string of the connected Inscoper device controller |
If the bridge is not connected to a physical device controller (for instance, if running in a virtual or simulation environment), querying the firmware version may raise an exception. The script handles this scenario gracefully using a try-except block.
Get Version¶
import os
import inscoper_api
my_bridge = inscoper_api.Bridge()
my_bridge.initLogger(inscoper_api.ELogMode_FILE, inscoper_api.ELogLevel_LOG_ALL, filename="api.log")
api_version = my_bridge.getVersion()
try:
firmware_version = my_bridge.getFirmwareVersion()
except Exception as e:
firmware_version = "N/A"
print("Exception: ", e)
print("API Version: ", api_version)
print("Firmware Version: ", firmware_version)
my_bridge.close()