CogCommCard FfpAccess Property Cognex VisionPro 9.21
Gets a factory floor protocol (FFP) access object.

Use the factory floor protocol access object to access the factory floor protocol features of the comm card.

This property returns null if the hardware does not support factory floor protocols.

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

public CogFfpAccess FfpAccess { get; }

Property Value

Type: CogFfpAccess
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