شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Port

Public general use code classes and xml files that we've compiled and used over the years:

Huawei's Port support class of Next Generation Network'a (NGN's) business model.

   1:  namespace Ia.Ngn.Cl.Model.Business.Huawei
   2:  {
   3:      ////////////////////////////////////////////////////////////////////////////
   4:   
   5:      /// <summary publish="true">
   6:      /// Huawei's Port support class of Next Generation Network'a (NGN's) business model.
   7:      /// </summary>
   8:      /// 
   9:      /// <remarks> 
  10:      /// Copyright © 2016-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  11:      ///
  12:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  13:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  14:      ///
  15:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  16:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  17:      /// 
  18:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  19:      /// 
  20:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  21:      /// </remarks> 
  22:      public partial class Port
  23:      {
  24:          /// <summary/>
  25:          public Port() { }
  26:   
  27:          ////////////////////////////////////////////////////////////////////////////
  28:   
  29:          /// <summary>
  30:          ///
  31:          /// </summary>
  32:          public static string PortId(int devId, int fn, int sn, int pn)
  33:          {
  34:              /*
  35:               * Id: OLT_01 Id-Frame-Slot-Port-OnuID
  36:               * FN    SN   PN   ONTID
  37:               * 
  38:               * Dev: did
  39:               * Board: FN SN
  40:               * Port: FN SN PN
  41:               * Ont: FN SN PN ONTID
  42:               * 
  43:               * /// FN INTEGER 0-255 Indicates the subrack ID of the OLT. 
  44:               * /// SN INTEGER 0-35 Indicates the slot ID of the OLT. 
  45:               * /// PN INTEGER 0-63 Indicates the port ID of the OLT. 
  46:               * /// ONTID INTEGER 0-255 NOTE If the UNI port is of 10G GPON, the value range is 0-255; if the UNI port is of 1G GPON, the value range is 0-127. Indicates the ONT ID. 
  47:               */
  48:   
  49:              string id;
  50:   
  51:              if (devId > 0 && fn >= 0 && fn <= 255 && sn >= 0 && sn <= 35 && pn >= 0 && pn <= 63)
  52:              {
  53:                  id = devId.ToString() + fn.ToString().PadLeft(3, '0') + sn.ToString().PadLeft(2, '0') + pn.ToString().PadLeft(2, '0');
  54:              }
  55:              else
  56:              {
  57:                  throw new System.ArgumentOutOfRangeException("fn, sn, pn", "fn, sn, or pn is out of range");
  58:              }
  59:   
  60:              return id;
  61:          }
  62:   
  63:          ////////////////////////////////////////////////////////////////////////////
  64:   
  65:          /// <summary>
  66:          ///
  67:          /// </summary>
  68:          public static string PortId(string boardId, int pn)
  69:          {
  70:              string id;
  71:   
  72:              if (boardId.Length > 0 && pn >= 0 && pn <= 63)
  73:              {
  74:                  id = boardId + pn.ToString().PadLeft(2, '0');
  75:              }
  76:              else
  77:              {
  78:                  throw new System.ArgumentOutOfRangeException("pn", "pn is out of range");
  79:              }
  80:   
  81:              return id;
  82:          }
  83:   
  84:          ////////////////////////////////////////////////////////////////////////////
  85:          ////////////////////////////////////////////////////////////////////////////
  86:      }
  87:   
  88:      ////////////////////////////////////////////////////////////////////////////
  89:      ////////////////////////////////////////////////////////////////////////////
  90:  }