Esempio n. 1
0
 protected static void writeOptional(ByteStream source, Encodable type, int contextId)
 {
     if (type == null)
     {
         return;
     }
     write(source, type, contextId);
 }
Esempio n. 2
0
        private static Encodable readWrapped(ByteStream source, Type type, int contextId)
        {
            popStart(source, contextId);
            Encodable result = read(source, type);

            popEnd(source, contextId);
            return(result);
        }
Esempio n. 3
0
 // Read and write encodable
 protected static void writeEncodable(ByteStream source, Encodable type, int contextId)
 {
     if (type.GetType().IsSubclassOf(typeof(Primitive.Primitive)))
     {
         ((Primitive.Primitive)type).WriteEncodable(source, contextId);
     }
     else
     {
         type.write(source, contextId);
     }
 }
Esempio n. 4
0
        protected static Encodable read(ByteStream source, Type type)
        {
            if (type.IsSubclassOf(typeof(Primitive.Primitive)))
            {
                return(Primitive.Primitive.CreatePrimitive(source));
            }

            var       constructor = type.GetConstructor(new Type[] { typeof(ByteStream) });
            Encodable obj         = (Encodable)constructor.Invoke(new object[] { source });

            return(obj);
        }
Esempio n. 5
0
        protected static Encodable readSequenceType(ByteStream source, Type type, int contextId)
        {
            popStart(source, contextId);
            Encodable result = null;

            try
            {
                var constructor = type.GetConstructor(new Type[] { typeof(ByteStream), typeof(int) });
                result = (Encodable)constructor.Invoke(new object[] { source, contextId });
            }
            catch (System.Exception e)
            {
                throw new BACnetException(e);
            }
            popEnd(source, contextId);
            return(result);
        }
Esempio n. 6
0
 protected static void write(ByteStream source, Encodable type, int contextId)
 {
     type.write(source, contextId);
 }
Esempio n. 7
0
 //
 // Basic read and write. Pretty trivial.
 protected static void write(ByteStream source, Encodable type)
 {
     type.write(source);
 }