ScriptCasScriptProjectExtension

class ScriptCasScriptProjectExtension.CasScriptProjectExtension

Bases: ScriptProject

All ScriptProject instances are extended with this member, to provide access to the cas connector functionality.

Note

Only available if the “CODESYS Automation Server Connector” Plugin and the “CODESYS Script Engine” package including the “Projects” script driver are installed!

property cas: CasScriptProjectImplementation

Provides access to the Automation Server specific functionality for ScriptProject instances, provided by CasScriptProjectImplementation.

Return type:

bool

Returns:

True if the project is connected to the cas, and False if the projects not connected.

class ScriptCasScriptProjectExtension.CasReferenceInfo

Bases: object

Information about the project connection to the automation server

property server_url: str

The Url this project is connected to.

Return type:

str

property project_id: int

Gets the project identifier (primary key of the project on the server database.)

Return type:

int

property project_name: str

Gets the name of the project on the server, optional, for informative purposes.

Return type:

str

property commit_id: str

Gets the ID of the base commit.

This is the last commit from checkout, update or created during synchronization. (Primary key of the commit entity in the database.)

Return type:

int

property commit_message: str

Gets the commit message of the base commit, optional, for informative purposes.

Return type:

str

property project_file_hash: str

Gets a hash of the project file in the base commit on the server.

Return type:

str

class ScriptCasScriptProjectExtension.CasScriptProjectImplementation

Bases: object

Automation Server specific functionality for ScriptProject instances, can be accessed via the .cas property added by CasScriptProjectExtension.

Note

Only available if the “CODESYS Automation Server Connector” Plugin and the “CODESYS Script Engine” package including the “Projects” script driver are installed!

property is_connected: bool

Checks whether the project is connected to the automation server.

Return type:

bool

Returns:

True if the project is connected to the cas, and False if the projects not connected.

property cas_reference_info: CasReferenceInfo

Returns the CAS server reference information

Return type:

CasReferenceInfo | None

Returns:

The CasReferenceInfo or None if is_connected==False.

disconnect()

Disconnects the project from the CAS server.

connect(server_url, commit_message: str, project_name: str) CasReferenceInfo

Connects the current project to the automation server.

Parameters:
  • server_url (str | Uri) – The server URL or hostname

  • commit_message (str) – The commit message for the project on the server.

  • project_name (str) – The name of the new project to create on the server.

Return type:

CasReferenceInfo | None

Returns:

Returns the CAS server reference information containing the project_id and commit_id on the server.

Note

If there are any applications which cannot be handled by the server (as of this writing, examples are SIL3 safety applications, or applications for devices requiring compact download), they’ll be silently- skipped, and the remaining applications will be synchronized.

Note

Only allowed for projects where is_connected==False.

reconnect(server_url, commit_message: str, existing_project_id: int) CasReferenceInfo

Connects the current project to the automation server.

Parameters:
  • server_url (str | Uri) – The server URL or hostname

  • commit_message (str) – The commit message for the project on the server.

  • existing_project_id (int) – The ID of an existing project we want to commit to.

Return type:

CasReferenceInfo | None

Returns:

Returns the CAS server reference information containing the project_id and commit_id on the server.

Note

If there are any applications which cannot be handled by the server (as of this writing, examples are SIL3 safety applications, or applications for devices requiring compact download), they’ll be silently- skipped, and the remaining applications will be synchronized.

Note

Only allowed for projects where is_connected==False.

synchronize(commit_message: str) CasReferenceInfo

Synchronizes a connected project to the server.

Parameters:

commit_message (str) – The commit message for the project on the server.

Return type:

CasReferenceInfo | None

Returns:

Returns the CAS server reference information containing the project_id and commit_id on the server.

Note

If there are any applications which cannot be handled by the server (as of this writing, examples are SIL3 safety applications, or applications for devices requiring compact download), they’ll be silently- skipped, and the remaining applications will be synchronized.

Note

Only allowed for projects where is_connected==True.

update()

Updates a Project by fetching the newest commit available for this project on the server. Will close replace the primary project if an actual update is performed.

Return type:

ScriptProject | None

Returns:

The updated project, or None if there was no newer commit on the server.

Note

Only allowed for projects where is_connected==True.