Jump to content

How can i get channel state without using socket?


Recommended Posts

Hi guys I'm in the middle of coding my first login window. I have one last thing to do and I could it with socket ble ble but I guess it's kinda lame.

So can someone show me any examples of how can I get the state of the channel and depending on either it's online or offline change the buttons ? (green/red)

Link to comment
Share on other sites

  • Premium

Well, you can use the ServerStateChecker. You can find it in an original intrologin.py, but I will try to show you how it works.

Firstly, you need to create a new ServerStateChecker and give the current python module to this, which means it will call its functions from the current python script (eg. yourNewIntrologin.py).

ServerStateChecker.Create(self)

You must write it before you wants to do anything with the ServerStateChecker. Do it eg in the Open(self) function, or what you call first when you open the login window.
 
After that write this:

ServerStateChecker.Initialize();
ServerStateChecker.AddChannel(id, ip, udp_port)
ServerStateChecker.Request()

Then create a new function in the same class named NotifyChannelState(self, channelID, state)
The ServerStateChecker will trigger this function, and you will get the state of the channel. Then you could do what you want with it.

And last but not least, add this to the OnUpdate function:

ServerStateChecker.Update()

I hope it was understandable and helpful. ;)

  • Love 1

The one and only UI programming guideline

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.