I have an application written with Java where I want to connect multiple streams to a single XBee RF link. The existing Java library looks like it is designed for a single stream received by a single listener.
What I want to do is implement something like TCP/IP which has ports. Adding a ports type feature would allow a output stream to be assigned to a port on one side of the RF link, while on the other side, a listener would be assigned to the same port number at the other end of the RF link.
Has anyone written the code to do this?
Sounds like you are looking for a Point to multi-point option am I correct? If I am, that is nothing more than opening a socket to the radios COM port and using the API interface. Or using some other addressing protocol.
What I want to do is take a single RF link and have multiple channels down the link (many to many).
A specific example.
I have a long config message that will take maybe a minute to be transmitted down an RF link. I also want to send a single word message that requires immediate transmission down the RF link.
If I just use one buffered output and one listener, the short message may end up being queued behind the long message.
If I have two buffered channels and two listeners, the short message will be sent in parallel with the long message. It will get to the attached listener a lot quicker.
This is especially true if the short message channel is assigned a higher priority.
Of course all of the data has to end up going down a single physical link. This would require time division multiplexing. Two channels of equal priority would get 50% time to send packets down the link. Priority can be set by adjusting the time division. Of course any channel with no data will be assigned zero time.
From the users point of view, it would look like there are multiple links.
This approach is used everywhere in all types of communications links, so I would be surprised if someone hasn’t done it already for X-Bees / Zigbees. I am just trying to avoid making a new wheel.
I see that the Java API includes the java.nio.channels class. It appears this provides a multiplex type functionality based on the documentation. Maybe this could be connected to the digi Java class.
Just note that just because Java may support it, the radios will only send data as it is received in the order it was received.
That is true for practically all comms links, especially point to point. The Java class hopefully will have the smarts to multiplex.