예제 #1
0
        private void WriteValue(MmsValue m, string dos, ReasonForInclusion reason)
        {
            try
            {
                switch (m.GetType())
                {
                case MmsType.MMS_ARRAY:
                case MmsType.MMS_STRUCTURE:
                    var size = m.Size();
                    foreach (MmsValue e in m)
                    {
                        WriteValue(e, dos, reason);
                    }
                    break;

                case MmsType.MMS_BOOLEAN:
                    _handler?.Invoke(dos, m.GetBoolean() ? 1 : 0, reason);
                    break;

                case MmsType.MMS_INTEGER:
                    _handler?.Invoke(dos, m.ToInt64(), reason);
                    break;

                case MmsType.MMS_FLOAT:
                    _handler?.Invoke(dos, m.ToDouble(), reason);
                    break;

                case MmsType.MMS_UNSIGNED:
                    _handler?.Invoke(dos, m.ToUint32(), reason);
                    break;

                case MmsType.MMS_UTC_TIME:
                    //Console.WriteLine(dos + " : " + new DateTime(1970, 1, 1).AddMilliseconds(m.GetUtcTimeInMs()).ToString());
                    break;

                case MmsType.MMS_BIT_STRING:
                    //Console.WriteLine(dos + " : " + m + " (Bit)");
                    break;

                case MmsType.MMS_STRING:
                case MmsType.MMS_OCTET_STRING:
                case MmsType.MMS_VISIBLE_STRING:
                case MmsType.MMS_GENERALIZED_TIME:
                case MmsType.MMS_BINARY_TIME:
                case MmsType.MMS_BCD:
                case MmsType.MMS_OBJ_ID:
                case MmsType.MMS_DATA_ACCESS_ERROR:
                default:
                    Console.WriteLine(dos + " : " + m + " - " + m.GetType());
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #2
0
            public bool MoveNext()
            {
                index++;

                if (index >= value.Size())
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
예제 #3
0
        public ReasonForInclusion GetReasonForInclusion(int index)
        {
            if (values == null)
            {
                GetDataSetValues();
                if (values == null)
                {
                    throw new Exception("No ReasonForInclusion available yet");
                }
            }
            int dataSetSize = values.Size();

            if (index >= dataSetSize)
            {
                throw new Exception("data set index out of range (count = " + dataSetSize + ")");
            }
            return((ReasonForInclusion)ClientReport_getReasonForInclusion(self, index));
        }
예제 #4
0
 private void ReportHandler(IntPtr parameter, IntPtr report)
 {
     try
     {
         if (_rep == null)
         {
             _rep = new Reporting(report);
         }
         MmsValue values = _rep.GetDataSetValues();
         for (int i = 0; i < values.Size(); i++)
         {
             var reason = _rep.GetReasonForInclusion(i);
             if (reason != ReasonForInclusion.REASON_NOT_INCLUDED)
             {
                 var dos = _rep.GetDataReference(i);
                 WriteValue(values.GetElement(i), dos == null ? i + "" : dos, reason);
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }