Ejemplo n.º 1
0
        public static void StartNetworkServices(GTM.GHIElectronics.EthernetENC28 ethernetENC28, string deviceName, bool connected, string uniqueDeviceIdentifier = "")
        {
            ethernetENC28.UseThisNetworkInterface();
            while (!ethernetENC28.IsNetworkConnected)
            {
                Thread.Sleep(1000);
            }

            sm = Utilities.StartNetworkServices(deviceName, connected, uniqueDeviceIdentifier);
        }
Ejemplo n.º 2
0
        public void Initialise(string deviceName, bool connected)
        {
            deviceName       = deviceName.Length > 5 ? deviceName.Substring(0, 5) : deviceName;
            deviceName       = deviceName.Length == 0 ? "emul" : deviceName;
            NetworkConnected = connected;
            ConfigurationManager.DeviceName = deviceName;

            if (!connected)
            {
                return;
            }

            ethernetENC28.UseThisNetworkInterface();

            while (!ethernetENC28.IsNetworkConnected)
            {
                Thread.Sleep(1000);
            }

            Utilities.SetTime(connected);
            mm = new ServiceManager(ConfigurationManager.Broker, connected);
            mm.OnMessageReceived += mm_OnMqqtReceived;
        }