@@ -10,22 +10,28 @@ static void Main(string[] args)
1010 {
1111 DocumentClient ( ) ;
1212 //EntityClient();
13-
14- Console . ReadLine ( ) ;
1513 }
1614
1715 static void DocumentClient ( )
1816 {
19- var client = new MTConnectHttpClient ( "localhost" , 5000 ) ;
20- //var client = new MTConnectHttpClient("http://mtconnect.mazakcorp.com/", 5719);
17+ Console . WriteLine ( "Enter Hostname:" ) ;
18+ var hostname = Console . ReadLine ( ) ;
19+
20+ Console . WriteLine ( "Enter Port:" ) ;
21+ var port = Console . ReadLine ( ) . ToInt ( ) ;
22+
23+ Console . WriteLine ( $ "Connecting to ({ hostname } :{ port } )..") ;
24+
25+
26+ var client = new MTConnectHttpClient ( hostname , port ) ;
2127 client . Interval = 100 ;
2228 client . ClientStarted += ( s , args ) => { Console . WriteLine ( "Client Started" ) ; } ;
2329 client . ClientStopped += ( s , args ) => { Console . WriteLine ( "Client Stopped" ) ; } ;
24- // client.FormatError += (s, args) => { Console.WriteLine($"Format Error : {args.ContentType.Name} : {args.Messages?.FirstOrDefault()}"); };
30+ client . FormatError += ( s , args ) => { Console . WriteLine ( $ "Format Error : { args . ContentType . Name } : { args . Messages ? . FirstOrDefault ( ) } ") ; } ;
2531
2632 client . ProbeReceived += ( s , response ) =>
2733 {
28- foreach ( var device in response . Devices ) Console . WriteLine ( $ "Device Received : { device . Uuid } : { device . Name } ") ;
34+ foreach ( var device in response . Devices ) Console . WriteLine ( $ "Device Received : { device . Uuid } : { device . Name } : { device . MTConnectVersion } ") ;
2935 } ;
3036
3137 client . CurrentReceived += ( s , response ) =>
@@ -36,7 +42,7 @@ static void DocumentClient()
3642 {
3743 foreach ( var observation in componentStream . Observations )
3844 {
39- Console . WriteLine ( $ "Observation Received : { observation . DataItemId } : { string . Join ( ";" , observation . Values . Select ( o => o . Value ) ) } ") ;
45+ Console . WriteLine ( $ "Observation Received : { observation . DataItemId } : { string . Join ( ";" , observation . Values . Select ( o => o . Value ) ) } @ { observation . Timestamp . ToString ( "o" ) } ") ;
4046
4147 var validationResult = observation . Validate ( ) ;
4248 Console . WriteLine ( $ "Observation Validation : { observation . DataItemId } : { validationResult . IsValid } : { validationResult . Message } ") ;
@@ -53,7 +59,7 @@ static void DocumentClient()
5359 {
5460 foreach ( var observation in componentStream . Observations )
5561 {
56- Console . WriteLine ( $ "Observation Received : { observation . DataItemId } : { string . Join ( ";" , observation . Values . Select ( o => o . Value ) ) } ") ;
62+ Console . WriteLine ( $ "Observation Received : { observation . DataItemId } : { string . Join ( ";" , observation . Values . Select ( o => o . Value ) ) } @ { observation . Timestamp . ToString ( "o" ) } ") ;
5763
5864 var validationResult = observation . Validate ( ) ;
5965 Console . WriteLine ( $ "Observation Validation : { observation . DataItemId } : { validationResult . IsValid } : { validationResult . Message } ") ;
@@ -72,6 +78,8 @@ static void DocumentClient()
7278
7379 client . StartFromBuffer ( ) ;
7480 //client.Start();
81+
82+ Console . ReadLine ( ) ;
7583 }
7684
7785 static void EntityClient ( )
0 commit comments