--- a/.github/workflows/run_tests_in_docker.yml Tue Nov 19 23:52:04 2024 +0100
+++ b/.github/workflows/run_tests_in_docker.yml Fri Nov 22 16:31:51 2024 +0100
@@ -38,8 +38,8 @@
- uses: actions/checkout@v3
with:
repository: EmbeddedRPC/erpc
- # v1.12.0
- ref: 85d3dd8656ccce4c2d929a69484fb8d88ec6c6c3
+ # v1.13.0
+ ref: 90ae2314d9f495ad2a3678a2fb82ac327ea2f134
path: erpc
- name: Restore cached docker image
--- a/C_runtime/PLCObject.cpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/PLCObject.cpp Fri Nov 22 16:31:51 2024 +0100
@@ -675,3 +675,13 @@
"TraceThreadProc ended normally");
}
+uint32_t PLCObject::ExtendedCall(const char * method, const binary_t * argument, binary_t * answer)
+{
+ // TODO
+
+ answer->data = (uint8_t*)"";
+ answer->dataLength = 0;
+
+ return 0;
+}
+
--- a/C_runtime/PLCObject.hpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/PLCObject.hpp Fri Nov 22 16:31:51 2024 +0100
@@ -71,6 +71,7 @@
uint32_t SetTraceVariablesList(const list_trace_order_1_t * orders, int32_t * debugtoken);
uint32_t StartPLC(void);
uint32_t StopPLC(bool * success);
+ uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer);
// Public interface used by runtime
uint32_t AutoLoad();
--- a/C_runtime/c_erpc_PLCObject_client.cpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/c_erpc_PLCObject_client.cpp Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
@@ -132,6 +132,14 @@
return result;
}
+uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer)
+{
+ uint32_t result;
+ result = s_BeremizPLCObjectService_client->ExtendedCall(method, argument, answer);
+
+ return result;
+}
+
void initBeremizPLCObjectService_client(erpc_client_t client)
{
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
--- a/C_runtime/c_erpc_PLCObject_client.h Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/c_erpc_PLCObject_client.h Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
@@ -38,6 +38,7 @@
kBeremizPLCObjectService_SetTraceVariablesList_id = 12,
kBeremizPLCObjectService_StartPLC_id = 13,
kBeremizPLCObjectService_StopPLC_id = 14,
+ kBeremizPLCObjectService_ExtendedCall_id = 15,
};
//! @name BeremizPLCObjectService
@@ -69,6 +70,8 @@
uint32_t StartPLC(void);
uint32_t StopPLC(bool * success);
+
+uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer);
//@}
#endif // ERPC_FUNCTIONS_DEFINITIONS
--- a/C_runtime/c_erpc_PLCObject_server.cpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/c_erpc_PLCObject_server.cpp Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
@@ -132,6 +132,14 @@
return result;
}
+
+ uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer)
+ {
+ uint32_t result;
+ result = ::ExtendedCall(method, argument, answer);
+
+ return result;
+ }
};
ERPC_MANUALLY_CONSTRUCTED_STATIC(BeremizPLCObjectService_service, s_BeremizPLCObjectService_service);
--- a/C_runtime/c_erpc_PLCObject_server.h Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/c_erpc_PLCObject_server.h Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
@@ -39,6 +39,7 @@
kBeremizPLCObjectService_SetTraceVariablesList_id = 12,
kBeremizPLCObjectService_StartPLC_id = 13,
kBeremizPLCObjectService_StopPLC_id = 14,
+ kBeremizPLCObjectService_ExtendedCall_id = 15,
};
//! @name BeremizPLCObjectService
@@ -70,6 +71,8 @@
uint32_t StartPLC(void);
uint32_t StopPLC(bool * success);
+
+uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer);
//@}
--- a/C_runtime/erpc_PLCObject_client.cpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/erpc_PLCObject_client.cpp Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
@@ -1213,3 +1213,74 @@
return result;
}
+
+// BeremizPLCObjectService interface ExtendedCall function client shim.
+uint32_t BeremizPLCObjectService_client::ExtendedCall(const char * method, const binary_t * argument, binary_t * answer)
+{
+ erpc_status_t err = kErpcStatus_Success;
+
+ uint32_t result;
+
+#if ERPC_PRE_POST_ACTION
+ pre_post_action_cb preCB = m_clientManager->getPreCB();
+ if (preCB)
+ {
+ preCB();
+ }
+#endif
+
+ // Get a new request.
+ RequestContext request = m_clientManager->createRequest(false);
+
+ // Encode the request.
+ Codec * codec = request.getCodec();
+
+ if (codec == NULL)
+ {
+ err = kErpcStatus_MemoryError;
+ }
+ else
+ {
+ codec->startWriteMessage(message_type_t::kInvocationMessage, m_serviceId, m_ExtendedCallId, request.getSequence());
+
+ {
+ uint32_t method_len = strlen((const char*)method);
+
+ codec->writeString(method_len, (const char*)method);
+ }
+
+ write_binary_t_struct(codec, argument);
+
+ // Send message to server
+ // Codec status is checked inside this function.
+ m_clientManager->performRequest(request);
+
+ read_binary_t_struct(codec, answer);
+
+ codec->read(result);
+
+ err = codec->getStatus();
+ }
+
+ // Dispose of the request.
+ m_clientManager->releaseRequest(request);
+
+ // Invoke error handler callback function
+ m_clientManager->callErrorHandler(err, m_ExtendedCallId);
+
+#if ERPC_PRE_POST_ACTION
+ pre_post_action_cb postCB = m_clientManager->getPostCB();
+ if (postCB)
+ {
+ postCB();
+ }
+#endif
+
+
+ if (err != kErpcStatus_Success)
+ {
+ result = 0xFFFFFFFFU;
+ }
+
+ return result;
+}
--- a/C_runtime/erpc_PLCObject_client.hpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/erpc_PLCObject_client.hpp Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
@@ -50,6 +50,8 @@
virtual uint32_t StopPLC(bool * success);
+ virtual uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer);
+
protected:
erpc::ClientManager *m_clientManager;
};
--- a/C_runtime/erpc_PLCObject_common.h Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/erpc_PLCObject_common.h Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
--- a/C_runtime/erpc_PLCObject_common.hpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/erpc_PLCObject_common.hpp Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
--- a/C_runtime/erpc_PLCObject_interface.cpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/erpc_PLCObject_interface.cpp Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
--- a/C_runtime/erpc_PLCObject_interface.hpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/erpc_PLCObject_interface.hpp Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
@@ -33,6 +33,7 @@
static const uint8_t m_SetTraceVariablesListId = 12;
static const uint8_t m_StartPLCId = 13;
static const uint8_t m_StopPLCId = 14;
+ static const uint8_t m_ExtendedCallId = 15;
virtual ~BeremizPLCObjectService_interface(void);
@@ -63,6 +64,8 @@
virtual uint32_t StartPLC(void) = 0;
virtual uint32_t StopPLC(bool * success) = 0;
+
+ virtual uint32_t ExtendedCall(const char * method, const binary_t * argument, binary_t * answer) = 0;
private:
};
} // erpcShim
--- a/C_runtime/erpc_PLCObject_server.cpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/erpc_PLCObject_server.cpp Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
@@ -501,6 +501,12 @@
break;
}
+ case BeremizPLCObjectService_interface::m_ExtendedCallId:
+ {
+ erpcStatus = ExtendedCall_shim(codec, messageFactory, transport, sequence);
+ break;
+ }
+
default:
{
erpcStatus = kErpcStatus_InvalidArgument;
@@ -1313,3 +1319,92 @@
return err;
}
+
+// Server shim for ExtendedCall of BeremizPLCObjectService interface.
+erpc_status_t BeremizPLCObjectService_service::ExtendedCall_shim(Codec * codec, MessageBufferFactory *messageFactory, Transport * transport, uint32_t sequence)
+{
+ erpc_status_t err = kErpcStatus_Success;
+
+ char * method = NULL;
+ binary_t *argument = NULL;
+ argument = (binary_t *) erpc_malloc(sizeof(binary_t));
+ if (argument == NULL)
+ {
+ codec->updateStatus(kErpcStatus_MemoryError);
+ }
+ binary_t *answer = NULL;
+ uint32_t result;
+
+ // startReadMessage() was already called before this shim was invoked.
+
+ {
+ uint32_t method_len;
+ char * method_local;
+ codec->readString(method_len, &method_local);
+ method = (char*) erpc_malloc((method_len + 1) * sizeof(char));
+ if ((method == NULL) || (method_local == NULL))
+ {
+ codec->updateStatus(kErpcStatus_MemoryError);
+ }
+ else
+ {
+ memcpy(method, method_local, method_len);
+ (method)[method_len] = 0;
+ }
+ }
+
+ read_binary_t_struct(codec, argument);
+
+ answer = (binary_t *) erpc_malloc(sizeof(binary_t));
+ if (answer == NULL)
+ {
+ codec->updateStatus(kErpcStatus_MemoryError);
+ }
+
+ err = codec->getStatus();
+ if (err == kErpcStatus_Success)
+ {
+ // Invoke the actual served function.
+#if ERPC_NESTED_CALLS_DETECTION
+ nestingDetection = true;
+#endif
+ result = m_handler->ExtendedCall(method, argument, answer);
+#if ERPC_NESTED_CALLS_DETECTION
+ nestingDetection = false;
+#endif
+
+ // preparing MessageBuffer for serializing data
+ err = messageFactory->prepareServerBufferForSend(codec->getBufferRef(), transport->reserveHeaderSize());
+ }
+
+ if (err == kErpcStatus_Success)
+ {
+ // preparing codec for serializing data
+ codec->reset(transport->reserveHeaderSize());
+
+ // Build response message.
+ codec->startWriteMessage(message_type_t::kReplyMessage, BeremizPLCObjectService_interface::m_serviceId, BeremizPLCObjectService_interface::m_ExtendedCallId, sequence);
+
+ write_binary_t_struct(codec, answer);
+
+ codec->write(result);
+
+ err = codec->getStatus();
+ }
+
+ erpc_free(method);
+
+ if (argument)
+ {
+ free_binary_t_struct(argument);
+ }
+ erpc_free(argument);
+
+ if (answer)
+ {
+ free_binary_t_struct(answer);
+ }
+ erpc_free(answer);
+
+ return err;
+}
--- a/C_runtime/erpc_PLCObject_server.hpp Tue Nov 19 23:52:04 2024 +0100
+++ b/C_runtime/erpc_PLCObject_server.hpp Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
/*
- * Generated by erpcgen 1.12.0 on Mon May 20 17:54:19 2024.
+ * Generated by erpcgen 1.12.0 on Mon Oct 28 15:10:14 2024.
*
* AUTOGENERATED - DO NOT EDIT
*/
@@ -80,6 +80,9 @@
/*! @brief Server shim for StopPLC of BeremizPLCObjectService interface. */
erpc_status_t StopPLC_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence);
+
+ /*! @brief Server shim for ExtendedCall of BeremizPLCObjectService interface. */
+ erpc_status_t ExtendedCall_shim(erpc::Codec * codec, erpc::MessageBufferFactory *messageFactory, erpc::Transport * transport, uint32_t sequence);
};
} // erpcShim
--- a/ProjectController.py Tue Nov 19 23:52:04 2024 +0100
+++ b/ProjectController.py Fri Nov 22 16:31:51 2024 +0100
@@ -1918,6 +1918,10 @@
# Oups.
self.logger.write_error(_("Connection failed to %s!\n") % uri)
else:
+ VersionsInfoBytes = self._connector.ExtendedCall("GetVersions", bytes())
+ if VersionsInfoBytes is not None:
+ VersionsInfo = VersionsInfoBytes.decode()
+ self.logger.write(f"Version string: {VersionsInfo}\n")
self.CompareLocalAndRemotePLC()
# Init with actual PLC status and print it
--- a/connectors/ERPC/__init__.py Tue Nov 19 23:52:04 2024 +0100
+++ b/connectors/ERPC/__init__.py Fri Nov 22 16:31:51 2024 +0100
@@ -62,6 +62,7 @@
"SeedBlob":ReturnAsLastOutput,
"SetTraceVariablesList": ReturnAsLastOutput,
"StopPLC":ReturnAsLastOutput,
+ "ExtendedCall":ReturnAsLastOutput,
}
ArgsWrappers = {
--- a/erpc_interface/__init__.py Tue Nov 19 23:52:04 2024 +0100
+++ b/erpc_interface/__init__.py Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
#
-# Generated by erpcgen 1.12.0 on Mon May 20 17:53:37 2024.
+# Generated by erpcgen 1.13.0 on Fri Nov 8 11:06:24 2024.
#
# AUTOGENERATED - DO NOT EDIT
#
--- a/erpc_interface/erpc_PLCObject.erpc Tue Nov 19 23:52:04 2024 +0100
+++ b/erpc_interface/erpc_PLCObject.erpc Fri Nov 22 16:31:51 2024 +0100
@@ -61,11 +61,11 @@
MatchMD5(in string MD5, out bool match) -> uint32
NewPLC(in string md5sum, in binary plcObjectBlobID, in list<extra_file> extrafiles, out bool success) -> uint32
PurgeBlobs() -> uint32
- /* NOT TO DO : RemoteExec(in ) -> uint32 */
RepairPLC() -> uint32
ResetLogCount() -> uint32
SeedBlob(in binary seed, out binary blobID) -> uint32
SetTraceVariablesList(in list<trace_order> orders, out int32 debugtoken) -> uint32
StartPLC() -> uint32
StopPLC(out bool success) -> uint32
+ ExtendedCall(in string method, in binary argument, out binary answer ) -> uint32
}
--- a/erpc_interface/erpc_PLCObject/__init__.py Tue Nov 19 23:52:04 2024 +0100
+++ b/erpc_interface/erpc_PLCObject/__init__.py Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
#
-# Generated by erpcgen 1.12.0 on Mon May 20 17:53:37 2024.
+# Generated by erpcgen 1.13.0 on Fri Nov 8 11:06:24 2024.
#
# AUTOGENERATED - DO NOT EDIT
#
@@ -9,8 +9,8 @@
version = erpc_version.ERPC_VERSION
except ImportError:
version = "unknown"
-if version != "1.12.0":
- raise ValueError("The generated shim code version (1.12.0) is different to the rest of eRPC code (%s). \
+if version != "1.13.0":
+ raise ValueError("The generated shim code version (1.13.0) is different to the rest of eRPC code (%s). \
Install newer version by running \"python setup.py install\" in folder erpc/erpc_python/." % repr(version))
from . import common
--- a/erpc_interface/erpc_PLCObject/client.py Tue Nov 19 23:52:04 2024 +0100
+++ b/erpc_interface/erpc_PLCObject/client.py Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
#
-# Generated by erpcgen 1.12.0 on Mon May 20 17:53:37 2024.
+# Generated by erpcgen 1.13.0 on Fri Nov 8 11:06:24 2024.
#
# AUTOGENERATED - DO NOT EDIT
#
@@ -292,4 +292,28 @@
_result = codec.read_uint32()
return _result
-
+ def ExtendedCall(self, method, argument, answer):
+ assert type(answer) is erpc.Reference, "out parameter must be a Reference object"
+
+ # Build remote function invocation message.
+ request = self._clientManager.create_request()
+ codec = request.codec
+ codec.start_write_message(erpc.codec.MessageInfo(
+ type=erpc.codec.MessageType.kInvocationMessage,
+ service=self.SERVICE_ID,
+ request=self.EXTENDEDCALL_ID,
+ sequence=request.sequence))
+ if method is None:
+ raise ValueError("method is None")
+ codec.write_string(method)
+ if argument is None:
+ raise ValueError("argument is None")
+ codec.write_binary(argument)
+
+ # Send request and process reply.
+ self._clientManager.perform_request(request)
+ answer.value = codec.read_binary()
+ _result = codec.read_uint32()
+ return _result
+
+
--- a/erpc_interface/erpc_PLCObject/common.py Tue Nov 19 23:52:04 2024 +0100
+++ b/erpc_interface/erpc_PLCObject/common.py Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
#
-# Generated by erpcgen 1.12.0 on Mon May 20 17:53:37 2024.
+# Generated by erpcgen 1.13.0 on Fri Nov 8 11:06:24 2024.
#
# AUTOGENERATED - DO NOT EDIT
#
--- a/erpc_interface/erpc_PLCObject/interface.py Tue Nov 19 23:52:04 2024 +0100
+++ b/erpc_interface/erpc_PLCObject/interface.py Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
#
-# Generated by erpcgen 1.12.0 on Mon May 20 17:53:37 2024.
+# Generated by erpcgen 1.13.0 on Fri Nov 8 11:06:24 2024.
#
# AUTOGENERATED - DO NOT EDIT
#
@@ -21,6 +21,7 @@
SETTRACEVARIABLESLIST_ID = 12
STARTPLC_ID = 13
STOPPLC_ID = 14
+ EXTENDEDCALL_ID = 15
def AppendChunkToBlob(self, data, blobID, newBlobID):
raise NotImplementedError()
@@ -64,4 +65,7 @@
def StopPLC(self, success):
raise NotImplementedError()
+ def ExtendedCall(self, method, argument, answer):
+ raise NotImplementedError()
+
--- a/erpc_interface/erpc_PLCObject/server.py Tue Nov 19 23:52:04 2024 +0100
+++ b/erpc_interface/erpc_PLCObject/server.py Fri Nov 22 16:31:51 2024 +0100
@@ -1,5 +1,5 @@
#
-# Generated by erpcgen 1.12.0 on Mon May 20 17:53:37 2024.
+# Generated by erpcgen 1.13.0 on Fri Nov 8 11:06:24 2024.
#
# AUTOGENERATED - DO NOT EDIT
#
@@ -27,6 +27,7 @@
interface.IBeremizPLCObjectService.SETTRACEVARIABLESLIST_ID: self._handle_SetTraceVariablesList,
interface.IBeremizPLCObjectService.STARTPLC_ID: self._handle_StartPLC,
interface.IBeremizPLCObjectService.STOPPLC_ID: self._handle_StopPLC,
+ interface.IBeremizPLCObjectService.EXTENDEDCALL_ID: self._handle_ExtendedCall,
}
def _handle_AppendChunkToBlob(self, sequence, codec):
@@ -348,4 +349,29 @@
codec.write_bool(success.value)
codec.write_uint32(_result)
-
+ def _handle_ExtendedCall(self, sequence, codec):
+ # Create reference objects to pass into handler for out/inout parameters.
+ answer = erpc.Reference()
+
+ # Read incoming parameters.
+ method = codec.read_string()
+ argument = codec.read_binary()
+
+ # Invoke user implementation of remote function.
+ _result = self._handler.ExtendedCall(method, argument, answer)
+
+ # Prepare codec for reply message.
+ codec.reset()
+
+ # Construct reply message.
+ codec.start_write_message(erpc.codec.MessageInfo(
+ type=erpc.codec.MessageType.kReplyMessage,
+ service=interface.IBeremizPLCObjectService.SERVICE_ID,
+ request=interface.IBeremizPLCObjectService.EXTENDEDCALL_ID,
+ sequence=sequence))
+ if answer.value is None:
+ raise ValueError("answer.value is None")
+ codec.write_binary(answer.value)
+ codec.write_uint32(_result)
+
+
--- a/requirements.txt Tue Nov 19 23:52:04 2024 +0100
+++ b/requirements.txt Fri Nov 22 16:31:51 2024 +0100
@@ -11,9 +11,8 @@
click==8.1.3
constantly==15.1.0
contourpy==1.0.7
-cryptography==40.0.2
cycler==0.11.0
-erpc==1.12.0
+erpc==1.13.0
fonttools==4.39.3
gattrdict==2.0.1
hyperlink==21.0.0
--- a/runtime/PLCObject.py Tue Nov 19 23:52:04 2024 +0100
+++ b/runtime/PLCObject.py Fri Nov 22 16:31:51 2024 +0100
@@ -103,6 +103,9 @@
self.PlcStopped.set()
self._init_blobs()
+
+ # initialize extended calls with GetVersions call, ignoring arguments
+ self.extended_calls = {"GetVersions":lambda *_args:self.GetVersions().encode()}
# First task of worker -> no @RunInMain
def AutoLoad(self, autostart):
@@ -818,16 +821,17 @@
self.TraceThread = None
- def RemoteExec(self, script, *kwargs):
- try:
- exec(script, kwargs)
- except Exception:
- _e_type, e_value, e_traceback = sys.exc_info()
- line_no = traceback.tb_lineno(get_last_traceback(e_traceback))
- return (-1, "RemoteExec script failed!\n\nLine %d: %s\n\t%s" %
- (line_no, e_value, script.splitlines()[line_no - 1]))
- return (0, kwargs.get("returnVal", None))
-
def GetVersions(self):
return platform_module.system() + " " + platform_module.release()
+ @RunInMain
+ def ExtendedCall(self, method, argument):
+ """ Dispatch argument to registered service """
+ return self.extended_calls[method](argument)
+
+ def RegisterExtendedCall(self, method, callback):
+ self.extended_calls[method] = callback
+
+ def UnregisterExtendedCall(self, method):
+ del self.extended_calls[method]
+
--- a/runtime/eRPCServer.py Tue Nov 19 23:52:04 2024 +0100
+++ b/runtime/eRPCServer.py Fri Nov 22 16:31:51 2024 +0100
@@ -47,6 +47,7 @@
"SeedBlob":ReturnAsLastOutput,
"SetTraceVariablesList": ReturnAsLastOutput,
"StopPLC":ReturnAsLastOutput,
+ "ExtendedCall":ReturnAsLastOutput,
}
ArgsWrappers = {
@@ -59,7 +60,7 @@
lambda orders : ([(order.idx, None if len(order.force)==0 else bytes(order.force)) for order in orders],)
}
-def rpc_wrapper(method_name):
+def rpc_wrapper(method_name, server):
PLCobj = PLC()
method=getattr(PLCobj, method_name)
args_wrapper = ArgsWrappers.get(method_name, lambda *x:x)
@@ -72,7 +73,8 @@
return 0
except Exception as e:
print(traceback.format_exc())
- PLCobj.LogMessage(CRITICAL_LOG_LEVEL, f'eRPC call {method_name} Exception "{str(e)}"')
+ PLCobj.LogMessage(LogLevelsDict["CRITICAL"], f'eRPC call {method_name} Exception "{str(e)}"')
+ server.transport.close()
raise
return exception_wrapper
@@ -109,7 +111,7 @@
handler = type(
"PLCObjectServiceHandlder",
(IBeremizPLCObjectService,),
- {name: rpc_wrapper(name)
+ {name: rpc_wrapper(name, self)
for name,_func in getmembers(IBeremizPLCObjectService, isfunction)})()
service = BeremizPLCObjectServiceService(handler)