Exemplo n.º 1
0
 /**
  * ETHERNET SECTION
  */
 private void InitEthernet()
 {
     ethernet.NetworkDown += ethernet_NetworkDown;
     ethernet.NetworkUp   += ethernet_NetworkUp;
     ethernet.UseStaticIP(IP, NETMASK, GATEWAY);
     if (!ethernet.NetworkInterface.Opened)
     {
         ethernet.NetworkInterface.Open();
     }
 }
Exemplo n.º 2
0
        public static void Init(EthernetJ11D _ethernetJ11D)
        {
            // Load ip from settings
            String gadgeteerIp = SettingsManager.Get(SettingsManager.LockIp);

            ethernetJ11D = _ethernetJ11D;
            ethernetJ11D.UseThisNetworkInterface();
            ethernetJ11D.UseStaticIP(gadgeteerIp, "255.255.255.0", "192.168.100.1");
            ethernetJ11D.NetworkUp   += NetworkUp;
            ethernetJ11D.NetworkDown += NetworkDown;

            // Data is not yet loaded, data source is unknown
            ChangeDataSource(DataSourceUnknown);

            // Load users from cache
            if (CacheManager.Load(userList, CacheManager.UsersCacheFile))
            {
                DebugOnly.Print(userList.Count + " users loaded from cache!");

                // Data source is now cache
                ChangeDataSource(DataSourceCache);
            }
            else
            {
                // Empty data cache is assumed as an error!
                if (DataSourceChanged != null)
                {
                    DataSourceChanged(DataSourceError);
                }

                // Clear user list
                userList.Clear();
            }

            // Load logs from cache if any
            if (CacheManager.Load(logList, CacheManager.LogsCacheFile))
            {
                DebugOnly.Print(logList.Count + " logs loaded from cache!");
            }
            else
            {
                // Clear log list
                logList.Clear();
            }

            initialized = true;
        }