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

Reading freeze after 1sec of artnet inactivity #23

Open
Nspada2 opened this issue Aug 11, 2023 · 6 comments
Open

Reading freeze after 1sec of artnet inactivity #23

Nspada2 opened this issue Aug 11, 2023 · 6 comments
Labels

Comments

@Nspada2
Copy link

Nspada2 commented Aug 11, 2023

Hi guys, I'm using this repo in an android app I'm developing.
I noticed that if artnet stays still for more then 1 sec the reading freeze and need some time to wakeup.
Any ideas about how to fix it?
I'm using the Server Listener to read any change

Here a video of the problem.
https://youtu.be/G5EKXNKhBLs

@cansik
Copy link
Owner

cansik commented Aug 11, 2023

Hi, thanks for the provided video, would it also be possible to provide a minimal example which shows the problem? Without code it is difficult to help you with that.

@Nspada2
Copy link
Author

Nspada2 commented Aug 13, 2023

ArtNetClient artnet=new ArtNetClient();
        artnet.start();
        artnet.getArtNetServer().addListener(
                new ArtNetServerEventAdapter() {
                    @Override public void artNetPacketReceived(ArtNetPacket packet) {
                        dmxData = artnet.readDmxData(0, 0);
                        System.out.println("1:" + Byte.toUnsignedInt(dmxData[0]) + " 2:" + Byte.toUnsignedInt(dmxData[1]));
                        int a,b;
                        a=Byte.toUnsignedInt(dmxData[0])*20/255;
                        b=Byte.toUnsignedInt(dmxData[1])*20/255;
                        binding.textview1.setText("1:" + a + " 2:" + b);
                        binding.progressBar.setProgress(a);
                        binding.progressBar2.setProgress(b);
                    }
                });

@cansik
Copy link
Owner

cansik commented Aug 14, 2023

Does this behaviour happen only on android or is it possible to reproduce it on a computer as well?

To be honest, I can't find anything special in the code and I don't own an android phone. So it's a bit difficult to test.

@Nspada2
Copy link
Author

Nspada2 commented Aug 14, 2023

It's impossible to try that on android studio because of the network adaptor isolated from the host.
It never hapens with other software.
What I think is that it stops reading as soon as artnet stop transmitting, but, artnet protocol can stay "mute" up to 3 seconds if notthing changes, it only talk when something change or, if not, it sends a confirm that is alive every 3 secs.
A workaround I found is to use a channel which I don't use and give it a sinewave, so values are always changing and the connecrion is always mantained.

@cansik
Copy link
Owner

cansik commented Aug 14, 2023

Afaik there is no mechanism built into artnet4j that would prevent this behaviour (only send every nth second). Maybe android is messing with the sockets. I think I can not really help you with that problem, but I'll let the issue open for others with artnet4j & android experience.

@Nspada2
Copy link
Author

Nspada2 commented Aug 14, 2023

No problem, in my app I only use the reciver, but this could be helpful for someone with my preblem.
BTW the workaround works fine (if you can control the artnetOut)

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

No branches or pull requests

2 participants