|
@@ -17,15 +17,39 @@ export class FisVerificationService {
|
|
|
|
|
|
constructor(
|
|
constructor(
|
|
@Inject(`SAMPLEAPP_SERVICE`) private sampleClient: ClientProxy,
|
|
@Inject(`SAMPLEAPP_SERVICE`) private sampleClient: ClientProxy,
|
|
|
|
+ @Inject(`FINGERPRINT_SERVICE`) private fingerprintClient: ClientProxy,
|
|
private configService: ConfigService
|
|
private configService: ConfigService
|
|
) {
|
|
) {
|
|
|
|
+ // Set up incoming responses or messages from TCP Java
|
|
this.port = this.configService.get<number>('afis.tcpPort') as number
|
|
this.port = this.configService.get<number>('afis.tcpPort') as number
|
|
this.host = this.configService.get<string>('afis.host') as string
|
|
this.host = this.configService.get<string>('afis.host') as string
|
|
|
|
|
|
this.javaClient = connectToAfisJava(this.host, this.port)
|
|
this.javaClient = connectToAfisJava(this.host, this.port)
|
|
this.javaClient.on(`data`, (data) => {
|
|
this.javaClient.on(`data`, (data) => {
|
|
let message: JavaResponse = JSON.parse(data.toString())
|
|
let message: JavaResponse = JSON.parse(data.toString())
|
|
|
|
+ console.log(message)
|
|
console.log(`Java server response: ${message.message}`)
|
|
console.log(`Java server response: ${message.message}`)
|
|
|
|
+ if (message.operation == `QualityAssurance`) {
|
|
|
|
+ let response: FisMessage = {
|
|
|
|
+ header: {
|
|
|
|
+ messageID: uuid(),
|
|
|
|
+ messageName: `Verification Response`
|
|
|
|
+ },
|
|
|
|
+ data: {
|
|
|
|
+ id: uuid(),
|
|
|
|
+ cmd: `QualityAssurance`,
|
|
|
|
+ message: `${message.data.name} finger position ${message.data.fingerprints[0].fpPosition} edge score is ${(message.edgeScore > 250 ? `good` : `bad`)}`,
|
|
|
|
+ data: {
|
|
|
|
+ score: message.score,
|
|
|
|
+ person: message.data.name,
|
|
|
|
+ fpPosition: message.data.fingerprints[0].fpPosition,
|
|
|
|
+ fpQuality: (message.score > 250 ? `good` : `bad`)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.fingerprintClient.emit(`message`, response)
|
|
|
|
+ }
|
|
|
|
+
|
|
if (message.operation == `Registration` && message.status == `Success`) {
|
|
if (message.operation == `Registration` && message.status == `Success`) {
|
|
this.registeredFingerprintData.push((message.data as PersonFingerprintData).fingerprints[0] as Fingerprint)
|
|
this.registeredFingerprintData.push((message.data as PersonFingerprintData).fingerprints[0] as Fingerprint)
|
|
console.log(message.data)
|
|
console.log(message.data)
|