Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Startup Ethernet connection

If you are going to use iqInterface over Ethernet/LAN connection you should once startup Ethernet communication beforehand usingenet_Startup function declared in iqi_ethernet.h

enet_Startup(cpErrMsg);

At the end of Ethernet communication usage you can free OS resources bound to it calling enet_Cleanup function also declared in iqi_ethernet.h

enet_Cleanup(cpErrMsg);
 

comm_EthernetSearch (search iqInterface IP in LAN)

Function

int16 comm_EthernetSearch(enet_ConnectionT * pFoundConnections,  uchar08 ucMaxConnectionsNumber,  uchar08 * ucpFoundConnectionsNumber, uint16 uiSendRecvTimoutMs,  char08 *cpErrMsg);

Description

If you do not know the IP address you can try to search it using comm_EthernetSearch function declared in iqi_comm.h. Call it with a buffer to return found connections of type enet_ConnectionT, its size, a pointer to found connections number and send/receive timeout in milliseconds as arguments. The UDP protocol with port number 30718 is used to discover iqInterfaces in LAN. You can use the found connections further in mst_EthernetConnect or dev_EthernetConnect function to connect to found iqInterface.

Input Parameters

  • uchar08 ucMaxConnectionsNumber – size of connection bufferpFoundConnections

Output parameters:

  • enet_ConnectionT * pFoundConnections – pointer to buffer to return found connections of type “enet_ConnectionT”
  • uchar08 * ucpFoundConnectionsNumber – number of connections actually found and saved to buffer “pFoundConnections”
  • uint16 uiSendRecvTimoutMs – send/receive timeout used for UDP packets to discover iqInterfaces
  • char08 *cpErrMsg – pointer to buffer to return error message (minimum 256 bytes)

Return value

ERR_NONE or negative error number.

Example

enet_ConnectionT connections[5];
uchar08 ucFoundConnectionNumber = 0;
uint16 uiSendRecvTimoutMs = 500; // 0,5 sec
int16 iPortNo;
comm_EthernetSearch(connections, 5, &ucFoundConnectionNumber, uiSendRecvTimoutMs, cpErrMsg);
// inspect found connections: connections[0].cpIqInterfaceIpAddr …
uiSendRecvTimoutMs = 2000; // 2 sec
iPortNo = mst_EthernetConnect(&(connections[0]), uiSendRecvTimoutMs, cpErrMsg);
// or
iPortNo  = dev_EthernetConnect(&(connections[0]), uiSendRecvTimoutMs, cpErrMsg);
  • No labels