Ejemplo n.º 1
0
        private static void reportHandler(Report report, object parameter)
        {
            Console.WriteLine("Received report:\n----------------");

            if (report.HasTimestamp())
            {
                Console.WriteLine("  timestamp: " + MmsValue.MsTimeToDateTimeOffset(report.GetTimestamp()).ToString());
            }

            MmsValue values = report.GetDataSetValues();

            Console.WriteLine("  report dataset contains " + values.Size() + " elements");

            for (int i = 0; i < values.Size(); i++)
            {
                if (report.GetReasonForInclusion(i) != ReasonForInclusion.REASON_NOT_INCLUDED)
                {
                    Console.WriteLine("    element " + i + " included for reason " + report.GetReasonForInclusion(i).ToString() + " " + values.GetElement(i));
                }
            }

            ReportControlBlock rcb = (ReportControlBlock)parameter;

            Console.WriteLine("Buffered: " + rcb.IsBuffered());
        }
Ejemplo n.º 2
0
 private static void PrintJournalEntries(List <MmsJournalEntry> journalEntries)
 {
     foreach (MmsJournalEntry entry in journalEntries)
     {
         Console.WriteLine("EntryID: " + BitConverter.ToString(entry.GetEntryID()));
         Console.WriteLine("  occurence time: " + MmsValue.MsTimeToDateTimeOffset(entry.GetOccurenceTime()).ToString());
         foreach (MmsJournalVariable variable in entry.GetJournalVariables())
         {
             Console.WriteLine("    variable: " + variable.GetTag());
             Console.WriteLine("       value: " + variable.GetValue().ToString());
         }
     }
 }
Ejemplo n.º 3
0
        public static void printFiles(IedConnection con, string prefix, string parent)
        {
            List <FileDirectoryEntry> files = con.GetFileDirectory(parent);

            foreach (FileDirectoryEntry file in files)
            {
                Console.WriteLine(prefix + file.GetFileName() + "\t" + file.GetFileSize() + "\t" +
                                  MmsValue.MsTimeToDateTimeOffset(file.GetLastModified()));

                if (file.GetFileName().EndsWith("/"))
                {
                    printFiles(con, prefix + "  ", parent + file.GetFileName());
                }
            }
        }
Ejemplo n.º 4
0
        private static void reportHandler(Report report, object parameter)
        {
            Console.WriteLine("Received report:\n----------------");

            Console.WriteLine("  for RCB: " + report.GetRcbReference());

            if (report.HasTimestamp())
            {
                Console.WriteLine("  timestamp: " + MmsValue.MsTimeToDateTimeOffset(report.GetTimestamp()).ToString());
            }

            MmsValue values = report.GetDataSetValues();

            byte[] entryId = report.GetEntryId();

            if (entryId != null)
            {
                SoapHexBinary shb = new SoapHexBinary(entryId);

                Console.WriteLine("  entryID: " + shb.ToString());
            }

            if (report.HasDataSetName())
            {
                Console.WriteLine("   report data set: " + report.GetDataSetName());
            }

            Console.WriteLine("  report dataset contains " + values.Size() + " elements");

            for (int i = 0; i < values.Size(); i++)
            {
                if (report.GetReasonForInclusion(i) != ReasonForInclusion.REASON_NOT_INCLUDED)
                {
                    Console.WriteLine("    element " + i + " included for reason " + report.GetReasonForInclusion(i).ToString() + " " + values.GetElement(i));
                }

                if (report.HasDataReference())
                {
                    Console.WriteLine("       data-ref: " + report.GetDataReference(i));
                }
            }

            ReportControlBlock rcb = (ReportControlBlock)parameter;

            Console.WriteLine("  For RCB: " + rcb.GetObjectReference() + " Buffered: " + rcb.IsBuffered() +
                              " data-set: " + rcb.GetDataSetReference());
        }
Ejemplo n.º 5
0
        public static void printFiles(IedConnection con, string prefix, string parent)
        {
            bool moreFollows = false;

            List <FileDirectoryEntry> files = con.GetFileDirectoryEx(parent, null, out moreFollows);

            foreach (FileDirectoryEntry file in files)
            {
                Console.WriteLine(prefix + file.GetFileName() + "\t" + file.GetFileSize() + "\t" +
                                  MmsValue.MsTimeToDateTimeOffset(file.GetLastModified()));

                if (file.GetFileName().EndsWith("/"))
                {
                    printFiles(con, prefix + "  ", parent + file.GetFileName());
                }
            }

            if (moreFollows)
            {
                Console.WriteLine("-- MORE FILES AVAILABLE --");
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Gets the tome of control execution as data time offset.
 /// </summary>
 /// <returns>The control execution time as data time offset.</returns>
 public DateTimeOffset GetControlTimeAsDataTimeOffset()
 {
     return(MmsValue.MsTimeToDateTimeOffset(GetControlTime()));
 }