FabLabKasse.cashPayment.server.NV11 package

Submodules

FabLabKasse.cashPayment.server.NV11.NV11Device module

class FabLabKasse.cashPayment.server.NV11.NV11Device.ESSPDevice(port, presharedKey=81985526925837671, slaveID=0)[source]

Bases: object

low layer eSSP protocol - implements the network layer and all communication-related commands

class ByteStreamReader(bytesList)[source]

Bases: object

read data values from a list of bytes

assertFinished()[source]
hasData()[source]
readAscii(n)[source]
readByte()[source]
readData(n)[source]
readUnsigned(numBytes, littleEndian)[source]
readUnsigned24()[source]
readUnsigned24BigEndian()[source]
readUnsigned32(CheckOverrun=True)[source]
readUnsigned32BigEndian()[source]
static unitTest()[source]
class Helper[source]

Bases: object

classmethod AsciiToBytes(x)[source]
CRC = <FabLabKasse.cashPayment.server.NV11.crc_algorithms.Crc object>
classmethod Unsigned32ToBytes(x)[source]
static Unsigned64ToBytes(x)[source]
static UnsignedToBytes(x, n)[source]
static byteArrayToString(data)[source]
classmethod crc(data)[source]
classmethod splitBytes(uint16)[source]
static stringToByteArray(string)[source]
static unitTest()[source]
class Response(data)[source]

Bases: object

status + data

getData()[source]
getDataStream()[source]
getStatus()[source]
isEncrypted()[source]
isHardFail()[source]
isOkay()[source]
isSoftFail()[source]
statusString()[source]
statusStrings = {-1: 'decoded response contains no data', 126: 'Encrypted Data', 240: 'OK', 242: 'Command not known', 243: 'Wrong number of parameters', 244: 'Param out of range', 245: 'Command cannot be processed at this time, possibly busy or not correctly configured', 246: 'Software error', 248: 'Command failure', 250: 'Encryption key not set'}
command(data, allowSoftFail=False, encrypted=True)[source]
debug(s)[source]
debug2(s)[source]
decryptResponse(r)[source]
encryptData(data)[source]
error(s)[source]
flushRead()[source]
initCrypto(presharedKey)[source]
log(s)[source]
printDebug(s, debugLevel)[source]
read()[source]
resendLast()[source]
reset()[source]
send(data)[source]
setEnabled(enabled)[source]
unencryptedCommand(data, allowSoftFail=False)[source]
warn(s)[source]
class FabLabKasse.cashPayment.server.NV11.NV11Device.NV11Device(port, presharedKey=81985526925837671, slaveID=0)[source]

Bases: FabLabKasse.cashPayment.server.NV11.NV11Device.ESSPDevice

Interface client for Innovative Technology NV11 banknote validator/changer with eSSP Protocol

empty()[source]
getChannelValue(channelId, reportedValue=False)[source]
getPayoutValues()[source]

get values of notes on payout stack. The last one of these is on top of the stack and will be paid out by the payout-command.

poll()[source]
setEnabledChannels(enabledChannels=None, upTo=0)[source]

enable cash input for certain channels (denominations). Use either of the two parameters. If both are used, the result will be combined with logical or.

Parameters:
  • enabledChannels (list[int]) – IDs of channels to explicitly enable, even if their denominaion is below the value of upTo.
  • upTo (int) – maximum allowed denomination, or 0
setRouteToPayout(values)[source]

route all notes in the given list of values to the payout-store. others will be directly put to the cashbox and are not availble for return.

stackFromPayout()[source]

move the current note from payout store to the cashbox, so that a smaller note that isn’t on top of the stack can be paid out. does not check if this is useful, these checks need to be done at a higher level!

tryPayout(value)[source]
class FabLabKasse.cashPayment.server.NV11.NV11Device.NV11DeviceTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test NV11Device class

test_ESSPDevice_ByteStreamReader()[source]

unittest: test the ByteStreamReader of ESSSPDevice

test_ESSPDevice_crc()[source]

unittest: check crc of ESSPDevice.Helper

FabLabKasse.cashPayment.server.NV11.crc_algorithms module

CRC algorithms implemented in Python. If you want to study the Python implementation of the CRC routines, then this is a good place to start from.

The algorithms Bit by Bit, Bit by Bit Fast and Table-Driven are implemented.

This module can also be used as a library from within Python.

Examples

This is an example use of the different algorithms:

>>> from crc_algorithms import Crc
>>>
>>> crc = Crc(width=16, poly=0x8005,
...           reflect_in=True, xor_in=0x0000,
...           reflect_out=True, xor_out=0x0000)
>>> print("0x%x" % crc.bit_by_bit("123456789"))
>>> print("0x%x" % crc.bit_by_bit_fast("123456789"))
>>> print("0x%x" % crc.table_driven("123456789"))
class FabLabKasse.cashPayment.server.NV11.crc_algorithms.Crc(width, poly, reflect_in, xor_in, reflect_out, xor_out, table_idx_width=None)[source]

Bases: object

A base class for CRC routines.

bit_by_bit(in_data)[source]

Classic simple and slow CRC implementation. This function iterates bit by bit over the augmented input message and returns the calculated CRC value at the end.

bit_by_bit_fast(in_data)[source]

This is a slightly modified version of the bit-by-bit algorithm: it does not need to loop over the augmented bits, i.e. the Width 0-bits which are appended to the input message in the bit-by-bit algorithm.

gen_table()[source]

This function generates the CRC table used for the table_driven CRC algorithm. The Python version cannot handle tables of an index width other than 8. See the generated C code for tables with different sizes instead.

reflect(data, width)[source]

reflect a data word, i.e. reverts the bit order.

table_driven(in_data)[source]

The Standard table_driven CRC algorithm.

Module contents