Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please solve my problem. It's important #2

Open
Unayes09 opened this issue Nov 8, 2023 · 6 comments
Open

Please solve my problem. It's important #2

Unayes09 opened this issue Nov 8, 2023 · 6 comments

Comments

@Unayes09
Copy link

Unayes09 commented Nov 8, 2023

its not working and shows the error below..
ok tcp
Promise Rejected
c:\node-zklib\node_modules\zk-jubaer\src\jtcp.js:246
const header = decodeTCPHeader(reply.subarray(0, 16))
^

TypeError: Cannot read properties of undefined (reading 'subarray')
at c:\node-zklib\node_modules\zk-jubaer\src\jtcp.js:246:44

Node.js v21.1.0

here the reply is null.what can i do?If any other settings required tell me. I give my ip adress which is connected with my device and it's also connected with zkteco software.

@shanto2007
Copy link

Same problem for me please help

@JubaerHossain
Copy link
Owner

which method ?

@aqibbangash
Copy link

aqibbangash commented Jan 22, 2024

@JubaerHossain While running your sample code, the device connects but on getAttendances function, this error comes up. These are my logs

initiating...
ZKJUBAER ZKJUBAER {
  connectionType: null,
  jtcp: JTCP {
    ip: '192.168.18.201',
    port: 4370,
    timeout: 5200,
    sessionId: null,
    replyId: 0,
    socket: null
  },
  judp: JUDP {
    ip: '192.168.18.201',
    port: 4370,
    timeout: 5200,
    socket: null,
    sessionId: null,
    replyId: 0,
    inport: 5000
  },
  interval: null,
  timer: null,
  isBusy: false,
  ip: '192.168.18.201'
}
creating socket...
ok tcp
getting attendances...
Promise Rejected
/Volumes/Official/source-code/zkt/node_modules/zk-jubaer/src/jtcp.js:246
      const header = decodeTCPHeader(reply.subarray(0, 16))
                                           ^

TypeError: Cannot read properties of undefined (reading 'subarray')
    at /Volumes/Official/source-code/zkt/node_modules/zk-jubaer/src/jtcp.js:246:44

Node.js v20.7.0

@aqibbangash
Copy link

Basically, the response Header commandId is coming in to be 2005 (CMD_ACK_UNAUTH) where as the expected commandId is 1501 (CMD_DATA)

Any idea why this is happening?

@Unayes09
Copy link
Author

Unayes09 commented Mar 5, 2024

@aqibbangash @JubaerHossain can you solve the problem?
ok tcp
Promise Rejected
f:\zkteco\zk-jubaer\src\jtcp.js:246
const header = decodeTCPHeader(reply.subarray(0, 16))
^

TypeError: Cannot read properties of undefined (reading 'subarray')
at f:\zkteco\zk-jubaer\src\jtcp.js:246:44

Node.js v21.1.0
this type of error showing to me actually

@Kireq1
Copy link

Kireq1 commented Mar 8, 2024

I am working to acquire the registration reports for an access control and attendance model SpeedFace-V5L from the zkteco brand. I have another K20 model device and the code works perfectly, it can recover information about the device, user, and most importantly the attendance records, but when trying the same on the SpeedFace-V5L it recovers information about the device, users, but not the sold records. . Already review the structure of the library and it is very simple, there is a function that is responsible for reading all the outputs of the socket after connecting to the device. This connection collects all the available elements, as follows:

requestData(msg) {
return new Promise((resolve, reject) => {
let timer = null
let replyBuffer = Buffer.from([])
const internalCallback = (data) => {
this.socket.removeListener('data', handleOnData)
timer && clearTimeout(timer)
resolve(data)
}

  const handleOnData = (data) => {
    replyBuffer = Buffer.concat([replyBuffer, data])
    if (checkNotEventTCP(data)) return;
    clearTimeout(timer)   

    const header = decodeTCPHeader(replyBuffer.subarray(0,16));

    if(header.commandId === COMMANDS.CMD_DATA){
      timer = setTimeout(()=>{
        internalCallback(replyBuffer)
      }, 1000)
    }else{
      timer = setTimeout(() => {
        reject(new Error('TIMEOUT_ON_RECEIVING_REQUEST_DATA'))
      }, this.timeout)

      const packetLength = data.readUIntLE(4, 2)
      if (packetLength > 8) {
        internalCallback(data)
      }
    }
  }

the variable responseBuffer = Buffer.concat([replyBuffer, data]) is responsible for storing available elements that the socket throws through the buffer into an array, when debugging the contestBuffer array of the k20 device it contains 27 elements, while the device SpeedFace- V5L only selects 16, the curious thing here is that when pairing selects the elements under the 'data' statement that is declared in:
const internalCallback = (data) => {
this.socket.removeListener('data', handleOnData)
timer && clearTimeout(timer)
resolve (data)
}
My theory is that it must be identified if another keyword or something else is required for the new equipment that can help me identify or know what is required to consult the registration data, since it is very clear that it marks the error. which refers to an unestablished stay. only opting for 16 elements when in the previous equipment you opt for 27 elements, in the same way and if it helps anyone, I share the API Development Manual:
AMTMultiBio SDK For Windows which is the official zkteco manual:
https://new-website-file.s3.ap-southeast-1.amazonaws.com/files/20230313/Armatura%20SDK%20Guide_MultiBio%202.1_Windows-202206.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants