npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

identi-recognition

v0.0.3

Published

identiRecognition

Downloads

6

Readme

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.3 | Initial Integration | Development | | | | |

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:

npm install device-control-package

Usage

First, import the desired classes from the package:

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

// Create instances for each device with their respective IP addresses
const xcoreDevice = new XCore('192.168.1.100')
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.

| Method | Description | | ------------------ | ------------------------------------------------- | | getStatus() | Retrieves the current status of the XCore device. | | sendCommand(cmd) | Sends a command to the XCore device. | | restartDevice() | Restarts the XCore device. | | getLogs() | Retrieves the logs of the XCore device. | | updateFirmware() | Updates the firmware of the device. |

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