Ejemplo n.º 1
0
 def __init__(self, interface, database_name, cluster_name, signals):
     "http://zone.ni.com/reference/en-XX/help/372841N-01/nixnet/nxcreatesession/"
     flattened_list = _utils.flatten_items(signals)
     SessionBase.__init__(
         self, database_name, cluster_name, flattened_list, interface,
         constants.CreateSessionMode.SIGNAL_OUT_SINGLE_POINT)
     self._signals = session_signals.SinglePointOutSignals(self._handle)
Ejemplo n.º 2
0
 def __init__(self, interface, database_name=':memory:', cluster_name=''):
     "http://zone.ni.com/reference/en-XX/help/372841N-01/nixnet/nxcreatesession/"
     flattened_list = _utils.flatten_items(None)
     SessionBase.__init__(self, database_name, cluster_name, flattened_list,
                          interface,
                          constants.CreateSessionMode.FRAME_OUT_STREAM)
     self._frames = session_frames.OutFrames(self._handle)
Ejemplo n.º 3
0
 def __init__(self, interface, database_name, cluster_name, frames):
     "http://zone.ni.com/reference/en-XX/help/372841N-01/nixnet/nxcreatesession/"
     flattened_list = _utils.flatten_items(frames)
     SessionBase.__init__(self, database_name, cluster_name, flattened_list,
                          interface,
                          constants.CreateSessionMode.FRAME_IN_SINGLE_POINT)
     self._frames = session_frames.SinglePointInFrames(self._handle)
Ejemplo n.º 4
0
    def __init__(
            self,
            interface_name,
            database_name=':memory:',
            cluster_name=''):
        """Create a Frame Input Stream session.

        This function creates a Frame Input Stream session using the named
        references to database objects.

        Args:
            interface_name: A string representing the XNET Interface to use for
                this session.
            database_name: A string representing the XNET database to use for
                interface configuration. The database name must use the <alias>
                or <filepath> syntax (refer to Databases).
            cluster_name: A string representing the XNET cluster to use for
                interface configuration. The name must specify a cluster from
                the database given in the database_name parameter.

        Returns:
            A Frame Input Stream session object.
        """
        flattened_list = _utils.flatten_items(None)
        base.SessionBase.__init__(
            self,
            database_name,
            cluster_name,
            flattened_list,
            interface_name,
            constants.CreateSessionMode.FRAME_IN_STREAM)
        self._frames = session_frames.InFrames(self._handle)
Ejemplo n.º 5
0
    def __init__(
            self,
            interface_name,  # type: typing.Text
            database_name=':memory:',  # type: typing.Text
            cluster_name='',  # type: typing.Text
    ):
        # type: (...) -> None
        """Create a Frame Input Stream session.

        This function creates a Frame Output Stream session using the named
        references to database objects.

        Args:
            interface_name(str): XNET Interface name to use for
                this session.
            database_name(str): XNET database name to use for
                interface configuration. The database name must use the <alias>
                or <filepath> syntax (refer to Databases).
            cluster_name(str): XNET cluster name to use for
                interface configuration. The name must specify a cluster from
                the database given in the database_name parameter.
        """
        flattened_list = _utils.flatten_items(None)
        base.SessionBase.__init__(
            self,
            database_name,
            cluster_name,
            flattened_list,
            interface_name,
            constants.CreateSessionMode.FRAME_OUT_STREAM)
        self._frames = session_frames.OutFrames(self._handle)
