def close(self):
        """
        Closes the connection to the NDI Tracker and
        deletes the tracker device.

        :raises Exception: ValueError
        """
        if not self._device:
            raise ValueError('close called with no NDI device')

        if self._state == "tracking":
            self.stop_tracking()

        if self._tracker_type == "vega":
            ndicapy.ndiCloseNetwork(self._device)

        if self._tracker_type in ("aurora", "polaris"):
            ndicapy.ndiClose(self._device)

        self._device = None
        self._state = None
 def _check_for_errors(self, message):
     errnum = ndicapy.ndiGetError(self._device)
     if errnum != ndicapy.NDI_OKAY:
         ndicapy.ndiClose(self._device)
         raise IOError('error when {}. the error was: {}'.format(
             message, ndicapy.ndiErrorString(errnum)))
Пример #3
0
            break
    if result != NDI_OKAY:
        raise IOError(
            'Could not find any NDI device in '
            '{} serial port candidates checked. '
            'Please check the following:\n'
            '\t1) Is an NDI device connected to your computer?\n'
            '\t2) Is the NDI device switched on?\n'
            '\t3) Do you have sufficient privilege to connect to '
            'the device? (e.g. on Linux are you part of the "dialout" '
            'group?)'.format(MAX_SERIAL_PORTS))

    device = ndiOpen(name)
    if not device:
        raise IOError('Could not connect to NDI device found on '
                      '{}'.format(name))

    reply = ndiCommand(device, 'INIT:')
    error = ndiGetError(device)
    if reply.startswith('ERROR') or error != NDI_OKAY:
        raise IOError('Error when sending command: '
                      '{}'.format(ndiErrorString(error)))

    reply = ndiCommand(
        device, 'COMM:{:d}{:03d}{:d}'.format(NDI_115200, NDI_8N1,
                                             NDI_NOHANDSHAKE))

    # Add your own commands here!!!

    ndiClose(device)