Exemplo n.º 1
0
Arquivo: NCC.cs Projeto: sopel30/tsst2
 public NCC(Manager manager, LRM linkResourceManager, networkLibrary.transportClient client, MainWindow window)
 {
     this.manager = manager;
     this.network = client;
     ConnectionController = new CC(this.network, window);
     this.lrm = linkResourceManager;
     this.rc = new RC(manager, linkResourceManager, ConnectionController);
 }
Exemplo n.º 2
0
 public NCC(Manager manager, LRM linkResourceManager, networkLibrary.transportClient client, MainWindow window)
 {
     this.manager         = manager;
     this.network         = client;
     ConnectionController = new CC(this.network, window);
     this.lrm             = linkResourceManager;
     this.rc = new RC(manager, linkResourceManager, ConnectionController);
 }
Exemplo n.º 3
0
 public CPCC(Logs logWindow, string ip, string port, string myName, string myId, string networkController)
 {
     this.signalizationNetwork = new transportClient(ip, port);
     this.logs = logWindow;
     msgListener = new transportClient.NewMsgHandler(onNewMessage);
     signalizationNetwork.OnNewMessageRecived += msgListener;
     this.myName = myName;
     this.myId = myId;
     this.nc = networkController;
     sendMessage(myId + "@" + "CallControll"+"#");
     Thread.Sleep(100);
     sendMessage(nc+"@CallControll#MyParams#"+myId+"#");
     logs.addLog("Service started correctly", true, Constants.LOG_INFO);
 }
Exemplo n.º 4
0
Arquivo: Node.cs Projeto: 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
                }
Exemplo n.º 5
0
        public void stopService()
        {
            try
            {
                client.OnNewMessageRecived -= messageHandler;
                client.OnNewSignalization -= signHandler;
                messageHandler = null;
                signHandler = null;
                client.stopService();
                client = null;
            }
            catch
            {

            }
        }
Exemplo n.º 6
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;
            }
        }
Exemplo n.º 7
0
 private void newSignalization(object a, MessageArgs e)
 {
     addLog(logs, e.message, Constants.LOG_ERROR);
     this.mainWindow.Dispatcher.Invoke(
         System.Windows.Threading.DispatcherPriority.Normal,
         new Action(() =>
         {
             this.mainWindow.startButton.IsEnabled = true;
         })
     );
     cloud.OnNewMessageRecived -= newMessageHandler;
     cloud.OnNewSignalization -= signHandler;
     newMessageHandler = null;
     signHandler = null;
     cloud.stopService();
     cloud = null;
 }
Exemplo n.º 8
0
 public void stopService()
 {
     try
     {
         if (cloud != null)
         {
             cloud.OnNewMessageRecived -= newMessageHandler;
             cloud.OnNewSignalization -= signHandler;
             signalizationNetwork.OnNewMessageRecived -= orderListener;
             manager.OnNewMessageRecived -= newOrderHandler;
             signHandler = null;
             newMessageHandler = null;
             newOrderHandler = null;
             orderListener = null;
             cloud.stopService();
             cloud = null;
             manager.stopService();
             manager = null;
             signalizationNetwork.stopService();
             signalizationNetwork = null;
         }
     }
     catch {
         cloud.OnNewMessageRecived -= newMessageHandler;
         cloud.OnNewSignalization -= signHandler;
         manager.OnNewMessageRecived -= newOrderHandler;
         signHandler = null;
         newMessageHandler = null;
         newOrderHandler = null;
         cloud = null;
         manager = null;
     }
 }
Exemplo n.º 9
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);
            }
        }
Exemplo n.º 10
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);

            }
        }
Exemplo n.º 11
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);

            }
        }