Ejemplo n.º 6
0
    def __init__(
            self,
            interface_name,
            database_name,
            cluster_name,
            signals):
        """Create a Signal Output Single-Point session.

        This function creates a Signal Output Single-Point session using the named
        references to database objects.

        Args:
            interface_name: A string representing the XNET Interface to use for
                this session.
            database_name: A string representing the XNET database to use for
                interface configuration. The database name must use the <alias>
                or <filepath> syntax (refer to Databases).
            cluster_name: A string representing the XNET cluster to use for
                interface configuration. The name must specify a cluster from
                the database given in the database_name parameter. If it is left
                blank, the cluster is extracted from the signals parameter.
            signals: A list of strings describing signals for the session. The
                list syntax is as follows:

                    List contains one or more XNET Signal names. Each name must
                    be one of the following options, whichever uniquely
                    identifies a signal within the database given:

                        -<Signal>
                        -<Frame>.<Signal>
                        -<Cluster>.<Frame>.<Signal>
                        -<PDU>.<Signal>
                        -<Cluster>.<PDU>.<Signal>

                    List may also contain one or more trigger signals. For
                    information about trigger signals, refer to Signal Output
                    Single-Point Mode or Signal Output Single-Point Mode.

        Returns:
            A Signal Output Single-Point session object.
        """
        flattened_list = _utils.flatten_items(signals)
        base.SessionBase.__init__(
            self,
            database_name,
            cluster_name,
            flattened_list,
            interface_name,
            constants.CreateSessionMode.SIGNAL_OUT_SINGLE_POINT)
        self._signals = session_signals.SinglePointOutSignals(self._handle)
Ejemplo n.º 7
0
    def __init__(
            self,
            interface_name,  # type: typing.Text
            database_name,  # type: typing.Text
            cluster_name,  # type: typing.Text
            signals,  # type: typing.Union[typing.Text, typing.List[typing.Text]]
    ):
        # type: (...) -> None
        """Create a Signal Output Single-Point session.

        This function creates a Signal Output Single-Point session using the named
        references to database objects.

        Args:
            interface_name(str): XNET Interface name to use for
                this session.
            database_name(str): XNET database name to use for
                interface configuration. The database name must use the <alias>
                or <filepath> syntax (refer to Databases).
            cluster_name(str): XNET cluster name to use for
                interface configuration. The name must specify a cluster from
                the database given in the database_name parameter. If it is left
                blank, the cluster is extracted from the ``signals`` parameter.
            signals(list of str): Strings describing signals for the session. The
                list syntax is as follows:

                ``signals`` contains one or more XNET Signal names. Each name must
                be one of the following options, whichever uniquely
                identifies a signal within the database given:

                    - ``<Signal>``
                    - ``<Frame>.<Signal>``
                    - ``<Cluster>.<Frame>.<Signal>``
                    - ``<PDU>.<Signal>``
                    - ``<Cluster>.<PDU>.<Signal>``

                ``signals`` may also contain one or more trigger signals. For
                information about trigger signals, refer to Signal Output
                Single-Point Mode or Signal Output Single-Point Mode.
        """
        flattened_list = _utils.flatten_items(signals)
        base.SessionBase.__init__(
            self,
            database_name,
            cluster_name,
            flattened_list,
            interface_name,
            constants.CreateSessionMode.SIGNAL_OUT_SINGLE_POINT)
        self._signals = session_signals.SinglePointOutSignals(self._handle)
Ejemplo n.º 8
0
    def __init__(
            self,
            interface_name,
            database_name,
            cluster_name,
            frames):
        """Create a Frame Output Single-Point session.

        This function creates a Frame Output Single-Point session using the named
        references to database objects.

        Args:
            interface_name: A string representing the XNET Interface to use for
                this session.
            database_name: A string representing the XNET database to use for
                interface configuration. The database name must use the <alias>
                or <filepath> syntax (refer to Databases).
            cluster_name: A string representing the XNET cluster to use for
                interface configuration. The name must specify a cluster from
                the database given in the database_name parameter. If it is left
                blank, the cluster is extracted from the 'frames' parameter.
            frames: A list of strings describing frames for the session. The
                list syntax is as follows:

                    List contains one or more XNET Frame or PDU names. Each name
                    must be one of the following options, whichever uniquely
                    identifies a frame within the database given:

                        -<Frame>
                        -<Cluster>.<Frame>
                        -<PDU>
                        -<Cluster>.<PDU>

        Returns:
            A Frame Output Single-Point session object.
        """
        flattened_list = _utils.flatten_items(frames)
        base.SessionBase.__init__(
            self,
            database_name,
            cluster_name,
            flattened_list,
            interface_name,
            constants.CreateSessionMode.FRAME_OUT_SINGLE_POINT)
        self._frames = session_frames.SinglePointOutFrames(self._handle)
