Closed galoko closed 6 years ago
I'm not sure what you mean you're out of options... you have infinite options. I purposely do not implement any kind of process/register map abstraction because everyone's use case is different.
Put them in a Map<Integer, Integer>
or get as complicated as you'd like?
well, this is a first thing that comes to mind, but if only I could use AttributeMap interface of Channel so I could actually store my context in a connection, that would be much better, isn't it?
Modbus register and status values are not traditionally per-connection - it's supposed to be a global address space.
If ServiceRequest
gave you access to the Netty Channel
would that work for you?
edit: Mmm, might not be that easy, this interface has to work for RTU support as well, where there won't be a Channel
.
That would be perfect, thank you. In fact this is how I changed your code in order to continue with my project, but I felt a little off about it.
edit: well, it can return null for RTU for all I care, I use only TCP right now, so... at least it's better than nothing
where could I store per connection variables? I mean lets picture the situation: device connects to my slave server, write multiple registers and then read holding registers, I generate values in holding registers based on written registers values. So where exactly should I keep these values in-between of onWriteMultipleRegisters and onReadHoldingRegisters calls? I'm kinda out of options here or so it seems