Пример #1
0
 public EIBAddress(byte[] address, bool is_logical)
 {
     _is_logical = is_logical;
     _high       = address[0];
     _low        = address[1];
     _group_type = GROUP_LEVEL_FORMAT.GROUP_3_LEVEL_FORMAT;
 }
Пример #2
0
 public EIBAddress(ushort address, bool is_logical)
 {
     _is_logical = is_logical;
     _high       = (ushort)(address & 0xFF00);
     _low        = (ushort)(address & 0x00FF);
     _group_type = GROUP_LEVEL_FORMAT.GROUP_3_LEVEL_FORMAT;
 }
Пример #3
0
 public EIBAddress(string address)
 {
     if (address.IndexOf('/') != -1)
     {
         _is_logical = true;
         string[] tokens = address.Split(new char[] { '/' });
         if (tokens.Length == 3)
         {
             ushort high = ushort.Parse(tokens[0]);
             ushort low  = ushort.Parse(tokens[1]);
             _high       = (ushort)((high << 3) | (low & 0x0007));
             _low        = ushort.Parse(tokens[2]);
             _group_type = GROUP_LEVEL_FORMAT.GROUP_3_LEVEL_FORMAT;
         }
         else if (tokens.Length == 2)
         {
             ushort high = ushort.Parse(tokens[0]);
             ushort low  = ushort.Parse(tokens[1]);
             _high       = (ushort)(high << 3 | low >> 8);
             _low        = (ushort)(low & 0x00FF);
             _group_type = GROUP_LEVEL_FORMAT.GROUP_2_LEVEL_FORMAT;
         }
         else
         {
             throw new Exception("EIB Address error. Wrong group address syntax");
         }
     }
     else if (address.IndexOf('.') != -1)
     {
         _is_logical = false;
         string[] tokens = address.Split(new char[] { '.' });
         if (tokens.Length == 3)
         {
             ushort high = ushort.Parse(tokens[0]);
             ushort low  = ushort.Parse(tokens[1]);
             _high       = (ushort)((high << 4) | (low & 0x000F));
             _low        = ushort.Parse(tokens[2]);
             _group_type = GROUP_LEVEL_FORMAT.GROUP_3_LEVEL_FORMAT;
         }
         else
         {
             throw new Exception("EIB Address error. Wrong group address syntax");
         }
     }
     else
     {
         throw new Exception("EIB Address error. Need . or / separator");
     }
 }
Пример #4
0
 public EIBAddress(string address)
 {
     if (address.IndexOf('/') != -1)
     {
         _is_logical = true;
         string[] tokens = address.Split(new char[] { '/' });
         if (tokens.Length == 3)
         {
             ushort high = ushort.Parse(tokens[0]);
             ushort low = ushort.Parse(tokens[1]);
             _high = (ushort)((high << 3) | (low & 0x0007));
             _low = ushort.Parse(tokens[2]);
             _group_type = GROUP_LEVEL_FORMAT.GROUP_3_LEVEL_FORMAT;
         }
         else if (tokens.Length == 2)
         {
             ushort high = ushort.Parse(tokens[0]);
             ushort low = ushort.Parse(tokens[1]);
             _high = (ushort)(high << 3 | low >> 8);
             _low = (ushort)(low & 0x00FF);
             _group_type = GROUP_LEVEL_FORMAT.GROUP_2_LEVEL_FORMAT;
         }
         else
         {
             throw new Exception("EIB Address error. Wrong group address syntax");
         }
     }
     else if (address.IndexOf('.') != -1)
     {
         _is_logical = false;
         string[] tokens = address.Split(new char[] { '.' });
         if (tokens.Length == 3)
         {
             ushort high = ushort.Parse(tokens[0]);
             ushort low = ushort.Parse(tokens[1]);
             _high = (ushort)((high << 4) | (low & 0x000F));
             _low = ushort.Parse(tokens[2]);
             _group_type = GROUP_LEVEL_FORMAT.GROUP_3_LEVEL_FORMAT;
         }
         else
         {
             throw new Exception("EIB Address error. Wrong group address syntax");
         }
     }
     else
     {
         throw new Exception("EIB Address error. Need . or / separator");
     }
 }
Пример #5
0
 public EIBAddress(byte[] address, bool is_logical)
 {
     _is_logical = is_logical;
     _high = address[0];
     _low = address[1];
     _group_type = GROUP_LEVEL_FORMAT.GROUP_3_LEVEL_FORMAT;
 }
Пример #6
0
 public EIBAddress(ushort address, bool is_logical)
 {
     _is_logical = is_logical;
     _high = (ushort)(address & 0xFF00);
     _low = (ushort)(address & 0x00FF);
     _group_type = GROUP_LEVEL_FORMAT.GROUP_3_LEVEL_FORMAT;
 }