https://github.com/mtconnect/mtlinq
MTConnect Linq Example
https://github.com/mtconnect/mtlinq
Last synced: about 1 year ago
JSON representation
MTConnect Linq Example
- Host: GitHub
- URL: https://github.com/mtconnect/mtlinq
- Owner: mtconnect
- License: mit
- Created: 2010-03-21T07:45:37.000Z (about 16 years ago)
- Default Branch: master
- Last Pushed: 2014-12-19T01:07:07.000Z (over 11 years ago)
- Last Synced: 2024-03-25T22:27:00.022Z (about 2 years ago)
- Language: C#
- Homepage:
- Size: 216 KB
- Stars: 6
- Watchers: 6
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
MTSharp
=======
.Net library for comsuming MTConnect streams written in pure C#.
This library utilizes Linq and Xml.Linq to simplify and speed up the parsing of streams.
The structure was taken mostly from https://github.com/mtconnect/mtlinq but cleaned up and optimized
to have ~30% gain in performance.
MTConnect.Probe()
-----------------
MTConnect.Probe() gets all the devices but not the current result set. This is great if you need
to get the Devices in a stream but do not need the data at the time. MTConnect.Probe will make a
request every time it is called, so if you want the devices from the last time, use MTConnect.Devices().
If MTConnect.Probe has has not been called, MTConnect.Devices will make the call for you.
MTConnect.Current()
-------------------
MTConnect.Current() is used to get all Devices in a stream along with an enumerable dataset of Result's.
Examples
-------
### Get all devices in a stream
Notice below how the example url does not contain a "/current" at the end, DO NOT add the "/current".
```C#
MTConnect connect = new MTConnect("http://url-to-stream");
IEnumerable devices = connect.Probe().Select(entry => entry.Value);
```
### Get the results for a device in a stream
This example get all results for a device named "TestDevice" within the stream.
```C#
MTConnect connect = new MTConnect("http://url-to-stream");
IEnumerable results = connect.Current()["TestDevice"];
```