beckhoff TE1000 TwinCAT 3 — 5.33.2.2 ITcModuleInstance2::SetModuleContext

API | ITcModuleInstance 5.33.2 ITcModuleInstance2 | ITcModuleInstance2 Inherits from: ITcModuleInstance ITcModuleInstance2 adds context-based access and readable names for module instances. Contexts are validated against the context IDs and target tasks defined in the module. For fieldbus boxes and process images, these additional members primarily return E_NOTIMPL . In addition to the target OID, a context also contains the ADS port, priority, cycle time, and sort order. Properties Methods 5.33.2.1 ITcModuleInstance2::GetModuleContext | ITcModuleInstance2::GetModuleContext Searches for the context ID in the module and returns the currently stored target object ID.

Additional context data, such as the ADS port, priority, or cycle time, is not exposed via this API. Signature HRESULT GetModuleContext(UINT index, ULONG* pOid); Parameter Return value Error codes E_INVALIDARG : The context ID does not exist. E_NOTIMPL : This specific element type does not support context access. 5.33.2.2 ITcModuleInstance2::SetModuleContext | ITcModuleInstance2::SetModuleContext Searches for the context ID in the module and accepts the passed object ID only if it belongs to a valid target task of that context. When a change is made, the stored target object ID is updated and the element is marked as changed.

Signature HRESULT SetModuleContext(UINT index, ULONG poid); TE1000 140 Version: 1.7.0 Property Type get/set Description ModuleTypeName BSTR* get Name of the TCom module type. ModuleInstanceName BSTR* get Name of the module instance. Method Description SetModuleContext Sets the target context of a module instance. GetModuleContext Reads the target context of a module instance. Name Type Description index UINT [in] Context ID. Name Type Description pOid ULONG* [out] Object ID of the set context. (HRESULT) HRESULT S OK if successful, otherwise an error code. _