Ejemplo n.º 1
0
Archivo: Node.cs Proyecto: sopel30/tsst
        public void startService()
        {
            try
            {
                cloud = new transportClient(CloudIP, CloudPort);
                newMessageHandler = new transportClient.NewMsgHandler(newMessageRecived);
                cloud.OnNewMessageRecived += newMessageHandler;

                manager = new transportClient(ManagerIP, ManagerPort);
                newOrderHandler = new transportClient.NewMsgHandler(newOrderRecived);
                manager.OnNewMessageRecived += newOrderHandler;

                cloud.sendMessage(this.NodeId+"#");

                addLog(logs, Constants.SERVICE_START_OK, Constants.LOG_INFO);

                this.STM = new SynchronousTransportModule[portsOutTemp.Count];
                for (int i = 0; i < STM.Length; i++)
                {
<<<<<<< HEAD
                    this.STM[i] = new SynchronousTransportModule(3);// TUTAJ DODAC JESZCZE PARAMETR Z XMLA
=======
                    this.STM[i] = new SynchronousTransportModule(Constants.STM_CAPACITY);// TUTAJ DODAC JESZCZE PARAMETR Z XMLA
>>>>>>> 10ae7036948c3f9ffb9df1f3a03fce21780a3fac
                }
Ejemplo n.º 2
0
        public void startService()
        {
            try
            {
                messageHandler = new transportClient.NewMsgHandler(newMessageRecived);
                signHandler = new transportClient.NewSignalization(newSignalization);
                client = new transportClient(CloudIP, CloudPort);
                client.OnNewMessageRecived += messageHandler;
                client.OnNewSignalization += signHandler;
                client.sendMessage(nodeName + "#");
                displayStatusMessage(Constants.SERVICE_START_OK, Constants.LOG_INFO);
            }

            catch
            {
                displayStatusMessage(Constants.SERVICE_START_ERROR, Constants.LOG_ERROR);
            }

            if (this.isStarted())
            {
                this.mainWindow.ConnectButton.IsEnabled = false;
                this.mainWindow.statusBar.Text = "Connected";
                this.mainWindow.Button_1.IsEnabled = true;
                this.mainWindow.statusBar.Foreground = Brushes.Green;
            }
        }
Ejemplo n.º 3
0
        public void startService()
        {
            try
            {
                messageHandler = new transportClient.NewMsgHandler(newMessageRecived);
                signHandler = new transportClient.NewSignalization(newSignalization);
                client = new transportClient(CloudIP, CloudPort);
                client.OnNewMessageRecived += messageHandler;
                client.OnNewSignalization += signHandler;
                client.sendMessage(nodeName + "#");
                displayStatusMessage(Constants.SERVICE_START_OK, Constants.LOG_INFO);
            }

            catch
            {
                displayStatusMessage(Constants.SERVICE_START_ERROR, Constants.LOG_ERROR);

            }
        }
Ejemplo n.º 4
0
        public void startService()
        {
            try
            {

                cloud = new transportClient(CloudIP, CloudPort);
                signalizationNetwork = new transportClient(CloudIP, CloudPort);
                newMessageHandler = new transportClient.NewMsgHandler(newMessageRecived);
                orderListener = new transportClient.NewMsgHandler(newControlOrder);
                signHandler = new transportClient.NewSignalization(newSignalization);

                cloud.OnNewSignalization += signHandler;
                cloud.OnNewMessageRecived += newMessageHandler;
                signalizationNetwork.OnNewMessageRecived += orderListener;

                cloud.sendMessage(this.NodeId + "#");
                signalizationNetwork.sendMessage(this.NodeId + "@CallControll#");
                Thread.Sleep(500);
                signalizationNetwork.sendMessage(this.networkController+"@CallControll#MyParams#" + this.NodeId);

                addLog(logs, Constants.SERVICE_START_OK, Constants.LOG_INFO);

                this.STM = new SynchronousTransportModule[portsOutTemp.Count];
                for (int i = 0; i < STM.Length; i++)
                {
                    this.STM[i] = new SynchronousTransportModule(3);// TUTAJ DODAC JESZCZE PARAMETR Z XMLA
                }

                startSending();

                manager = new transportClient(ManagerIP, ManagerPort);
                newOrderHandler = new transportClient.NewMsgHandler(newOrderRecived);
                manager.OnNewMessageRecived += newOrderHandler;

            }
            catch
            {
                addLog(logs, Constants.SERVICE_START_ERROR, Constants.LOG_ERROR);
                if(cloud==null)
                    addLog(logs, Constants.CANNOT_CONNECT_TO_CLOUD, Constants.LOG_ERROR);
                else if(!cloud.isConnected())
                    addLog(logs, Constants.CANNOT_CONNECT_TO_CLOUD, Constants.LOG_ERROR);
                if(manager==null)
                    addLog(logs, Constants.CANNOT_CONNECT_TO_MANAGER, Constants.LOG_ERROR);
                else if(!manager.isConnected())
                    addLog(logs, Constants.CANNOT_CONNECT_TO_MANAGER, Constants.LOG_ERROR);
            }
        }
Ejemplo n.º 5
0
        public void startService()
        {
            try
            {
                manager.Init(linkResourceManager);
                addLog(window.logList, "LRM to CC: Local topology", Constants.LOG_INFO);
                signalization = new transportClient(CloudIp, CloudPort);
                msgHandler = new transportClient.NewMsgHandler(newMessageReceived);
                signalization.OnNewMessageRecived += msgHandler;
                signalization.sendMessage(nccname+"@CallControll"+"#");
                networkCallController = new NCC(manager, linkResourceManager, signalization, window);
            }
            catch
            {
                addLog(window.logList, Constants.SERVICE_START_ERROR, Constants.LOG_ERROR);

            }
        }