CogFfpAccess ClassCognex VisionPro
Instances of CogFfpAccess class are held by the CogCommCard comm card class.

CogFfpAccess is used to factory/initialize instances of the factory floor protocols running on the comm card by calling CreateNetworkDataModel(CogFfpProtocolConstants).

The Network Data Model (NDM) is the way Cognex VisionPro Vision Systems interact with a PLC.

Inheritance Hierarchy

System Object
  Cognex.VisionPro.Comm CogFfpAccess

Namespace: Cognex.VisionPro.Comm
Assembly: Cognex.VisionPro.Comm (in Cognex.VisionPro.Comm.dll) Version: 65.1.0.0
Syntax

public class CogFfpAccess : IDisposable

The CogFfpAccess type exposes the following members.

Methods

  NameDescription
Public methodCreateNetworkDataModel
Creates a network data model (NDM) interface on the comm card. The network data model is used to send and receive messages between the vision system and a remote device (usually a PLC).
Public methodCreateNetworkDataModelEip
Creates a network data model interface on the comm card using the EtherNet/IP protocol.
Public methodCreateNetworkDataModelProfinet
Creates a network data model interface on the comm card using the PROFINET protocol.
Public methodCreateNetworkDataModelSlmp
Creates a network data model interface on the comm card using the SLMP protocol.
Public methodDispose 
Protected methodDispose(Boolean)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize (Overrides Object Finalize .)
Public methodGetActiveNetworkDataModel
Returns a reference to the currently active Network Data Model (NDM) object held by the Comm Card or null if no currently active NDM exists.

An active Network Data Model will only exist if one of the CreateNetworkDataModel(CogFfpProtocolConstants) methods has been called previously.

Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Top
Properties

  NameDescription
Public propertyAvailableProtocols
Returns a list of the available protocols.
Top
Examples

using Cognex.VisionPro;
using Cognex.VisionPro.Comm;

// Shows simple use of comm card API. 
//  
// Initializes a connection to a Rockwell Control Logix PLC 
// using the EtherNet/IP protocol and the Cognex generic 
// Factory Floor Protocol (FFP) interface known as the  
// Network Data Model (NDM). 
//  
// Signs up for the NDM's "NewUserData" event and prints out the  
// NewUserData as it's received. 
public void Example()
{
  CogCommCards commCardCollection = new CogCommCards();

  Console.WriteLine("Found: {0} comm cards", commCardCollection.Count);

  if (commCardCollection.Count == 0)
    return;

  CogCommCard card = commCardCollection[0];

  Console.WriteLine("Name: {0}", card.Name);
  Console.WriteLine("Serial: {0}", card.SerialNumber);

  Console.WriteLine("Initializing comm card Factory Floor Protocol (FFP)");

  CogFfpAccess ffpAccess = card.FfpAccess;

  if (ffpAccess == null)
    throw new Exception("FFP is not supported.");     

  CogNdm ffpNdm =
    ffpAccess.CreateNetworkDataModel(CogFfpProtocolConstants.EthernetIp);

  ffpNdm.Start();

  Console.WriteLine("Sign up for the NewUserData Event");
  ffpNdm.NewUserData += new CogNdmNewUserDataEventHandler(ffpNdm_NewUserData);    
}

void ffpNdm_NewUserData(object sender, CogNdmNewUserDataEventArgs e)
{
  CogNdm ndm = sender as CogNdm;
  if (ndm != null)
    Console.WriteLine(BitConverter.ToString(ndm.ReadUserData(0, 100)));
}
See Also