Click or drag to resize

Getting Started with the SDK

The CFX Software Development Kit (SDK) is a .NET based library that may be used within the Microsoft Visual Studio development environment. It is available in two variants: A .NET 4.6 based library for traditional windows desktop and server applications (CFX.CFXSDK), and a .NET Standard 1.3 platform variant (CFX.CFXSDK.NetStandard) that allows interoperability with different editions of the .NET framework (.NET Core, .NET Micro Framework, UWP, etc.).

Using the CFX SDK

The CFX SDK currently provides the following features and capabilities:

  • Class / Object representations of all CFX messages (just like the standard, not yet 100% complete, but a great many messages are already available).

  • Ability to serialize and de-serialize CFX message objects to and from JSON format.

  • Ability to publish CFX messages via AMQP transport protocol to one or more destinations.

  • Ability to receive CFX messages via AMQP transport protocol from one or more subscription sources.

  • Fully automated network connection fault management (maintains AMQP connections even when network goes down or is otherwise unreliable).

  • CFX message “spooling”. Maintains a durable queue of CFX messages that were not able to be transmitted due to faulty network conditions. Messages are automatically transmitted in their original order once network service has resumed.

  • Point-to-Point CFX endpoint command (Request / Response) support.

  • Support for AMQP 1.0 SASL authentication and TLS encryption.

Supported Development Platforms

To use the CFX SDK, you must utilize Microsoft Visual Studio 2012 or newer (or a 3rd party IDE capable of developing applications targeting .NET Framework 4.6 or greater).

Licensing

The CFX SDK is absolutely free, and there are no runtime royalties or license fees of any sort. Though originally developed by Aegis Software, the SDK and its source code have been donated by Aegis to the IPC. The code is published publicly on GitHub, and use of the SDK is licensed under the Apache open source license agreement.

Distribution and Source Code Availability

The CFX SDK is available as a NuGet package on nuget.org under the package name CFX.CFXSDK (https://www.nuget.org/packages/CFX.CFXSDK)

TSource code for the SDK is maintained as an open source community project on GitHub at https://github.com/IPCConnectedFactoryExchange/CFX

Developer Getting Started Guide, CFX Message/Structure Definitions, and Reference Documentation for the CFX SDK can be found here: http://www.connectedfactoryexchange.com/CFXDemo/SDK

Step-By-Step Getting Started Guide

This walkthrough will guide you through the basic process necessary to create and transmit a CFX message using the CFX SDK

For this walkthrough, we will create a basic .NET WinForms application that uses the CFX SDK to accomplish the message creation and transmission

To create your actual demo for the APEX show, you will follow a very similar process, but will be adding the CFX library to your pre-existing machine controller, line controller, or data collection software modules.

STEP 1 -- Creating a new WinForms Application

Use Visual Studio to create a new WinForms Application

Step Image 1

Step Image 1b

STEP 2 -- Add the CFX SDK package to your Project

Open the NuGet Package Management Console, and type:

C#
Install-Package CFX.CFXSDK

The NuGet Package Management Console can be accessed here:

Step Image 2

STEP 3 -- Initialize an AMQP CFX Publish Channel to a CFX Broker

Add an Open button to your form, and create a click handler method. Add the following code to your handler to initialize a new AMQP channel to the APEX cloud server:

C#
using CFX;
using CFX.Structures;
using CFX.ResourcePerformance;
using CFX.Transport;

. . .
. . .

AmqpCFXEndpoint theEndpoint;
string myHandle = "MyCompany.MyMachineModel.MyMachineSerialNumber";
string myBroker = "amqp://cfx.aiscorp.com:5672";
string myExchange = "/exchange/AegisCloud";

private void btnOpen_Click(object sender, EventArgs e)
{
     if (theEndpoint != null) btnClose_Click(sender, e);


     theEndpoint = new AmqpCFXEndpoint();
     theEndpoint.Open(myHandle);
     theEndpoint.AddPublishChannel(new Uri(myBroker), myExchange);
     btnSend.Enabled = true;
}

STEP 4 -- Construct a CFX Message and Publish to the Broker

Add a Send button to your form, and create a click handler method. Add the following code to your handler to initialize a new AMQP channel to the APEX cloud server:

C#
private void btnSend_Click(object sender, EventArgs e)
{
     CFXEnvelope env = new CFXEnvelope(new CFX.ResourcePerformance.LogEntryRecorded()
     {
         Importance = CFX.Structures.LogImportance.Debug,
        Message = "Debug Log Entry"
     });

     theEndpoint.Publish(env);
}

That’s it! You can download the full source code for this example on GitHub at:

https://github.com/IPCConnectedFactoryExchange/CFX/tree/master/APEX%20CFX%20Demo%20App