MTConnect .NET
Software Development Kit (SDK)
Version 2.1.7
March 7, 2011
MTConnect is a registered trademark of AMT - The Association for Manufacturing Technology.
Use of MTConnect is limited to use as specified on http://www.mtconnect.org/.
Revision History ....................................................................................................... 3
Table of Contents
Introduction ............................................................................................................ 4
Architecture ............................................................................................................ 4
SDK Solution and Projects ........................................................................................ 5
MTConnectAgent Solution .................................................................................. 5
MTConnectAgentCore Project ............................................................................. 5
MTConnectAgentCoreWindows Project ................................................................ 5
MTConnectAgentCoreWindowsService Project ...................................................... 5
MTConnectAgentCoreWindowsServiceSetup Project ............................................. 5
Implementation Scenarios ........................................................................................ 6
Independent Adapter and Independent Agent ........................................................ 6
Combined Adapter and Agent ................................................................................ 6
Embedded Agent .................................................................................................. 7
How to Guide .......................................................................................................... 8
Windows Application Version ................................................................................. 8
How do I install the Windows Application Version? ............................................... 8
How do I run the Windows Application Version? ................................................... 8
Windows Service Version ...................................................................................... 9
How do I install the Windows Service Version? .................................................... 9
How to Run ....................................................................................................... 9
How to Stop ...................................................................................................... 9
How to Uninstall ................................................................................................ 9
Agent Interaction ............................................................................................... 10
How do I send an HTTP Request to the Core Agent? .......................................... 10
How do I send Data to the Core via HTTP? ........................................................ 10
How do I configure the Core Agent? ................................................................. 10
How can I view data stored by the Agent? ......................................................... 10
Development ...................................................................................................... 11
How can I Use the DLL in a Visual Studio 2005 C# Project? ................................ 11
Start Function .................................................................................................... 12
Stop Function ..................................................................................................... 12
StoreSample Function ......................................................................................... 13
StoreEvent Function ........................................................................................... 14
StoreCondition Function ...................................................................................... 15
HTTP Interface ...................................................................................................... 16
debug ................................................................................................................ 17
storeSample ....................................................................................................... 17
storeEvent ......................................................................................................... 18
storeCondition .................................................................................................... 19
version .............................................................................................................. 19
Agent Configuration ............................................................................................... 20
SDK Package Structure ........................................................................................... 21
General .............................................................................................................. 21
MTConnect .NET SDK Guide
Page 1
Core Agent ........................................................................................................ 21
Windows Executable to Run Core Agent ............................................................... 21
Windows Service to Run Core Agent .................................................................... 21
Create Core Agent Windows Service .................................................................... 22
Known Issues ........................................................................................................ 23
Comments or Questions ......................................................................................... 23
MTConnect .NET SDK Guide
Page 2
Revision History
Date Description Author Version
Date
Description
Author
Version
4/30/2008
Initial Draft
5/1/2008
Changes and Recommendations from
Paul Warndorf.
5/19/2008 Updated images. Added table of contents,
terminology, and revision history. Various
edits throughput.
Georgia Tech Prerelease
Georgia Tech 0.1
Georgia Tech 0.2
6/3/2008
Updated images.
Georgia Tech 0.21
6/26/2008 Modified scenario section. See change log
Georgia Tech 0.22
for list of code changes.
7/11/2008
Significant rewrite of the documentation.
See change log for list of code changes.
Georgia Tech 0.3
8/7/2008
8/15/2008
Changed the syntax for http storeEvent
and storeSample requests. Added LDAP
functionality. See change log for list of
code changes.
SHDR rejecting Event other than type
Alarm. Various other fixes. See change
log for list of code changes.
Georgia Tech 0.4
Georgia Tech 0.41
10/20/2008 Changed Adapter to be a MS service for
Georgia Tech 0.45
the Core Agent and the SHDR Agent.
12/22/2008 Revamped the Agent SDK document for
Georgia Tech 0.5
clarity and further definition.
12/8/2010 Updated for MTConnect version 1.1.0
Georgia Tech 2.1
03/11/2011 Updated by Lei Yang version 2.1.7
Georgia Tech 2.1.7
MTConnect .NET SDK Guide
Page 3
Introduction
The .NET software development kit (SDK) was written to reduce the time and effort
required to implement an MTConnect interface. It consists of four Visual Studio Projects
that allow implementers to use the SDK in a variety of scenarios.
The SDK was developed in Visual Studio 2008 and written in C#. It can be embedded
directly into your application, used as a stand-alone Windows application or run as a
Windows service.
Architecture
The following diagram provides an overview of the .NET Agent SDK architecture:
MTC onnect Device
MTC onnect
C lient Application
Adapter
HTTP Input
MTC onnect
Interface
Agent AP I
Agent F unctionality
Data S tore
Agent C ore
C onfiguration
The Agent Core of the SDK contains the base functionality of the agent and can be
accessed via function calls or HTTP. Functional and HTTP access allow the SDK to be used
in a variety of ways
MTConnect .NET SDK Guide
Page 4
SDK Solution and Projects
The SDK is written in Microsoft Visual Studio 2008 using C# and consists of one Visual
Studio Solution containing four Visual Studio Projects. The solution and projects are as
follows:
MTConnectAgent Solution
This solution contains the four SDK projects.
MTConnectAgentCore Project
This project produces an Agent Core DLL that can be embedded into an application.
MTConnectAgentCoreWindows Project
This project produces an executable file that exercises the Agent Core DLL through a
simple graphical user interface.
MTConnectAgentCoreWindowsService Project
This project defines the MTConnect Agent Core as a window service.
MTConnectAgentCoreWindowsServiceSetup Project
This project produces an install shield and a setup.exe for the Core Agent Service.
MTConnect .NET SDK Guide
Page 5
Implementation Scenarios
This section describes three possible scenarios in which the SDK can be used to
implement an MTConnect interface.
Independent Adapter and Independent Agent
In this scenario, the adapter and agent are implemented as independent entities and can
be manifested as either Windows Applications or Windows Services. The adapter
communicates with the controller (typically via a serial or network connection) and with
the agent via http. The agent provides the MTConnect interface to the client. The
following diagram illustrates this scenario:
Serial
Device
Adapter
Agent
Client
HTTP
MTConnect
Network
Combined Adapter and Agent
In this scenario, the adapter and agent are combined into a single Windows Application or
Windows Service. The combined entity communicates with both the device and the
MTConnect client.
Device
Serial
Network
Adapter
and Agent
MTConnect
Client
MTConnect .NET SDK Guide
Page 6
Embedded Agent
In this scenario, the agent is embedded in the device and the device communicates with
the agent through function calls. The agent communicates with the MTConnect client.
The following diagram illustrates this scenario:
Device
Function
Calls
MTConnect
Executable
Agent
Client
MTConnect .NET SDK Guide
Page 7