100 lines
3.6 KiB
Markdown
100 lines
3.6 KiB
Markdown
# Notes on SOAP implementation
|
|
|
|
- Units should reflect SOAP methods onto their own namespace (1)
|
|
- CompositeMeasurement should convert to/from SOAP
|
|
- Type checking via client.get\_type('ns0:compositeMeasurement').elements
|
|
-
|
|
|
|
# Notes about this module - to be discussed
|
|
|
|
SYSLAB\_Unit.py has a whole bunch of static methods - should these be split into a util library instead?
|
|
Generally, many places where static methods are used for things that should perhaps just be functions...
|
|
|
|
The following files are empty:
|
|
- BattOpMode.py
|
|
- FlowBatteryState.py
|
|
- GaiaWindTurbine.py
|
|
|
|
|
|
To check the methods available, use, e.g.:
|
|
http://syslab-33.syslab.dk:8080/typebased_WebService_HeatSubstation/HeatSwitchboardWebService/716-h1/resourceNames
|
|
|
|
To figure out this URL, look at software.xml for the corresponding machine, and use this template:
|
|
|
|
http://(machineName).syslab.dk:(port)/(interfaceName)/(shortServerName)/(unitname)/resourceNames
|
|
|
|
| field | corresponds to | notes |
|
|
| ----- | -------------- | ----- |
|
|
| machineName | N/A | Look this up on the wiki |
|
|
| port | N/A | Dynamically allocated, starting at 8080 - good luck! |
|
|
| interfaceName | typeBasedWebService, interfaceName | |
|
|
| shortServerName | typeBasedWebService, serverClass | Remove the "Server" at the end |
|
|
| unitname | dataLogger, unit | Also defined as "name" in hardware.xml |
|
|
|
|
|
|
-------------------------
|
|
|
|
|
|
SYSLAB COMMON
|
|
Broadcast event logger:
|
|
|
|
Transcode to python:
|
|
https://git.elektro.dtu.dk/syslab/syslab-common/-/blob/master/src/main/java/risoe/syslab/comm/broadcast/BroadcastLogSender.java
|
|
|
|
broadcast log sender
|
|
:: transcode the "send()" method to python. It byte-encodes the message for UDP.
|
|
Java:
|
|
send(String origin, byte[] origIP, long timestamp, int ploadType, String message,
|
|
int level, int flags, String[] tags)
|
|
------------
|
|
Python:
|
|
----------.
|
|
def send(origin, origIP, timestamp, ploadType, message, level, flags, tags):
|
|
ploadbytes = message[:min(1024, len(message))].encode()
|
|
origbytes = origin[:min(32, len(origin))].encode()
|
|
tagbytes = tagsToBytes(tags, 256)
|
|
pktlen = 2 + 2 + 1 + len(origbytes) + 4 + 2 + 2 + 8 + 1 + 2 + len(ploadbytes) + len(tagbytes)
|
|
buf = bytearray(pktlen)
|
|
buf[0] = BroadcastLogConstants.BROADCASTLOG_PKTID >> 8
|
|
buf[1] = BroadcastLogConstants.BROADCASTLOG_PKTID & 0xff
|
|
buf[2] = (pktlen >> 8) & 0xff
|
|
buf[3] = pktlen & 0xff
|
|
buf[4] = len(origbytes)
|
|
buf[5:5+len(origbytes)] = origbytes
|
|
writePtr = 5 + len(origbytes)
|
|
buf[writePtr:writePtr+4] = origIP
|
|
writePtr += 4
|
|
buf[writePtr] = (level >> 8) & 0xff
|
|
buf[writePtr+1] = level & 0xff
|
|
buf[writePtr+2] = (flags >> 8) & 0xff
|
|
buf[writePtr+3] = flags & 0xff
|
|
for i in range(8):
|
|
buf[writePtr+7-i] = timestamp & 0xff
|
|
timestamp >>= 8
|
|
writePtr += 8
|
|
buf[writePtr] = ploadType & 0xff
|
|
buf[writePtr+1] = (len(ploadbytes) >> 8) & 0xff
|
|
buf[writePtr+2] = len(ploadbytes) & 0xff
|
|
buf[writePtr+3:writePtr+3+len(ploadbytes)] = ploadbytes
|
|
writePtr += len(ploadbytes)
|
|
buf[writePtr:writePtr+len(tagbytes)] = tagbytes
|
|
pack = n
|
|
pack = DatagramPacket(buf, len(buf), InetAddress.getByName("localhost"), 4445)
|
|
sock.send(pack)
|
|
|
|
|
|
------------
|
|
|
|
broadcast log receiver
|
|
+ needs a logger
|
|
listener ist interface for receiver
|
|
|
|
gui wall (SYSLAB Userspacce)
|
|
broadcast log displet
|
|
https://git.elektro.dtu.dk/syslab/syslab-userspace/-/blob/master/src/main/java/risoe/syslab/gui/wall/displets/BroadcastLogDisplet.java
|
|
... maybe extend with simple log file writer.
|
|
|
|
|
|
|
|
|