mcConnectAsset()

Connects a MindSphere Asset with its counterpart on the MindSphere Server. If an asset is connected for the first time, the asset is onboarded.

Synopsis

int mcConnectAsset(uint assetId);

Parameters

Parameter Description
assetId Defines which asset is used for the connection process with the MindSphere Server.

Return Value

The function mcConnectAsset returns 0 when it was successfully executed and -1 if either arguments are missing, assetId does not exist or there is a problem when establishing a connection.

Errors

The function mcDeleteAsset returns 0 when it was successfully executed and -1 when arguments are missing. The errors of the MindSphere API are shown in the log viewer.

Description

Connects a MindSphere Asset with its counterpart on the MindSphere Server. If an asset is connected for the first time, the asset is onboarded. When using this function with an already onboarded MindSphere asset, the connection is re-established.

If this function is called with a MindSphere Asset (not containing a Configuration ID or empty Configuration ID - see MindSphere Configuration Panels), the structure of this MindSphere Asset is uploaded to the MindSphere Server.

No configuration ID means that the assigned variable does not contain a value and an empty configuration ID that an empty string was assigned to the configuration ID.

#uses "CtrlMindConnect"
#uses "classes/mindSphere/MindSphereAsset"

void main()
{
  string dp = "NameOfMindSphereAsset"; // This MindSphere Asset must already exist in WinCC OA.
  uint assetId;
  int err = mcNewAsset(getMappingFromAssetDP(dp), assetId);
  if (err == 0)
  {
    err = mcConnectAsset(assetId);
    DebugTN(err);
  }
}

Assignment

MindSphere

Availability

UI