--- a/LPCExtension.py Tue Oct 29 10:59:04 2024 +0100
+++ b/LPCExtension.py Mon Nov 11 15:33:01 2024 +0100
@@ -7,7 +7,7 @@
-from POULibrary import SimplePOULibraryFactory
+from POULibrary import SimplePOULibraryFactory, UserAddressedException from LPCArch import GetLPCProduct, GetLPCSOM, WX_GOT_modules, SOM28_modules, SOM6_modules, SVG_GOT_modules, GetLPCArch, PREEMPTSOM6_modules
# _lpcmanager_path, arch, etc are defined here because
@@ -64,6 +64,27 @@
return WAMP._WAMP_connector_factory(WampSession, *args, **kwargs)
connectors.connectors["WAMP"] = lambda:CustomWAMPFactory
+from erpc_interface.erpc_PLCObject.client import BeremizPLCObjectServiceClient +def JsonMethodProxyFactory(ExtendedCallName): + def JsonMethodProxy(self, *args, **kwargs): + outputbin = self.ExtendedCall(ExtendedCallName, json.dumps([args, kwargs]).encode()) + jsonoutput = json.loads(outputbin) + if type(jsonoutput) == list and len(jsonoutput) == 2: + result, error = jsonoutput + raise UserAddressedException(error) + raise Exception("Invalid input for " + ExtendedCallName) +LPCManagerExtendedCalls = ["CheckProductID", "GetVersions"] +for ExtendedCall in LPCManagerExtendedCalls: + setattr(BeremizPLCObjectServiceClient, ExtendedCall, JsonMethodProxyFactory(ExtendedCall)) # from LPCconnector import LPC_connector_factory
# connectors.connectors["LPC"] = lambda: LPC_connector_factory