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

Can I write or read data with other encoder devices #1

Open
hai-ru opened this issue Jun 14, 2024 · 12 comments
Open

Can I write or read data with other encoder devices #1

hai-ru opened this issue Jun 14, 2024 · 12 comments

Comments

@hai-ru
Copy link

hai-ru commented Jun 14, 2024

Can I asked more about onity things?

@batiati
Copy link
Owner

batiati commented Jun 14, 2024

Hey @hai-ru!
Sure, as far as I know, this protocol works with a broad range of Onity encoder devices. Actually, it's the same protocol since the old ones were connected over the serial port, although this project only implements the TCP/IP transport layer (for the modern encoders with a network interface).

It also works with the virtual device exposed by the software "OnPortal" which uses USB-connected smart card encoders (PC/SC interface).

Feel free to ask more questions, I'll be glad to help if I can.
I don't know much about their entire product line, just what I've worked with.

@hai-ru
Copy link
Author

hai-ru commented Jun 19, 2024

Thank you for your attention @batiati 😁

I have question how to connect this device to LAN? I just found rj11 6 pin in socket, and pc have rj45 8 pin socket

because I want to develop hotel management system with your sdk package.

image

@batiati
Copy link
Owner

batiati commented Jun 21, 2024

Wow! That is an old one! The protocol should work with it, in fact, I replaced a bunch of those old encoders (that worked fine with the previous software by serial).

But you must figure out some things (the encoder manual can help):

  • The cable pinout to properly connect the serial port to a PC (should work fine through a Serial-USB adapter).
  • The proper baud rate and other serial configs (stop bits, handshake, etc).
  • Implement a new Client.cs using a serial stream instead of the TCP stream.

See how we send the bytes through the wire here:

Onity/src/Client.cs

Lines 326 to 339 in dcb0f7f

var stream = tcpClient.GetStream();
byte ret;
tcpClient.ReceiveTimeout = tcpClient.SendTimeout = PROTOCOL_TIMEOUT;
#region Comments
//Send the ENQ command to verify if the device is avaiable
#endregion Comments
stream.WriteByte(Command.ENQ);
ret = (byte)stream.ReadByte();
if (ret != Command.ACK) throw new BusyDeviceException();
)

A PR with this change is welcome, I'll be glad to assist in reviewing the code 🎉

@hai-ru
Copy link
Author

hai-ru commented Jun 21, 2024

Okay. I will starting development for serial usb connections write and read data. I will let you know and make a PR branch for contributed to this repository. Thank you 🙏

@hai-ru
Copy link
Author

hai-ru commented Jun 26, 2024

Wow! That is an old one! The protocol should work with it, in fact, I replaced a bunch of those old encoders (that worked fine with the previous software by serial).

But you must figure out some things (the encoder manual can help):

  • The cable pinout to properly connect the serial port to a PC (should work fine through a Serial-USB adapter).

  • The proper baud rate and other serial configs (stop bits, handshake, etc).

  • Implement a new Client.cs using a serial stream instead of the TCP stream.

See how we send the bytes through the wire here:

Onity/src/Client.cs

Lines 326 to 339 in dcb0f7f

var stream = tcpClient.GetStream();
byte ret;
tcpClient.ReceiveTimeout = tcpClient.SendTimeout = PROTOCOL_TIMEOUT;
#region Comments
//Send the ENQ command to verify if the device is avaiable
#endregion Comments
stream.WriteByte(Command.ENQ);
ret = (byte)stream.ReadByte();
if (ret != Command.ACK) throw new BusyDeviceException();
)

A PR with this change is welcome, I'll be glad to assist in reviewing the code 🎉

@batiati I've got this error mesage when trying to connecting with device

image

image

Do you have experience in solved the issue? @batiati

Thank you

@Heman2025
Copy link

Heman2025 commented Jun 26, 2024

hi i'm also interested in this onity project as i myself designing Hotel Check In System . and i have access to all onity encoders old and new rfid.

@batiati
Copy link
Owner

batiati commented Jun 27, 2024

Do you have experience in solved the issue?

Unfortunately not, but it appears to be either an issue with the device driver of the Usb-Serial adapter you're using --or-- a mundane silly thing such as permission (try to run as administrator), port already open (try to check if there's other program using this COM), need for a reboot (it's classic 😬)

@hai-ru
Copy link
Author

hai-ru commented Jul 1, 2024

Do you have experience in solved the issue?

Unfortunately not, but it appears to be either an issue with the device driver of the Usb-Serial adapter you're using --or-- a mundane silly thing such as permission (try to run as administrator), port already open (try to check if there's other program using this COM), need for a reboot (it's classic 😬)

image

Right now error is gone 😁 but the issue is device just stand by and not giving feedback.

@Heman2025
Copy link

Heman2025 commented Jul 1, 2024 via email

@hai-ru
Copy link
Author

hai-ru commented Jul 4, 2024

You need read this manual for make sure

manual connection ht22.pdf

I could help if you could tell me how you guys trying so I can follow the steps.If possible could you tell me this details.1. The encoder you’re using does it have data ?2. If yes the. How are you trying access the room details to make sure that room no exists?3. If no data on encoder how you’re trying to send the data without locking plan ? Sent from Yahoo Mail for iPhone On Monday, July 1, 2024, 10:12 AM, Muhammad Khairuddin @.> wrote: Do you have experience in solved the issue? Unfortunately not, but it appears to be either an issue with the device driver of the Usb-Serial adapter you're using --or-- a mundane silly thing such as permission (try to run as administrator), port already open (try to check if there's other program using this COM), need for a reboot (it's classic 😬) 4B59C536-2EDE-4532-A3EA-A7A5A70E36FA.jpeg (view on web) Right now error is gone 😁 but the issue is device just stand by and not giving feedback. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>

@batiati
Copy link
Owner

batiati commented Jul 4, 2024

You need read this manual for make sure

manual connection ht22.pdf

Thanks, that's really helpful!

At a first glance, the protocol implemented seems to have the same structure (but it's worthy performing a more detailed review). It's also possible to be caused by some differences between the HT24 and HT22 protocols, they are compatible, but maybe the current implementation is sending unsupported commands to a HT22 device.

As a rule of thumb, first try to check the physical cabling, and then trying all the different baud-rate configurations for the serial port.

image

@Heman2025
Copy link

Heman2025 commented Jul 4, 2024 via email

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

3 participants