This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

IG::CIGI::Connector Class

Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Sim SDK edition to use it.
Header: #include <UnigineCIGIConnector.h>

IG::CIGI::Connector Class

Members


int init ( int version, const char * host, int send, int recv, int size = 1432 ) #

Initializes the CIGI Connector using the given parameters.

Arguments

  • int version - CIGI protocol version. One of the CIGI_VERSION_* values.
  • const char * host - CIGI Host address.
  • int send - TCP port number to be used for sending packets to the CIGI Host.
  • int recv - TCP port number to be used for receiving packets from the CIGI Host.
  • int size - Packet size. The default value is 1432.

Return value

1 if the CIGI Connector was initialized successfully; otherwise, 0.

int shutdown ( ) #

Returns a value indicating if the CIGI Connector was shutdown successfully.

Return value

1 if the CIGI Connector was shutdown successfully; otherwise, 0.

int isInitialized ( ) #

Returns a value indicating if the CIGI Connector was initialized successfully.

Return value

1 if the CIGI Connector was initialized successfully; otherwise, 0.

void setIGMode ( int mode ) #

Sets the current IG mode.

Arguments

int getIGMode ( ) #

Returns the current IG mode.

Return value

IG mode. One of the CIGI_MODE_* values.

void setIGStatus ( int status ) #

Sets the current IG status.

Arguments

  • int status - IG status. The following values are supported:
    • 0 - normal
    • 1-255 - an error has occurred

int getIGStatus ( ) #

Returns the current IG status.

Return value

IG status. The following values are supported:
  • 0 - normal
  • 1-255 - an error has occurred

int getInterpolation ( ) #

Returns a value indicating if interpolation and extrapolation are enabled.

Return value

1 if interpolation and extrapolation are enabled; otherwise, 0.

unsigned int getIGFrame ( ) #

Returns the number of the current frame for the IG.

Return value

Current IG frame number.

unsigned int getHostFrame ( ) #

Returns the number of the current frame for the Host.

Return value

Current Host frame number.

double getHostTime ( ) #

Returns the current Host time (with latency corrections).

Return value

Current Host time, in seconds.

double getLastReceivedHostTime ( ) #

Returns the last received Host time.

Return value

Last received Host time, in seconds.

void * addConnectCallback ( Unigine::CallbackBase * func ) #

Adds a callback function to be fired when the Host has connected.

Arguments

Return value

ID of the last added connect callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool removeConnectCallback ( void * id ) #

Removes the specified callback from the list of Connect callbacks.

Arguments

  • void * id - Connect callback ID obtained when adding it.

Return value

True if the Connect callback with the given ID was removed successfully; otherwise false.

void * addReceivePacketCallback ( int cigi_opcode, Unigine::CallbackBase1 * func ) #

Sets a callback function to be fired when a packet of the specified type has been received from the Host.

Arguments

  • int cigi_opcode - CIGI data packet opcode. One of the CIGI_OPCODE_* values.
  • Unigine::CallbackBase1 * func - Callback pointer. The callback function must have the following signature:
    (Unigine::Plugins::IG::CIGI::CigiHostPacket *packet)

Return value

ID of the last added Receive Packet callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool removeReceivePacketCallback ( void * id ) #

Removes the specified callback from the list of Receive Packet callbacks.

Arguments

  • void * id - Receive Packet callback ID obtained when adding it.

Return value

True if the Receive Packet callback with the given ID was removed successfully; otherwise false.

void * addSendPacketCallback ( int cigi_opcode, Unigine::CallbackBase4 * func ) #

Sets a callback function to be fired right before sending a response to a request. This can be used to send additional data required by a host (e.g., velocities of the point of intersection for LOS/HAT queries which is useful in case of landing on a moving platform).

A callback function has the following signature:

(bool &ret, IG::CIGI::CigiIGPacket *response, IG::CIGI::CigiHostPacket *request, IG::IGIntersection *intersection)

  • ret - boolean value indicating if the packet is to be sent or not;
  • response - the packet to be sent;
  • request - request for which a packet is to be sent as a response (can be nullptr);
  • intersection - additional info on intersection (if necessary).
Source code (C++)
void AppSystemLogic::init_cigi()
{
    int index = Engine::get()->findPlugin("CIGIConnector");
    // check CIGIConnector plugin load
    if (index < 0)
        return;
    // get CIGI interface
    cigi = IG::CIGI::Connector::get();
    
    cigi->addSendPacketCallback(Plugins::IG::CIGI::CIGI_OPCODE_LOS_EXT_RESPONSE, MakeCallback(this, &AppSystemLogic::on_los_ext_send));
    cigi->addSendPacketCallback(Plugins::IG::CIGI::CIGI_OPCODE_LOS_RESPONSE, MakeCallback(this, &AppSystemLogic::on_los_ext_send));
}
void AppSystemLogic::on_los_ext_send(bool &ret, IG::CIGI::CigiIGPacket *response, IG::CIGI::CigiHostPacket *request, IG::IGIntersection *intersection)
{
    ret = false;
    Log::message("reject packet %d\n", response->getType());
    if (request)
        Log::message("request was %d\n", request->getType());
    if (intersection)
    {
        Log::message("intersection was\n");
        if (intersection->object)
            Log::message("intersection object %s\n", intersection->object->getName());
    }
}

Arguments

  • int cigi_opcode - CIGI data packet opcode. One of the CIGI_OPCODE_* values.
  • Unigine::CallbackBase4 * func - Callback pointer. The callback function must have the following signature:
    (bool &ret, IG::CIGI::CigiIGPacket *response, IG::CIGI::CigiHostPacket *request, IG::IGIntersection *intersection)

Return value

ID of the last added Send Packet callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool removeSendPacketCallback ( void * id ) #

Removes the specified callback from the list of Send Packet callbacks.

Arguments

  • void * id - Send Packet callback ID obtained when adding it.

Return value

True if the Send Packet callback with the given ID was removed successfully; otherwise false.

int getNumHostPackets ( ) #

Returns the total number of packets received from the Host.

Return value

Total number of packets received from the Host.

CigiHostPacket * getHostPacket ( int num ) #

Returns the specified CIGI Host packet.

Arguments

  • int num - ID of the Host packet.

Return value

CIGI Host packet.

CigiIGPacket * createIGPacket ( int ig_opcode ) #

Creates IG Packet to be sent to the Host.

Arguments

Return value

IG Packet to be sent to the Host.

void addIGPacket ( CigiIGPacket * packet ) #

Sends the specified IG packet to the Host.

Arguments

void setProcessPacket ( int op_code, bool enabled ) #

Sets a value indicating if the specified IG packets received are to be processed or skipped.

Arguments

  • int op_code - IG opcode, one of CIGI_OPCODE_* values.
  • bool enabled - true to process packets of the specified type, false to skip them.

void showDebug ( ) #

Displays the debug information.
Last update: 2021-04-22
Build: ()