NovitecCameraAPIWinPy Reference

NovitecCameraAPIWinPy.CallBackDisconnect

CallBackDisconnect is a ctypes function type for device disconnect event callbacks.

This type defines a callback function that takes a single void pointer argument and returns nothing. It is used to specify the signature of the callback functions that can be registered with the SetDeviceDisconnectEventCallback method.

The callback function should match this type to ensure compatibility with the underlying C library.

Note

The callback function should match this type to ensure compatibility with the underlying C library. Failure to do so may result in undefined behavior or crashes. Always ensure that the callback function signature is compatible with CallBackDisconnect.

class NovitecCameraAPIWinPy.DiscoverDeviceInfo

Bases: Structure

Structure representing discovered device information.

modelName

Model name of the device.

Type:

bytes (32 bytes)

serialNumber

Serial number of the device.

Type:

bytes (16 bytes)

firmwareVersion

Firmware version of the device.

Type:

bytes (32 bytes)

macAddress

MAC address of the device.

Type:

bytes (6 bytes)

ipAddress

IP address of the device.

Type:

bytes (4 bytes)

subnetMask

Subnet mask of the device.

Type:

bytes (4 bytes)

defaultGateway

Default gateway of the device.

Type:

bytes (4 bytes)

isNetworkCompatible

Network compatibility status.

Type:

bool (1 byte)

Example

def print_device_info(info):
    print(f"  Model Name        : {info.modelName.decode().strip()}")
    print(f"  Serial Number     : {info.serialNumber.decode().strip()}")
    print(f"  Firmware Version  : {info.firmwareVersion.decode().strip()}")
    print(f"  MAC Address       : {':'.join(f'{b:02x}' for b in info.macAddress)}")
    print(f"  IP Address        : {'.'.join(str(b) for b in info.ipAddress)}")
    print(f"  Subnet Mask       : {'.'.join(str(b) for b in info.subnetMask)}")
    print(f"  Default Gateway   : {'.'.join(str(b) for b in info.defaultGateway)}")
    is_network_compatible = "Yes" if info.isNetworkCompatible else "No"
    print(f"  Network Compatible: {is_network_compatible}")
class NovitecCameraAPIWinPy.CError

Bases: Structure

Structure representing an error.

Tip

On success, the errCode will be 0.

errCode

Error code.

Type:

int

errMessage

Error message.

Type:

char *

class NovitecCameraAPIWinPy.CImage

Bases: Structure

Structure representing an image.

width

Image width.

Type:

int

height

Image height.

Type:

int

bpp

Bits per pixel.

Type:

int

timestamp

Timestamp of the image.

Type:

unsigned int

frameNum

Frame number.

Type:

unsigned int

payloadType

Payload type.

Type:

int

pixelFormat

Pixel format.

Type:

int

dataSize

Size of the data.

Type:

unsigned int

data

Pointer to the image data.

Type:

POINTER(c_ubyte)

class NovitecCameraAPIWinPy.NovitecCamera

Bases: object

A class for controlling Novitec cameras.

This class provides methods to interact with and control Novitec cameras. Key functionalities include device discovery, connection, control, start and stop operations, and image capture.

connect_by_serial_number(serial_number: str) CError

Connects to a device using its serial number.

Note

The discover() function must be called before.

Parameters:

serial_number (str) – The serial number of the device to connect to.

Returns:

The result of the connection operation.

Return type:

CError

disconnect() CError

Disconnects from the device.

Returns:

The result of the disconnect operation.

Return type:

CError

discover() Tuple[CError, int]

Discovers devices.

Returns:

A tuple containing the result of the discovery operation and the number of devices found.

Return type:

Tuple[CError, int]

execute_feature(feature_name: str) CError

Executes a feature.

Parameters:

feature_name (str) – The name of the feature to execute.

Returns:

The result of the execute operation.

Return type:

CError

get_device_info(device_index: int) Tuple[CError, DiscoverDeviceInfo]

Retrieves device information by index.

Note

The discover() function must be called before.

Parameters:

device_index (int) – The index of the device to retrieve information for.

Returns:

A tuple containing the result of the operation and the device information.

Return type:

Tuple[CError, DiscoverDeviceInfo]

get_feature_min_max_value_float(feature_name: str) Tuple[CError, float, float]

Gets the minimum and maximum values of a float feature.

Parameters:

feature_name (str) – The name of the feature to get the min and max values for.

Returns:

A tuple containing the result of the get operation and the min and max float values.

Return type:

Tuple[CError, float, float]

