-
-
Notifications
You must be signed in to change notification settings - Fork 0
Getting started
There are two components to using Mtconnect.Adapter
:
- Consuming a source of data (see
Mtconnect.AdapterInterface
) - Publishing the data to clients (MTConnect Agent(s)) (see
Mtconnect.TcpAdapter
)
sequenceDiagram
participant IAdapterSource
participant IAdapterDataModel
participant Adapter
participant Client
loop poll
IAdapterSource->>IAdapterSource: data source
IAdapterSource-->>IAdapterDataModel: deserialize
IAdapterDataModel-->>IAdapterSource: entity
IAdapterSource--)Adapter: OnDataReceieved(IAdapterDataModel, DataReceivedEventArgs)
end
loop heartbeat
Adapter->>Client: Publish
end
There are generics within Mtconnect.Adapter
that can be utilized to manage basic data sources. Implementing the IAdapterSource
interface provides the easiest transmission of source data.
However, you can manage your own data items and gain additional control over how your data is published.
The Mtconnect.Adapter
library understands that there are many protocols for publishing data across networks. Currently, TCP is the prevailing and recommended form of publishing data from an Adapter to a MTConnect Agent. For this, we've created the Mtconnect.TcpAdapter
package. However, if you wanted to publish via gRPC, you could do that after implementing the Adapter
class.
At a minimum, you will need to reference the Mtconnect.AdapterInterface
package. Additionally, you may reference a publish protocol package like the Mtconnect.TcpAdapter
.
The core package is Mtconnect.AdapterInterface
. The supported platforms are .NET/.NET Core, .NET Framework 4.6+.
$ dotnet add package Mtconnect.AdapterInterface
If you are not implementing your own publishing protocol, then you will need to reference a library that will publish the data through the Adapter
class.
For example, if you want to publish through TCP connections, you can add the Mtconnect.TcpAdapter
package:
$ dotnet add package Mtconnect.TcpAdapter
There are two methods for setting up an Adapter:
- Manual: You manually add each DataItem and manage the values by keys in the Adapter. See the example
- Data Model: You implement a data model and allow a service to update the entity. See the example