Exemple #1
0
    def coupon_open(self):
        #
        # Dataregis 375-EP doesn't need a function to open a coupon - the
        # coupon is opened when the first item is added, so simple checks
        # is done at this part.
        #

        status = self._get_status()

        if status.needs_reduce_Z():
            raise PendingReduceZ(_("Pending Reduce Z"))
        if status.needs_read_X():
            raise PendingReadX(_("Pending Read X"))
        if status.has_been_totalized() or self._is_coupon_open:
            raise CouponOpenError("There is a coupon opened")
        self._is_coupon_open = True
Exemple #2
0
    def _check_status(self, verbose=False):
        status = self._get_status()
        if status[0] != ':':
            raise HardwareFailure('Broken status reply')

        if verbose:
            print '== STATUS =='

            # Codes found on page 57-59
            print 'Raw status code:', status
            print 'Cashier drawer is', ifset(status[1], 3, 'closed', 'open')

        if self.has_pending_reduce():
            raise PendingReduceZ(_('Pending Reduce Z'))
        if self.status_check(status, 1, 2):
            raise HardwareFailure(_('Mechanical failure'))
        if not self.status_check(status, 1, 1):
            raise AuthenticationFailure(_('Not properly authenticated'))
        if self.status_check(status, 1, 0):
            raise OutofPaperError(_('No paper'))
        if self.status_check(status, 2, 3):
            raise PrinterOfflineError(_("Offline"))
        #if not self.status_check(status, 2, 2):
        #     raise CommError(_("Peripheral is not connected to AUX"))
        if self.status_check(status, 2, 0):
            log.info('Almost out of paper')

        if verbose:
            S3 = status[3]
            print ifset(S3, 3, 'Maintenance', 'Operational'), 'mode'
            print 'Authentication', ifset(S3, 2, 'disabled', 'enabled')
            print 'Guillotine', ifset(S3, 1, 'disabled', 'enabled')
            print 'Auto close CF?', ifset(S3, 0, 'no', 'yes')

        if self.status_check(status, 6, 1):
            raise ReduceZError(_("readZ is already emitted"))

        # FIXME: I am not sure we should be doing this here. This method
        # should only check the status, and not emit any other command.
        #if self.needs_read_x(status):
        #    self.send_command(CMD_GET_X)

        return status
Exemple #3
0
    def _check_status(self, verbose=False):
        status = self._get_status()
        if status[0] != ':':
            raise HardwareFailure('Broken status reply')

        if verbose:
            print('== STATUS ==')

            # Codes found on page 57-59
            print('Raw status code:', status)
            print('Cashier drawer is', ifset(status[1], 3, 'closed', 'open'))

        if self.has_pending_reduce():
            raise PendingReduceZ(_('Pending Reduce Z'))
        if self.status_check(status, 1, 2):
            raise HardwareFailure(_('Mechanical failure'))
        if not self.status_check(status, 1, 1):
            raise AuthenticationFailure(_('Not properly authenticated'))
        if self.status_check(status, 1, 0):
            raise OutofPaperError(_('No paper'))
        if self.status_check(status, 2, 3):
            raise PrinterOfflineError(_("Offline"))
        if self.status_check(status, 2, 0):
            log.info('Almost out of paper')

        if verbose:
            S3 = status[3]
            print(ifset(S3, 3, 'Maintenance', 'Operational'), 'mode')
            print('Authentication', ifset(S3, 2, 'disabled', 'enabled'))
            print('Guillotine', ifset(S3, 1, 'disabled', 'enabled'))
            print('Auto close CF?', ifset(S3, 0, 'no', 'yes'))

        if self.status_check(status, 6, 1):
            raise ReduceZError(_("readZ is already emitted"))

        return status