get_feature_min_max_value_int(feature_name: str) Tuple[CError, int, int]

Gets the minimum and maximum values of an integer feature.

Parameters:

feature_name (str) – The name of the feature to get the min and max values for.

Returns:

A tuple containing the result of the get operation and the min and max integer values.

Return type:

Tuple[CError, int, int]

get_feature_value_enum(feature_name: str) Tuple[CError, str]

Gets an enum feature value.

Parameters:

feature_name (str) – The name of the feature to get.

Returns:

A tuple containing the result of the get operation and the enum value.

Return type:

Tuple[CError, str]

get_feature_value_float(feature_name: str) Tuple[CError, float]

Gets a float feature value.

Parameters:

feature_name (str) – The name of the feature to get.

Returns:

A tuple containing the result of the get operation and the float value.

Return type:

Tuple[CError, float]

get_feature_value_int(feature_name: str) Tuple[CError, int]

Gets an integer feature value.

Parameters:

feature_name (str) – The name of the feature to get.

Returns:

A tuple containing the result of the get operation and the integer value.

Return type:

Tuple[CError, int]

get_feature_value_string(feature_name: str) Tuple[CError, str]

Gets a string feature value.

Parameters:

feature_name (str) – The name of the feature to get.

Returns:

A tuple containing the result of the get operation and the string value.

Return type:

Tuple[CError, str]

get_image() Tuple[CError, CImage]

Get an image from the frame buffer.

Note

The start() function must be called before.

Returns:

A tuple containing the result of the operation and the image.

Return type:

Tuple[CError, CImage]

send_force_ip(device_index: int) CError

Sends a Force IP command.

Sends a command to change the device’s IP information. This feature is used to set a random IP in the same range as the PC’s network IP when the device and PC network IP ranges do not match.

Note

The discover() function must be called before.

Parameters:

device_index (int) – The index of the device to which the command is sent.

Returns:

The result of the connection operation.

Return type:

CError

set_device_disconnect_event_callback(callback_disconnect: ~ctypes.CFUNCTYPE.<locals>.CFunctionType) CError

Sets the callback function for device disconnect events.

This method registers a callback function that will be called whenever the device is disconnected. The callback function must match the signature defined by CallBackDisconnect, which takes a single void pointer argument.

Parameters:

callback_disconnect (CallBackDisconnect) – The callback function to be called when the device disconnects. This function should be defined to match the CallBackDisconnect type signature.

Returns:

The result of the operation, indicating whether the callback was successfully registered. The specific error codes and their meanings should be referred to in the library’s documentation.

Return type:

CError

Example

def disconnect_callback(param: ctypes.c_void_p):
    print("Device disconnected:", param)

result = novitec_camera.set_device_disconnect_event_callback(CallBackDisconnect(disconnect_callback))
if result == CError.SUCCESS:
    print("Callback set successfully")
else:
    print("Failed to set callback, error code:", result)

Notes

The callback function should match this type to ensure compatibility with the underlying C library. Failure to do so may result in undefined behavior or crashes. Always ensure that the callback function signature is compatible with CallBackDisconnect.

set_feature_value_enum(feature_name: str, value: str) CError

Sets an enum feature value.

Parameters:
  • feature_name (str) – The name of the feature to set.

  • value (str) – The enum value to set.

Returns:

The result of the set operation.

Return type:

CError

set_feature_value_float(feature_name: str, value: float) CError

Sets a float feature value.

Parameters:
  • feature_name (str) – The name of the feature to set.

  • value (float) – The float value to set.

Returns:

The result of the set operation.

Return type:

CError

set_feature_value_int(feature_name: str, value: int) CError

Sets an integer feature value.

Parameters:
  • feature_name (str) – The name of the feature to set.

  • value (int) – The integer value to set.

Returns:

The result of the set operation.

Return type:

CError

set_feature_value_string(feature_name: str, value: str) CError

Sets a string feature value.

Parameters:
  • feature_name (str) – The name of the feature to set.

  • value (str) – The string value to set.

Returns:

The result of the set operation.

Return type:

CError

start() CError

Start grabbing images from a camera.

Returns:

The result of the start operation.

Return type:

CError

stop() CError

Stop grabbing images from a camera.

Returns:

The result of the stop operation.

Return type:

CError

write_memory(address: int, data, length: int) CError

Write memory to device.

Parameters:
  • address (int) – The address to write to.

  • data (int, float, str, or bytes) – The data to write.

  • length (int) – The length of the data to write.

Returns:

The result of the write operation.

Return type:

CError