<< Click to Display Table of Contents > 

Client Control Interface Manual > Implementation > COM (CCI Ex)

COM (CCI Ex)
Previous pageReturn to chapter overviewNext page

1.COM CCI Function Commands via Function Calls

 

CCI_FunctionCommandsViaFunctionCalls

SAMLight can be controlled by a CCI application running on the same PC:

SAMLight → Settings → System → Remote → Function Calls must be enabled.

The client application can use all Function commands, see DLL Commands.

 

2.COM CCI Function commands via TCP

 

CCI_FunctionCommandsViaTCP

SAMLight can be controlled by a CCI application running on a different PC. The SAM DLL (included in the SAMLight installer must be installed on the remote controlling PC, meaning that both system need to be a Windows PC.

Both Windows PCs are connected via TCP (Ethernet).

SAMLight → Settings → System → Remote:

oTCP must be enabled.

oIP Address must be one of the available IP addresses of the PC on which SAMLight is running and is independent of the IP of the sender of the CCI commands. Use 0.0.0.0 to allow remote control from any IP or 127.0.0.1 for local host.

The client application can use all Function commands, see DLL Commands.

If MultiInstance is used with two or more instances of SAMLight which should be controlled by one CCI application, different TCP connections (127.0.0.1, different Ports) have to be set in every instance of SAMLight together with two or more SAMLight Client Control OCX with different names in the CCI application. If just one TCP connection is closed by ScCloseEthernetConnection(), then TCP mode is also getting disabled and CCI switches to function call mode, which could lead to incorrect CCI function return values. So it is better to close all TCP connection and eventually reopen them all again.

 

Steps for the custom program to use COM (CCI Ex) CCI:

Initialize COM

Create instance of SCAPS.ScSamlightClientCtrlEx object

If TCP, connect via ScOpenTCPConnection

Call desired functions

note

For the COM (CCI Ex) Mode, there will be no CCI_Return for set and get functions. The returns are HRESULTS in the case of any exceptions.

Figure 2 illustrates how to use SCAPS.ScSamlightClientCtrlEx with Microsoft Visual Studio: SAMLight Client Control Ex is added via Reference.

The SAMLight Client Control Ex interface uses the same SAMLight Client Control commands and constants but offers a more detailed error return value for each command.

Please start at the References at the left side and follow the red arrows.

SAMLight_Client_Control_Ex

Figure 2: CCI COM implementation for C# in Microsoft Visual Studio

Error code

Description

0x80040200

Please inform SCAPS by email: info@scaps.com

0x80040201

An event could not call a subscriber: SAMLight not available

0x80040202

TCP timed out

0x80040211

No entity with this name found

0x80040212

Job is empty

0x80040213

Function returned 0 (not ok)

0x80040214

Not allowed in SAM3D mode

0x80040215

No outline because the entities are empty

0x80040216

No valid license

Table 415: CCI COM (CCI Ex) HRESULT error codes

Under C#, if one of these HRESULT are returned by a ScSamlightClientCtrlEx function, the C# RCW (runtime callable wrapper) of the function converts this error (facility ITF) into a corresponding .Net COM Exception, containing the information above.

The maximum size of individual strings in TCP mode is 511 characters.

Note on versions: SAMLight Client Control Ex with Ex for Extended, included since version 3.5.5 build 0002: 32 bit version sc_ex_samlight_client_ctrl.dll and 64 bit version sc_ex64_samlight_client_ctrl.dll.