import ctypes


def depth_cb_string_factory(func):
    """Converts the raw depth data into a python string for your function

    Args:
        func: A function that takes (dev, data, timestamp), corresponding to C function
            except that data is a python string corresponding to the data.
    """

    def depth_cb(dev, depth, timestamp):
        nbytes = 614400  # 480 * 640 * 2
        func(dev, ctypes.string_at(depth, nbytes), timestamp)
    return depth_cb