The updated code works the same with Status([1:12]) as it does with 
vector(Dstc["StatusW"]).

type Status
   Valve1::Vector{Bool}
   Valve2::Vector{Bool}
   Valve3::Vector{Bool}
   Valve4::Vector{Bool}
   Valve5::Vector{Bool}
   Valve6::Vector{Bool}
   Valve7::Vector{Bool}
   Valve8::Vector{Bool}
 
   # Constructor for Status type
   function Status(vals::Array{Int64})
   l = int64(length(vals))
 
   Valve1 = Array(Bool,l)
   Valve2 = Array(Bool,l)
   Valve3 = Array(Bool,l)
   Valve4 = Array(Bool,l)
   Valve5 = Array(Bool,l)
   Valve6 = Array(Bool,l)
   Valve7 = Array(Bool,l)
   Valve8 = Array(Bool,l)
 
   # Parse Inputs
   for i=1:l
      # Byte 1
      Valve1[i] = vals[i] & 2^(1-1) > 0
      Valve2[i] = vals[i] & 2^(2-1) > 0
      Valve3[i] = vals[i] & 2^(3-1) > 0
      Valve4[i] = vals[i] & 2^(4-1) > 0
      Valve5[i] = vals[i] & 2^(5-1) > 0
      Valve6[i] = vals[i] & 2^(6-1) > 0
      Valve7[i] = vals[i] & 2^(7-1) > 0
      Valve8[i] = vals[i] & 2^(8-1) > 0
   end # End of conversion
 

   new(Valve1,Valve2,Valve3,Valve4,Valve5,Valve6,Valve7,Valve8)
 

   end # End of constructor
end # End of type

statuses = Status(vector(Dstc["StatusW"]))
julia> typeof(statuses) Nothing (constructor with 1 method)

julia> statuses.Valve1 ErrorException("type Nothing has no field Valve1")



julia> x = Status([1:12])

julia> typeof(x) Nothing (constructor with 1 method)

julia> x.Valve1 ErrorException("type Nothing has no field Valve1")

Reply via email to