Python-R305 Api

r305.getHeader(command, params=None)[source]

Generates the command packet for the given instruction of R305.

Parameters:
  • command – the command for which the packet/header is to be generated.
  • params – extra parameters if the command need them. for example for Img2Tz command you have to specify the buffer Id to store the template.

Returns command packet for the given instruction, this is a list of bytes.

r305.getChecksum(data)[source]

calculates the checksum of the packet.

Parameters:data – the datapacket

Returns the list containing two bytes which are the checksum of the given packet.

r305.parse(data)[source]

Parses the recived data packet.

Returns the Dict containing:

status : whether command executed correctly or not. Csum : “ok” if checksum is ok and “error” if there is a checksum error Data : list of bytes if any data is returned by the module.
class r305.R305(serialDevice=None, Baudrate=None)[source]

R305 device object. Contain methods for performaing different operations on R305 fingerprint module.

param serialDevice:
 the tty device to which the R305 is connected.
param Baudrate:the baudrate over which R305 is operated.
DeletChar(pageId=None, n=0)[source]

Deletes a segment (N) of templates of Flash library started from the specified location (or PageID);

Parameters:
  • pageId
  • n – segment.
DeleteAll()[source]

Deletes all of the existing templates from the database.

DownChar(bufferId=1, pageNumber=0)[source]

Downloads character file or template from upper computer to the specified buffer of Module.

Parameters:
  • bufferId
  • pageNumber
GenImg()[source]

Detects a finger and stores the finger image in the image buffer.

Img2Tz(bufferId=1)[source]

Generates character file from the original finger image in ImageBuffer and store the file in CharBuffer1 or CharBuffer2.

Parameters:bufferId – the CharBuffer where the fingerprint has to be saved.
Match()[source]

Carris out precise matching of templates from CharBuffer1 and CharBuffer2. Returns Matching result.

RegModel()[source]

Combines information of character files from CharBuffer1 and CharBuffer2 and generates a template which is stroed back in both CharBuffer1 and CharBuffer2

Search(bufferId=1, startPage=0, pageNum=100)[source]

Searches the whole finger library for the template that matches the one in CharBuffer1 or CharBuffer2. When found, PageID will be returned.

Parameters:
  • bufferId
  • startPage – two bytes address of starting page.
  • pageNum – two bytes address of last page.

Returns the PageID where the matching finger is found.

SearchFingerPrint(IgnoreChecksum=False)[source]

Searches the fingerprint in the module. Single method which. 1. scans the fingerprint 2. generates the character file 3. searches this character file in the module

Store(bufferId=1, templateNum=None)[source]

Stores the template of specified buffer (Buffer1/Buffer2) at the designated location of Flash library.

Parameters:
  • bufferId
  • templateNum – the template number.
StoreFingerPrint(callback=<built-in function print>, IgnoreChecksum=False, message='put the finger again ', templateNum=None)[source]

Performs the complete process for storing a finger into the module. to store a finger the process is.

  1. scan the finger
  2. generate a template
  3. scan the finger again
  4. generate the second template.
  5. match the two templates.
  6. if the templates are matching store the fingerprint in the specific location in th module.
Parameters:
  • callback – callbackfunction to get the message at each step.
  • IgnoreChecksum – ignores the checksum if True
  • message – message to be shown while scanning the finger second time.
  • bufferId – the bufferId for the character file.
  • templateNum – location where the fingerprint has to be stored.
TemplateNum()[source]

Retrives the current template number from the fingerprint module.

UpChar(bufferId=1)[source]

Uploads the character file or template of CharBuffer1/CharBuffer2 to upper computer.

Parameters:bufferId
execute(data)[source]

Executed the command on the fingerprint module.

Parameters:data – the data packet.

writes the data packet to the serial device and parses the result.