Resourceless servers

Starting from 1.4.0 Snap7Server can work in resourceless mode, i.e. you don’t need to share resources (DB, E, A…) with it : On every read/write request a callback is called passing it the TAG (Type of memory E,A,DB..,DB number if any, Start, Size, WordLen), and a pointer to the internal server area to read/write your data “on demand”

The resourceless mode is triggered automatically when you call Srv_SetRWAreaCallBack() function passing it the address of your callback (and an user pointer that can be useful to be casted onto an object)

The 1.4.0 wrappers were updated to reflect this new mode and I wrote some examples on how to use this feature, that however is very simple.

Purpose:

1.   Protocol converter.
Into the callback you can write a routine that accesses to other hardware (such as Modbus).

2.   HMI analyzer.
Into the callback you don’t write anything (i.e. the write requests will write nothing and the read requests will return all zeroes to the client).
Into the Events Log you will see the list of variables referenced by the HMI.

3.   Flow Splitter/Router.
Into the callback you can insert some function calls to S7Clients that access to Physical PLCs.
To allow this now it’s possible to force the the PDU Length that the server has to negotiate in order to match the various PDU sizes.

 

Remarks

1.   When in resourceless mode, all other system requests (read SZL, Get/Set Time and so on) are still handled by the Server.

2.   When in resourceless mode, all the block info requests (DB Get Info, Directory and so on) will return to the client the infos about the resources that you shared (if any) even if they are not physically used.