<< Click to Display Table of Contents > 

Client Control Interface Manual > Application > Async Mode

Async Mode
Previous pageReturn to chapter overviewNext page

The async mode allows the CCI thread of the CCI program to continue without waiting for return values of SAMLight. It does not allow a parallelization of CCI commands, the commands still have to be sent sequentially. A better alternative to the async mode is if the CCI program has several threads and the CCI part takes place in its own thread.

 

Async Mode Enable

Set

Get

DLL Function

int CCI_Return = ScSetLongValue(int Value_Type, int Parameter)

int Parameter = ScGetLongValue(int Value_Type)

ASCII Function

int CCI_Return = ScCciSetLongValue(int Value_Type, int Parameter)

int Parameter = ScCciGetLongValue(int Value_Type)

Description

Set or get the status of async mode.

Value_Type

Type: int

ID:

Location: ScComSAMLightClientCtrlValueTypes

scComSAMLightClientCtrlLongValueTypeClientCtrlAsyncMode

28

Parameter

Type: int

Unit: none

0: Async mode disabled.

1: Async mode enabled.

CCI_Return

Type: int

CCI return number, see error list.

Notes

Async supported commands are listed in DoubleValue Async, LongValue Async and StringValue Async.

C# Example: Enable async mode:

 

int CCI_Return = cci.ScSetLongValue( ( int )ScComSAMLightClientCtrlValueTypes.scComSAMLightClientCtrlLongValueTypeClientCtrlAsyncMode, 1 );

Table 22: Async Mode Enable

Async Status

Set

Get

DLL Function

int Parameter = ScGetLongValue(int Value_Type)

ASCII Function

int Parameter = ScCciGetLongValue(int Value_Type)

Description

Check if prior async CCI command is completed.

Value_Type

Type: int

ID:

Location: ScComSAMLightClientCtrlValueTypes

scComSAMLightClientCtrlLongValueTypeClientCtrlAsyncModeIsRunning

29

Parameter

Type: int

Unit: none

0: Async CCI command is completed.

1: Async CCI command is executing.

CCI_Return

Type: int

CCI return number, see error list.

Notes

Async mode must be enabled.

Async supported commands are listed in DoubleValue Async, LongValue Async and StringValue Async.

C# Example: Check if async CCI command is executing:

 

int Aync_Command_Is_Running = cci.ScGetLongValue( ( int )ScComSAMLightClientCtrlValueTypes.scComSAMLightClientCtrlLongValueTypeClientCtrlAsyncModeIsRunning );

Table 23: Async Status

DoubleValue Async

Set

Get

DLL Function

double Parameter = ScGetDoubleValue(int Value_Type)

ASCII Function

double Parameter = ScCciGetDoubleValue(int Value_Type)

Description

Get double value of async CCI command. Supported commands:

ScGetEntityOutline

Value_Type

Type: int

ID:

Location: ScComSAMLightClientCtrlValueTypes

scComSAMLightClientCtrlDoubleValueTypeAsyncModeResult

63

Parameter

Type: double

Unit: depends on async cci command

Double value.

Notes

Async mode must be enabled.

C# Example: Async ScGetEntityOutline:

 

// With enabled async mode the CCI commmand returns immediately without returning an answer.

double dummy = cci.ScGetEntityOutline( "Circle", 0 );

do

{

  // Your operations while async CCI command executes.

}

// Check if cci command is completed.

while( cci.ScGetLongValue( ( int )ScComSAMLightClientCtrlValueTypes.scComSAMLightClientCtrlLongValueTypeClientCtrlAsyncModeIsRunning ) != 0 );

// Get the return double value of async CCI command.

double Entity_Outline = cci.ScGetDoubleValue( ( int )ScComSAMLightClientCtrlValueTypes.scComSAMLightClientCtrlDoubleValueTypeAsyncModeResult );

Table 24: DoubleValue Async

LongValue Async

Set

Get

DLL Function

int CCI_Return = ScGetLongValue(int Value_Type)

ASCII Function

int CCI_Return = ScCciGetLongValue(int Value_Type)

Description

Get CCI return of async CCI command. Supported commands:

ScExecCommand

ScImport

ScLoadJob

ScMarkEntityByName

ScRotateEntity

ScScaleEntity

ScTranslateEntity

Value_Type

Type: int

ID:

Location: ScComSAMLightClientCtrlValueTypes

scComSAMLightClientCtrlLongValueTypeClientCtrlAsyncModeResult

30

CCI_Return

Type: int

CCI return number, see error list.

Notes

Async mode must be enabled.

C# Example: Async ScExecCommand:

 
// With enabled async mode the CCI commmand returns immediately without returning an answer.

int dummy = cci.ScExecCommand( ( int )ScComSAMLightClientCtrlExecCommandConstants.scComSAMLightClientCtrlExecCommandNewJob );

do

{

  // Your operations while async CCI command executes.

}

// Check if cci command is completed.

while( cci.ScGetLongValue( ( int )ScComSAMLightClientCtrlValueTypes.scComSAMLightClientCtrlLongValueTypeClientCtrlAsyncModeIsRunning ) != 0 );

// Get the integer cci return of async CCI command.

int CCI_Return = cci.ScGetLongValue( ( int )ScComSAMLightClientCtrlValueTypes.scComSAMLightClientCtrlLongValueTypeClientCtrlAsyncModeResult );

Table 25: LongValue Async

StringValue Async

Set

Get

DLL Function

int CCI_Return = ScGetStringValue(int Value_Type, ref string Parameter)

ASCII Function

string Parameter = ScCciGetStringValue(int Value_Type)

Description

Get string value of async CCI command. Supported commands:

ScGetStringValue

Value_Type

Type: int

ID:

Location: ScComSAMLightClientCtrlValueTypes

scComSAMLightClientCtrlLongValueTypeClientCtrlAsyncModeResult

18

Parameter

Type: string

Unit: none

String value.

CCI_Return

Type: int

CCI return number, see error list.

Notes

Async mode must be enabled.

C# Example: Async ScGetStringValue:

 

string dummy_01 = "";

// With enabled async mode the CCI commmand returns immediately without returning an answer.

int dummy_02 = cci.ScGetStringValue( ( int )ScComSAMLightClientCtrlValueTypes.scComSAMLightClientCtrlStringValueTypeCorrectionFile, ref dummy_01 );

do

{

  // Your operations while async CCI command executes.

}

// Check if cci command is completed.

while( cci.ScGetLongValue( ( int )ScComSAMLightClientCtrlValueTypes.scComSAMLightClientCtrlLongValueTypeClientCtrlAsyncModeIsRunning ) != 0 );

// Get the return string of async CCI command.

string Corr_File = "";

int CCI_Return = cci.ScGetStringValue( ( int )ScComSAMLightClientCtrlValueTypes.scComSAMLightClientCtrlStringValueTypeAsyncModeResult, ref Corr_File );

Table 26: StringValue Async