<< 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_Overview_FunctionCalls

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_Overview_TCP

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

The possible HRESULT function error return values for more detailed error analysis are:

COM CCI HRESULT

Name

Description

0x80040200

Unknown error

please inform SCAPS by e-mail: info@scaps.com

0x80040201

IDispatch error #1

an event could not call a subscriber: Samlight unavailable

0x80040202

IDispatch error #2

tcp timed out

0x80040211

IDispatch error #17

no named entity found

0x80040212

IDispatch error #18

job is empty

0x80040213

IDispatch error #19

function returned 0 ( not ok )

0x80040214

IDispatch error #20

not allowed in 3D mode

0x80040215

IDispatch error #21

no outline because entities are empty

0x80040216

IDispatch error #22

no valid license

Table 392: COM CCI HRESULT function error return values

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.