public void addClient(String IPaddress, int dataPort)
        {
            Client c = new Client(IPaddress, dataPort, outputMode);
            bool newClient = true;
            clientLock.WaitOne();
            foreach (Client client in clients)
            {
                if (client.getDataPort() == c.getDataPort() && client.getAddress() == c.getAddress())
                {
                    newClient = false;
                }
            }// foreach
            if (newClient)
            {
                clients.Add(c);
                Console.WriteLine("Manually opened client " + c.getAddress() + ":" + dataPort);
                switch (outputMode)
                {
                    case (OutputType.TacTile):
                        Console.WriteLine("    Sending data using TouchAPI (TacTile) format");
                        break;
                    case (OutputType.Omicron_Legacy):
                        Console.WriteLine("    Sending data using Omicron Legacy format");
                        break;
                    case (OutputType.Omicron):
                        Console.WriteLine("    Sending data using Omicron format");
                        break;
                }

            }
            clientLock.Release();
            parent.updateClientList(getClientList());
        }
        private void addClient(Client c)
        {
            bool newClient = true;
            clientLock.WaitOne();

            foreach (Client client in clients)
            {
                if (client.getDataPort() == c.getDataPort() && client.getAddress() == c.getAddress())
                {
                    newClient = false;

                    //Update client
                    Console.WriteLine("Existing client {0}:{1} updated.", c.getAddress(), c.getDataPort() );
                    client.Update(c);
                }
            }// foreach

            if (newClient)
            {
                clients.Add(c);
                Console.WriteLine("Client {0}:{1} added.", c.getAddress(), c.getDataPort());
                switch (c.getDataFormat())
                {
                    case (OutputType.TacTile):
                        Console.WriteLine("    Sending data using TouchAPI (TacTile) format");
                        break;
                    case (OutputType.Omicron_Legacy):
                        Console.WriteLine("    Sending data using Omicron Legacy format");
                        break;
                    case (OutputType.Omicron):
                        Console.WriteLine("    Sending data using Omicron format");
                        break;
                }
            }
            clientLock.Release();
            parent.updateClientList(getClientList());
        }
Exemplo n.º 3
0
 public void Update(Client c)
 {
     if (c.getAddress() == clientAddress && c.getDataPort() == dataPort)
     {
         if (dataFormat != c.getDataFormat())
         {
             dataFormat = c.getDataFormat();
             //Console.WriteLine("Existing client "+clientAddress+":"+dataPort+" data format updated:");
             switch (dataFormat)
             {
                 case (OmicronServer.OutputType.TacTile):
                     Console.WriteLine("    Requested data using TouchAPI (TacTile) format");
                     break;
                 case (OmicronServer.OutputType.Omicron_Legacy):
                     Console.WriteLine("    Requested data using Omicron Legacy format");
                     break;
                 case (OmicronServer.OutputType.Omicron):
                     Console.WriteLine("    Requested data using Omicron format");
                     break;
             }
         }
     }
 }