Пример #1
0
        public static void Main(string[] args)
        {
            ConcurrentQueue <IDeviceDiffSet> EventQueue = new ConcurrentQueue <IDeviceDiffSet>();

            String ELVMAX_Cube_IP_Adress = "192.168.178.82";
            Int32  ELVMAX_Cube_Port      = 62910;

            MAXMonitoringThread ELVMax = new MAXMonitoringThread(ELVMAX_Cube_IP_Adress,             // the IP Adress of the cube
                                                                 ELVMAX_Cube_Port,                  // the port used by the cube
                                                                 EventQueue                         // the queue in which the handling thread puts the events
                                                                 );

            Console.WriteLine("Starting ELV MAX Handling Thread...");

            // start-up the thread...
            Thread ELVMaxThread = new Thread(new ThreadStart(ELVMax.Run));

            ELVMaxThread.Start();

            // wait for successful connect...
            while (!ELVMax.connected)
            {
                Thread.Sleep(100);
            }

            Console.WriteLine("Connected!");

            // ELVMax.theHouse now contains all information about the current ELV MAX cube configuration
            // from now on the thread generates diffs to that every 10 seconds (or what you said...)
            List <IMAXDevice> Devices = ELVMax.theHouse.GetAllDevices();

            foreach (IMAXDevice _device in Devices)
            {
                Console.WriteLine(_device.Name + " - " + _device.RFAddress);
            }

            while (true)
            {
                if (EventQueue.Count != 0)
                {
                    foreach (IDeviceDiffSet _diffset in EventQueue)
                    {
                        // here are the diffs...
                        Console.WriteLine(_diffset);
                    }
                }

                Thread.Sleep(1000);
            }
        }
Пример #2
0
 public HttpServer(Int32 HTTP_Port, String HTTP_ListeningIP, String HTTP_DocumentRoot, TinyOnDiskStorage _Storage, TinyOnDiskStorage _LatitudeStorage, XS1Configuration _XS1_Configuration, ConsoleOutputLogger Logger, MAXMonitoringThread _ELVMAXMonitoringThread, bool AuthEnabled, String Uname, String Pword, String StartAdrFilter)
 {
     HTTPServer_Port         = HTTP_Port;
     HTTPServer_ListeningIP  = HTTP_ListeningIP;
     HTTPServer_DocumentRoot = HTTP_DocumentRoot;
     Storage                = _Storage;
     XS1_Configuration      = _XS1_Configuration;
     ConsoleOutputLogger    = Logger;
     ELVMAXMonitoringThread = _ELVMAXMonitoringThread;
     LatitudeStorage        = _LatitudeStorage;
     AuthorizationEnabled   = AuthEnabled;
     Username               = Uname;
     Password               = Pword;
     AuthDisabledForAdressesThatStartWith = StartAdrFilter;
 }