CogCommCards ClassCognex VisionPro 9.5
A collection containing every CogCommCard installed in the system.

Upon construction, CogCommCards is automatically initialized to contain one instance for CogCommCard found in the system.

Inheritance Hierarchy

System Object
  System MarshalByRefObject
    Cognex.VisionPro.Implementation CogObjectBase
      Cognex.VisionPro.Implementation CogReadOnlyCollectionNonSerializable CogCommCard 
        Cognex.VisionPro.Comm CogCommCards

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

public class CogCommCards : CogReadOnlyCollectionNonSerializable<CogCommCard>

The CogCommCards type exposes the following members.

Constructors

  NameDescription
Public methodCogCommCards
Constructs a new instance of the CogCommCards class. After construction the CogCommCards is populated with a CogCommCard instance for each comm card found in the system.
Top
Methods

  NameDescription
Public methodContains
Determines whether an element is in the collection.
(Inherited from CogReadOnlyCollectionNonSerializable T .)
Public methodCopyTo
Copies the entire Collection to a compatible one-dimensional Array, starting at the specified index of the target array.
(Inherited from CogReadOnlyCollectionNonSerializable T .)
Public methodCreateObjRef
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Protected methodGetAttributes
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Protected methodGetClassName
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Protected methodGetComponentName
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Protected methodGetConverter
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Protected methodGetDefaultEvent
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Protected methodGetDefaultProperty
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Protected methodGetEditor
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Protected methodGetEvents 
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Protected methodGetEvents( Attribute )
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Protected methodGetProperties 
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Protected methodGetProperties( Attribute )
Causes the list of items to show up in the property grid.
(Inherited from CogReadOnlyCollectionNonSerializable T .)
Protected methodGetPropertyOwner
Implements the corresponding member of the ICustomTypeDescriptor interface. May be overridden in derived classes to provide custom type information.
(Inherited from CogObjectBase.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIndexOf
Searches the collection for the specified object and returns the zero-based index of the first occurrence.
(Inherited from CogReadOnlyCollectionNonSerializable T .)
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone 
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodMemberwiseClone(Boolean)
Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject.)
Public methodToArray
Calls CopyTo() and returns a new array which contains the members of this collection.
(Inherited from CogReadOnlyCollectionNonSerializable T .)
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)
Top
Fields

  NameDescription
Public fieldStatic member_boardList
Protected fieldmInnerList (Inherited from CogReadOnlyCollectionNonSerializable T .)
Top
Properties

  NameDescription
Public propertyCount
The number of elements contained in the Collection.
(Inherited from CogReadOnlyCollectionNonSerializable T .)
Public propertyItem
Gets the element at the specified index.
(Inherited from CogReadOnlyCollectionNonSerializable T .)
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