identi-recognition

0.0.14 • Public • Published

HUMAN FACE SECURITY INTEGRATION

Badge en Test Service

This package provides a unified way to interact with multiple access control devices, including XCore and Terminal, allowing for standardized command execution and status retrieval.

Version Descripcion Estado
0.0.14 Initial Integration Development

RELEASE NOTES :

  • The terminal class is still being build.
  • The XCORE class is still being build.
  • In the XCORE class keep in mind that there are two types of XCOREs. Depending on the API. So make sure to validate the object creation.
  • Adittional, when creating Xcore Objects , make sure to call the getStatus() ALWAYS , so you can make sure the device was correctly configured. If it fails, try changing the _versionPro parameter when creating the object

Table of Contents

  1. Installation
  2. Usage
  3. Device Classes
  4. Configuration
  5. API Reference
  6. Error Handling
  7. Examples

Installation

To install this package, use the following command:

npm install identi-recognition

Make sure you have axios installed as a dependency if not already present in your project

Usage

First, import the desired classes from the package:

const { XCore, Terminal } = require('identi-recognition')

// Create instances for each device with their respective IP addresses
// and passwords if required.

const xcoreDevice = new XCore((ip = '192.168.1.100'), (_versionPro = false))
const terminalDevice = new Terminal('192.168.1.101', 'passwordTerminal')

Device Classes

XCore Class

The XCore class allows you to interact with XCore devices. It includes methods for status retrieval and sending commands.

Method Description
getStatus() Retrieves the current status of the XCore device.
facesCompare(image1, image2, liveness ) Compare two faces images.
faceCompareToLocal(image1, group, liveness ) Compare a face image to the local Db of the device.
prepareReport(...) Prepare report with all needed infomration.
generateReport() return the generated report.
groupFace() Group a face in order to be detected by images.
createUser() Uplaod an User iamge to Xcore device [see_more].
updateCreatedUser() [NOT VALID YET]
deleteUser() [NOT VALID YET]

*[see_more] : In order to be recognized by Ip cameras , the images uploaded must be charged to an specific gorup where the ip cameras must be connected too

Terminal Class

The Terminal class provides similar functionality for Terminal devices. It supports status monitoring, command execution, and more.

Method Description
getStatus() Retrieves the current status of the Terminal device.
setCallbacks(endpointCallback) Defines the endpoints callbacks for the correct validation
showMessage(message,speak) Sends something so the terminal will show or speak.
deleteAllRecords(simetricalMonths) Delete the registers, simetrical to the devices .
deleteUser(userId) Delete the user specified.
photoTaking() Start procces to make teminal be the one to take photos.

Configuration

Adittional, when creating Xcore Objects , make sure to call the getStatus() ALWAYS , so you can make sure the device was correctly configured. If it fails, try changing the _versionPro parameter when creating the object

API Reference

XCore Methods

  1. getStatus()

    Retrieves the current status of the XCore device.

    const status = await xcoreDevice.getStatus()
    console.log(status) // Output: { status: 'online', ... }
  2. sendCommand(command: string)

    Sends a specified command to the device.

    const response = await xcoreDevice.sendCommand('RESTART')
    console.log(response) // Output: { code: HFS001, ... }
  3. restartDevice()

    Restarts the XCore device.

    const result = await xcoreDevice.restartDevice()
    console.log(result) // Output: { code: HFS001, message: 'Device restarting...' }
  4. getLogs()

    Retrieves system logs from the XCore device.

    const logs = await xcoreDevice.getLogs()
    console.log(logs) // Output: [ { timestamp: '...', message: 'Log entry...' }, ... ]
  5. updateFirmware()

    Updates the firmware of the device using the given update file.

    const updateStatus = await xcoreDevice.updateFirmware('path/to/update.bin')
    console.log(updateStatus) // Output: { code: HFS001, version: '2.0.1' }

Terminal Methods

  1. getStatus()

    Retrieves the current status of the Terminal device.

    const status = await terminalDevice.getStatus()
    console.log(status) // Output: { status: 'online', ... }
  2. setCallbacks(endpointCallback)

    SDefines the endpoints callbacks for the correct validation.

    const response = await terminalDevice.setCallbacks('192.168.1.120:8888/setHere/')
    console.log(response) // Output: { code: HFS001, message: { messageResult: "success"  }}}
  3. showMessage(message,speak)

    Sends something so the terminal will show or speak. if "speak" is true, then the terminal will speak, if its false, it will only show the message in screen.

    const result = await terminalDevice.showMessage('Hola', true)
    console.log(result) // Output: { code: HFS001, message: 'Device rebooting...' }
  4. deleteAllRecords(simetricalMonths)

    Delete the resgisters X months forward and backward the current date.

    const newConfig = { volume: 80, brightness: 70 }
    const result = await terminalDevice.deleteAllRecords(1)
    console.log(result) // Output: { code: HFS001, message: ' ' }
  5. deleteUser(userId)

    Delete user by id

    const result = await terminalDevice.deleteUser(123456)
    console.log(result) // Output: { code: HFS001, message: '' }

Error Handling

The package provides a built-in error handler to capture and log errors. Errors are caught and handled internally, returning meaningful messages to the user.

Examples

Here’s a quick example of how you can use this package:

const { XCore, Terminal } = require('device-control-package')

const xcore = new XCore('192.168.1.100')
const terminal = new Terminal('192.168.1.101', 'password')

// ALWAYS CALL THE Get status of XCore
// IF it fails , try changing the _versionPro parameter
xcore
  .getStatus()
  .then((status) => console.log('XCore Status:', status))
  .catch((error) => {
    const xcore = new XCore('192.168.1.100', (_versionPro = false))
  })

// Send a command to Terminal
terminal.showMessage('Hello from my package').then((response) => console.log('WOW,m the terminal spoke'))

Readme

Keywords

Package Sidebar

Install

npm i identi-recognition

Weekly Downloads

154

Version

0.0.14

License

MIT

Unpacked Size

90.2 kB

Total Files

15

Last publish

Collaborators

  • david_enrique