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 |
- 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
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
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')
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
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. |
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
-
getStatus()
Retrieves the current status of the XCore device.
const status = await xcoreDevice.getStatus() console.log(status) // Output: { status: 'online', ... }
-
sendCommand(command: string)
Sends a specified command to the device.
const response = await xcoreDevice.sendCommand('RESTART') console.log(response) // Output: { code: HFS001, ... }
-
restartDevice()
Restarts the XCore device.
const result = await xcoreDevice.restartDevice() console.log(result) // Output: { code: HFS001, message: 'Device restarting...' }
-
getLogs()
Retrieves system logs from the XCore device.
const logs = await xcoreDevice.getLogs() console.log(logs) // Output: [ { timestamp: '...', message: 'Log entry...' }, ... ]
-
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' }
-
getStatus()
Retrieves the current status of the Terminal device.
const status = await terminalDevice.getStatus() console.log(status) // Output: { status: 'online', ... }
-
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" }}}
-
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...' }
-
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: ' ' }
-
deleteUser(userId)
Delete user by id
const result = await terminalDevice.deleteUser(123456) console.log(result) // Output: { code: HFS001, message: '' }
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.
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'))