I am using the Jvelbus Api (java) that someone developed for handling the bus. It’s the same as the one developed in .Net.
I would like to know how to get the response for a Status Relay Message.
It’s sent via the sendBlocking() method. So it’s blocking the bus to send message.
Now via the ReceivedPacket Listener I will receive the entering response. How can I be sure that the response matches to my question?
How can I put in place this link mechanism between the question and response?
You are correct in a way, but it mostly means that it will block the current thread
You can’t. Communication is asynchronous, meaning packets will be received and sent ‘randomly’.
Always wait for packets and read them
Interpret packets as they come in
Send packets yourself to get information or send a command
If you receive a status packet, interpret the status, and store the status. If you want to know the status later on, well, you’ve just stored it so you still know it
I’m programming apps with Velbus (especially PB_Velbus-Server which is an Ethernet/Velbus bridge). Velbus bus communication works like Ethernet UDP communication.
Then, there are two way to have a feedback :
create a process that log each frames in a list (chainedlist, etc) and then search in this list after sending a command frame (but you have to wait a least 10 ms before searching)
send a command frame et start a loop with a timeout (3 sec are enough). In this loop, read and analyze each frame. If timeout occurs, you can try to request a status on module choosen or send it again the same frame.
Responses aren’t guaranted, because a high priority message can be transmitted at the same time than the answer (is the process like CSMA/CD on Ethernet protocol ?)…
If you want to use PB_Velbus-Server (PB is accronym for PureBasic, the language I use), you can connect many network applications on the same server (for example, on a PC you can use VelbusLink and in same time, on an other PC you can send/receive Velbus frame)
That way, you can use VelbusLink analyzer (logging) and read same frames on my server (you can save them as text file in the same directory).
I hope you a good luck : Velbus gives us a great hardware, we just have to create funny software
Yes Golfy I already the advantage of your tool. I think that I will use it.
Thinking about my application design :
Thing that I wanted to do:
a web interface with a bulb light. When I go on this page, every 5 sec, I am doing a refresh of the status of my bulb light component to check if it’s on or off.
The limitation of Java/.net libraries, if I send a message to the bus to know the status of my component, I have to implement by myself a mechanism linking my request and my response + mechanism to wait if response take a long time to come + handle the case of I don’t receive a response.
So with info that you gave me I think that I will design it differently :
at each time that a component changes of status (light on or off), I catch the message from the Velbus inside my application and change the status of my Light Object.
on my web page, every 5 sec, I will check the status of my Light object defined in my application.
[quote=“vdetez”]each time that a component changes of status (light on or off), I catch the message from the Velbus inside my application and change the status of my Light Object.
on my web page, every 5 sec, I will check the status of my Light object defined in my application.[/quote]
[quote=“vdetez”]each time that a component changes of status (light on or off), I catch the message from the Velbus inside my application and change the status of my Light Object.
on my web page, every 5 sec, I will check the status of my Light object defined in my application.[/quote]
That sounds absolutely perfect![/quote]
+1
I’m working on a similar (secret) project (code name : VELTRON). In fact, it would works on Windows OS, maybe Linux (if I could compile in this environnement because even if Purebasic is cross-platform, my knowledge isn’t enough at present time ).
However, your project seems to be compliant from any browser… even on Android/iPhone ?
By the way, you’ll have to do a scan of all modules first (to determine TYPE – one by address – and each part NAME – here you can have many NAME on one address because VMB4RY support 4 relays by example) : That means it’s better to manage ‘part’ as independant object
Happy to see someone using one of my tools : I was beginning to think I works for nothing