0.0.8 • Published 6 months ago

identi-recognition v0.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

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.

VersionDescripcionEstado
0.0.8Initial IntegrationDevelopment

RELEASE NOTES :

...

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
const xcoreDevice = new XCore((ip = '192.168.1.100'), (_versionPro = false))
const terminalDevice = new Terminal('192.168.1.101')

Device Classes

XCore Class

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

MethodDescription
getStatus()Retrieves the current status of the XCore device.
facesCompare(image1, image2, liveness )Compare two faces images.
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.

MethodDescription
getStatus()Retrieves the current status of the Terminal device.
sendCommand(cmd)Sends a command to the Terminal device.
reboot()Reboots the Terminal device.
setConfiguration(data)Applies new configuration settings to the device.
clearLogs()Clears the logs of the Terminal device.

Configuration

Some methods may require additional configurations. You can set global configuration values in a config file:

module.exports = {
  requestTimeout: 5000, // Timeout for each request in milliseconds
  retryAttempts: 3 // Number of retry attempts for failed requests
}

Create a config.js file in the root directory of your project to set these values.

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: { success: true, ... }
  3. restartDevice()

    Restarts the XCore device.

    const result = await xcoreDevice.restartDevice()
    console.log(result) // Output: { success: true, 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: { success: true, 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. sendCommand(command: string)

    Sends a command to the Terminal device.

    const response = await terminalDevice.sendCommand('LOCK_DOOR')
    console.log(response) // Output: { success: true, message: 'Command executed' }
  3. reboot()

    Reboots the Terminal device.

    const result = await terminalDevice.reboot()
    console.log(result) // Output: { success: true, message: 'Device rebooting...' }
  4. setConfiguration(configObject: object)

    Applies new configuration settings to the Terminal device.

    const newConfig = { volume: 80, brightness: 70 }
    const result = await terminalDevice.setConfiguration(newConfig)
    console.log(result) // Output: { success: true, message: 'Configuration applied' }
  5. clearLogs()

    Clears the logs stored in the Terminal device.

    const result = await terminalDevice.clearLogs()
    console.log(result) // Output: { success: true, message: 'Logs cleared' }

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')

// 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.sendCommand('LOCK_DOOR').then((response) => console.log('Command Response:', response))
0.0.8

6 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.7

7 months ago

0.0.6

7 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago