This document detailed out the design approach to integrate with the list of devices used in the MOSIP platform.
Interface approach has been taken to implement the integration with external devices. The interface should have the required method to communicate with the external devices. An Abstract class has been defined to implement the common functionality and it should be extended by Vendor specific implementation class. The device vendor's specific implementation class should extend the Abstract class and implement the required methods using available libraries.
Scanner
Printer
GPS
Interface: IMosipDocumentScannerService
public Boolean isConnected() - to check the scanner connection availability.
public BufferedImage scan() - to scan the document from the scanner device.
Abstract Class: DocumentScannerService
public byte[] asPDF(List bufferedImages) - to convert the captured scanned document files into pdf format.
public byte[] asImage(List bufferedImages) - to convert the captured scanned document files into image format.
public byte[] getImageBytesFromBufferedImage(BufferedImage bufferedImage) - to get the byte[] from BuffredImage object.
public List pdfToImages(byte[] pdfBytes) - to convert the pdf document to image format in order to show in the document preview.
Use the JavaFx provided print functionality to interact with printer directly from UI layer. No additional interface is required. javafx.scene.web.WebView.getEngine().print(PrinterJob)
Interface:IMosipGPSService
public String getComPortGPSData (String comPortNo, int portReadWaitTime) - it returns GPS signal in standard format.
Abstract Class:IMosipGPSServiceImpl
public GPSPosition sigalParser(String line) Inputs: gps signal (Ex: $GPRMC,055218.000,A,1259.4845,N,08014.7602,E,0.07,120.70,171018,,,A*64)
returns the latitude and longitude from the GPS signal.