This guide shows how to exercise the new Go GEM capabilities (status variables, data values, collection events, equipment constants and process programs) and how to interoperate with the original Python secsgem implementation.
- Go 1.21+
- Python 3.10+ with
secsgeminstalled (pip install secsgem) - Two terminal windows – one for the Go process, one for the Python process
The repository now ships with an interoperability helper in secs4go/example/geminterop.
go run ./secs4go/example/geminterop --mode equipment --addr 127.0.0.1 --port 5000 --session 0x100The equipment registers:
- Status Variable 1001 (
Temperature) - Data Variable 2001 (
Pressure) - Collection Event 3001
- Process Program
SAMPLE
Every 10 seconds it triggers CEID 3001 if a host has linked reports.
go run ./secs4go/example/geminterop --mode host --addr 127.0.0.1 --port 5000 --session 0x100The host demonstrates:
- Defining report 4001 with SVID 1001 and VID 2001 (
DefineReports) - Linking CEID 3001 to report 4001 (
LinkEventReports) - Enabling event reporting (
EnableEventReports) - Uploading a process program (
UploadProcessProgram) - Requesting a stored program (
RequestProcessProgram) - Receiving live S6F11 notifications (printed to the console)
Quit with Ctrl+C.
The same sample can be used to validate Go↔Python compatibility. Start either implementation in host or equipment mode and let the other side be provided by Python.
python -m secsgem.examples.gem_equipment --port 5000In another terminal run the Go host sample as shown earlier. You should see S6F11 notifications in the Go host log while Python prints the incoming S7F3 upload requests.
python -m secsgem.examples.gem_host --port 5000Let the Go equipment sample run. The Python host will define reports and request process programs; the Go equipment will log incoming requests and continue providing S6F11 data.
The Go test suite exercises all GEM features with an in-process host/equipment pair. Run:
go test ./secs4go/gemThis validates:
- Status variable and equipment constant exchange
- Data variables and collection event reporting
- Report definition/linking and enable/disable flows
- Process program upload/download acknowledgements
For Python compatibility, run the corresponding secsgem tests:
pytest tests/test_gem_equipment_handler.py -k "status or report or process"With both sets passing and the interop sample exchanging S6F11/S7F3 traffic, GEM functionality can be considered verified in both directions.