Author Topic: Question on use of nrCommLib.Com  (Read 43 times)

Jukka

  • Newbie
  • *
  • Posts: 1
    • View Profile
Question on use of nrCommLib.Com
« on: December 11, 2017, 07:55:33 am »
Trying to send messages using astm. But is this how I should do it

          nrAstm1.SendRecord(@"H|\^&|||1^ASTM_TESTER^|||||||P||20120516000001");
          nrAstm1.SendRecord(@"P|1");
          nrAstm1.SendRecord(@"O|1|SampleID||^^^TestID|R||||||X||||1||||||||||F");
          nrAstm1.SendRecord(@"R|1|^^^TestID^0|100|IU_ml||||F||||20120508160203");
          nrAstm1.SendRecord(@"L|1|N");


Or it should be like this?

          string str = @"H|\^&|||1^ASTM_TESTER^|||||||P||20120516000001" + "\r" +
            @"P|1" + "\r" +
            @"O|1|SampleID||^^^TestID|R||||||X||||1||||||||||F" + "\r" +
            @"R|1|^^^TestID^0|100|IU_ml||||F||||20120508160203" + "\r" +
            @"L|1|N" + "\r";
          ;
          nrAstm1.SendRecord(str);
          nrAstm1.WaitForAck();
« Last Edit: December 11, 2017, 08:32:32 am by Jukka »

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 998
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Question on use of nrCommLib.Com
« Reply #1 on: December 12, 2017, 09:08:01 am »
Hello

The first way is more correct.
TnrAstm.SendRecord() checks length and add necessary END char. You do not need to use '\r' separator in string argument.

Roman Novgorodov
DeepSoftware llc
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.