Ejemplo n.º 9
0
    def __init__(
            self,
            interface_name,  # type: typing.Text
            database_name,  # type: typing.Text
            cluster_name,  # type: typing.Text
            frames,  # type: typing.Union[typing.Text, typing.List[typing.Text]]
    ):
        # type: (...) -> None
        """Create a Frame Output Single-Point session.

        This function creates a Frame Output Single-Point session using the named
        references to database objects.

        Args:
            interface_name(str): XNET Interface name to use for
                this session.
            database_name(str): XNET database name to use for
                interface configuration. The database name must use the <alias>
                or <filepath> syntax (refer to Databases).
            cluster_name(str): XNET cluster name to use for
                interface configuration. The name must specify a cluster from
                the database given in the database_name parameter. If it is left
                blank, the cluster is extracted from the ``frames`` parameter.
            frames(list of str): Strings describing frames for the session. The
                list syntax is as follows:

                List contains one or more XNET Frame or PDU names. Each name
                must be one of the following options, whichever uniquely
                identifies a frame within the database given:

                    - ``<Frame>``
                    - ``<Cluster>.<Frame>``
                    - ``<PDU>``
                    - ``<Cluster>.<PDU>``
        """
        flattened_list = _utils.flatten_items(frames)
        base.SessionBase.__init__(
            self,
            database_name,
            cluster_name,
            flattened_list,
            interface_name,
            constants.CreateSessionMode.FRAME_OUT_SINGLE_POINT)
        self._frames = session_frames.SinglePointOutFrames(self._handle)
Ejemplo n.º 10
0
    def __init__(
            self,
            interface_name,
            database_name,
            cluster_name,
            frame):
        """Create a Frame Input Queued session.

        This function creates a Frame Input Queued session using the named
        references to database objects.

        Args:
            interface_name: A string representing the XNET Interface to use for
                this session.
            database_name: A string representing the XNET database to use for
                interface configuration. The database name must use the <alias>
                or <filepath> syntax(refer to Databases).
            cluster_name: A string representing the XNET cluster to use for
                interface configuration. The name must specify a cluster from
                the database given in the database_name parameter. If it is left
                blank, the cluster is extracted from the 'frame' parameter.
            frame: A string describing one XNET Frame or PDU name. This name
                must be one of the following options, whichever uniquely
                identifies a frame within the database given:

                    -<Frame>
                    -<Cluster>.<Frame>
                    -<PDU>
                    -<Cluster>.<PDU>

        Returns:
            A Frame Input Queued session object.
        """
        flattened_list = _utils.flatten_items(frame)
        base.SessionBase.__init__(
            self,
            database_name,
            cluster_name,
            flattened_list,
            interface_name,
            constants.CreateSessionMode.FRAME_IN_QUEUED)
        self._frames = session_frames.InFrames(self._handle)
Ejemplo n.º 11
0
    def __init__(
            self,
            interface_name,  # type: typing.Text
            database_name,  # type: typing.Text
            cluster_name,  # type: typing.Text
            frame,  # type: typing.Text
    ):
        # type: (...) -> None
        """Create a Frame Output Queued session.

        This function creates a Frame Output Stream session using the named
        references to database objects.

        Args:
            interface_name(str): XNET Interface name to use for
                this session.
            database_name(str): XNET database name to use for
                interface configuration. The database name must use the <alias>
                or <filepath> syntax (refer to Databases).
            cluster_name(str): XNET cluster name to use for
                interface configuration. The name must specify a cluster from
                the database given in the database_name parameter. If it is left
                blank, the cluster is extracted from the ``frame`` parameter.
            frame(str): XNET Frame or PDU name. This name
                must be one of the following options, whichever uniquely
                identifies a frame within the database given:

                    - ``<Frame>``
                    - ``<Cluster>.<Frame>``
                    - ``<PDU>``
                    - ``<Cluster>.<PDU>``
        """
        flattened_list = _utils.flatten_items(frame)
        base.SessionBase.__init__(
            self,
            database_name,
            cluster_name,
            flattened_list,
            interface_name,
            constants.CreateSessionMode.FRAME_OUT_QUEUED)
        self._frames = session_frames.OutFrames(self._handle)
Ejemplo n.º 12
0
def test_flatten_items_invalid():
    with pytest.raises(errors.XnetError):
        _utils.flatten_items('A,B')
    with pytest.raises(errors.XnetError):
        _utils.flatten_items(5)