コード例 #1
0
    def _makeAndRunTransaction(self, requestsList):
        """Constructs, runs and then returns a completed transaction from the given requestsList

        requestsList: a list of TransactionElements (i.e. requests from client to the hardware).

        Notes:  _makeAndRunTransaction will automatically prepend one byte-order transaction.
        """

        # Construct the transaction and serialise it - we prepend four byte-order transactions in
        # order to ensure we meet minimum Ethernet payload requirements, else funny stuff happens.
        transaction = Transaction.constructClientTransaction(requestsList, self._hostAddr)
        transaction.serialiseRequests()

        chipsLog.debug("Sending packet now.");
        try:
            # Send the transaction
            self._socketSend(transaction)
        except socket.error as socketError:
            raise ChipsException("A socket error occurred whilst sending the IPbus transaction request packet:\n\t" + str(socketError))

        try:
            # Get response
            transaction.serialResponses = self._socket.recv(ChipsBus.SOCKET_BUFFER_SIZE)
        except socket.error as socketError:
            raise ChipsException("A socket error occurred whilst getting the IPbus transaction response packet:\n\t" + str(socketError))
        chipsLog.debug("Received response packet.");

        transaction.deserialiseResponses()

        transaction.doTransactionChecks() # Generic transaction checks

        self._transactionId = 1   # TEMPORARY IPBUS V2.x HACK!   Reset the transaction ID to 1 for each packet.
        return transaction
コード例 #2
0
ファイル: ChipsBus.py プロジェクト: RiceUBonnerLab/GLIB
    def _makeAndRunTransaction(self, requestsList):
        """Constructs, runs and then returns a completed transaction from the given requestsList

        requestsList: a list of TransactionElements (i.e. requests from client to the hardware).
        
        Notes:  _makeAndRunTransaction will automatically prepend one byte-order transaction.
        """

        # Construct the transaction and serialise it - we prepend four byte-order transactions in
        # order to ensure we meet minimum Ethernet payload requirements, else funny stuff happens.
        transaction = Transaction.constructClientTransaction(requestsList, self._hostAddr)
        transaction.serialiseRequests()
        
        chipsLog.debug("Sending packet now.");
        try:
            # Send the transaction
            self._socketSend(transaction)
        except socket.error, socketError:
            raise ChipsException("A socket error occurred whilst sending the IPbus transaction request packet:\n\t" + str(socketError))
コード例 #3
0
    def _makeAndRunTransaction(self, requestsList):
        """Constructs, runs and then returns a completed transaction from the given requestsList

        requestsList: a list of TransactionElements (i.e. requests from client to the hardware).

        Notes:  _makeAndRunTransaction will automatically prepend one byte-order transaction.
        """

        # Construct the transaction and serialise it - we prepend four byte-order transactions in
        # order to ensure we meet minimum Ethernet payload requirements, else funny stuff happens.
        transaction = Transaction.constructClientTransaction(
            requestsList, self._hostAddr)
        transaction.serialiseRequests()

        chipsLog.debug("Sending packet now.")
        try:
            # Send the transaction
            self._socketSend(transaction)
        except socket.error, socketError:
            raise ChipsException(
                "A socket error occurred whilst sending the IPbus transaction request packet:\n\t"
                + str(socketError))