-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using data streamed by agent. #4
Comments
The output of the agent is XML, and you will need to make a HTTP request to the agent to retrieve this information. So, you will need to extract the content that you need from the XML and convert it into the desired string format. |
You need to use an XML parser, e.g., MSXML or Xerces. (maybe others). Below is a MSXML parser, attached are some XERCES notes for parsing (FENT is a network analyzer using Wireshark on source forge) . I also have vb script to read and “tabelize” MTConnect xml (Will has ruby code). XMLspy will also generate C++ code that reads XML using MSXML or Xerces. You can also use Microsoft xsd.exe to generate an XML reader in C#. You can view xml from webbrowser as http://ip:5000/current or http://ip:5000/probe But as you said this only displays output. (Telnet is for back end SHDR from controller). John // #include "StdAfx.h" #pragma comment(lib, "comsuppw.lib") std::map<std::string, std::string> MTConnectStreamsParser::_TagRenames; ptime GetDateTime(std::string s)
} static _bstr_t checkParseError(MSXML2::IXMLDOMParseErrorPtr pError) } static void dump_com_error(_com_error &e) MTConnectStreamsParser::MTConnectStreamsParser(void) MTConnectStreamsParser::~MTConnectStreamsParser(void) _bstr_t MTConnectStreamsParser::GetAttribute(MSXML2::IXMLDOMNodePtr node, _bstr_t attribute)
} std::string MTConnectStreamsParser::ParseXMLDocument(_bstr_t xmlfile, _bstr_t xsdfile, _bstr_t xsdname)
} std::vector MTConnectStreamsParser::ReadStream(std::string filename)
} DataDictionary MTConnectStreamsParser::ParseDataItems()
#if 0
#if 0
#endif } From: Nikhil [mailto:notifications@github.com] I'm beginner in MTConnect and trying to make use of data/information (which is in MTConnect format) streamed by agent. My client doesn't understand MTconnect because its code is written for particular string format. So, I want to make a wrapper which will convert info. sent by agent (in MTConnect format) into the format that client will understand. So, first step is to get information from agent and the second is to convert into desired format. How do I receive information from agent? (Of course, not web browser because agent is an API). To see output generated by agent, I was trying to do : 'telnet localhost 5000' in CMD but it wasn't showing anything. What should I do? — |
Nikhil, The easiest way to dump the data into an file is the curl command line application: http://curl.haxx.se This utility is very capable and will work on almost any platform.
The output will go to std out and you can process it with your favorite XML parser. There are better ways to handle the data from an application, but that is a longer discussion. On May 28, 2014, at 2:31 AM, Nikhil notifications@github.com wrote:
|
Since you mentioned telnet, I made the assumption you were working from the command line. For a r/t streaming example in c# - check out the app lab: github.com/mtconnect/mc2-app-lab Sent from my iPhone
|
I'm beginner in MTConnect and trying to make use of data/information (which is in MTConnect format) streamed by agent. My client doesn't understand MTconnect because its code is written for particular string format. So, I want to make a wrapper which will convert info. sent by agent (in MTConnect format) into the format that client will understand. So, first step is to get information from agent and the second is to convert into desired format. How do I receive information from agent? (Of course, not web browser because agent is an API).
To see output generated by agent, I was trying to do : 'telnet localhost 5000' in CMD but it wasn't showing anything.
What should I do?
Is there any wrapper for conversion of MTConnect to desired string format?
The text was updated successfully, but these errors were encountered: