public static extern PLC_Read *_ReadPLCData( Eip_Session *session, Eip_Connection *connection, DHP_Header *dhp, byte *routepath, byte routepathsize, Plc_Type type, short tns, string address, short number);
public bool Connect() { try { if (session != null) { Dispose(); } session = Tuxeip_Class.OpenSession(_ip); byte[] path = new byte[] { _rack, _slot }; if (session != null) { int res = Tuxeip_Class._RegisterSession(session); connection = Tuxeip_Class.ConnectPLCOverCNET(session, Plc_Type.LGX, path); } return(session != null && connection != null); } catch (Exception error) { if (OnError != null) { OnError(this, new IOErrorEventArgs(error.Message)); } return(false); } }
public static extern int _WriteLgxData( Eip_Session *session, Eip_Connection *connection, string adress, LGX_Data_Type datatype, void *data, //int datasize, short number);
public static extern int _WritePLCData( Eip_Session *session, Eip_Connection *connection, DHP_Header *dhp, byte *routepath, byte routepathsize, Plc_Type type, short tns, string address, PLC_Data_Type datatype, void *data, short number);
public void Dispose() { if (connection != null) { Tuxeip_Class._Forward_Close(connection); } if (session != null) { Tuxeip_Class._UnRegisterSession(session); } Tuxeip_Class.CloseSession(session); Marshal.FreeCoTaskMem((IntPtr)connection); Marshal.FreeCoTaskMem((IntPtr)session); connection = null; session = null; }
public float[] ReadFloatArray(DeviceAddress address, ushort size) { if (IsClosed) { return(null); } else { float[] buffer = new float[size]; address.VarType = DataType.FLOAT; var addr = GetAddress(address); LGX_Read *data = Tuxeip_Class._ReadLgxData(session, connection, addr, size); if (data != null && data->Varcount > 0) { for (int i = 0; i < data->Varcount; i++) { buffer[i] = Tuxeip_Class._GetLGXValueAsFloat(data, i); } data = null; return(buffer); } connection = null; return(null); } }
public static extern LGX_Read *_ReadLgxData( Eip_Session *session, Eip_Connection *connection, string adress, ushort number);
public static extern int _Forward_Close(Eip_Connection *connection);