예제 #1
0
        /// <summary>
        /// Send software version to HostController
        /// </summary>
        private void SendVersionFileToController()
        {
            // inicialmente esperamos 10 segundos para que el searcher tenga tiempo suficiente de realizar su búsqueda
            Thread.Sleep(10000);

            do
            {
                try
                {
                    m_mutexHostControllerEndpoints.WaitOne();
                    foreach (EndpointAddress ep in m_hostControllerEndpoints)
                    {
                        //Open connection
                        BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
                        JBCHostControllerServiceClient serviceClient = new JBCHostControllerServiceClient(binding, ep);

                        serviceClient.Open();
                        serviceClient.CheckUpdateConnectedStationController(m_swVersion);
                        serviceClient.Close();
                    }
                }
                catch (Exception ex)
                {
                    LoggerModule.logger.Error(System.Reflection.MethodInfo.GetCurrentMethod().Name + ". Error: " + ex.Message);
                }
                finally
                {
                    m_mutexHostControllerEndpoints.ReleaseMutex();
                }

                Thread.Sleep(TIME_SEND_VERSION_HOST_CONTROLLER);
            } while (true);
        }