Ejemplo n.º 1
0
        private void sendHard(string message, string slot)
        {
            try
            {
                logTextBox.AppendText("DEBISAHFOIS");
                Dictionary <int, VirtualContainer3> vc3List = new Dictionary <int, VirtualContainer3>();
                VirtualContainer3 msg = new VirtualContainer3(adaptation(), message);
                vc3List.Add(int.Parse(slot), msg);
                STM1          frame = new STM1(adaptation(), vc3List);
                List <string> temp  = new List <string>();
                temp.Add(this.virtualIP);
                Signal signal = new Signal(virtualPort, frame, temp);
                string data   = JMessage.Serialize(JMessage.FromValue(signal));
                writer.Write(data);
                foreach (KeyValuePair <int, VirtualContainer3> v in frame.vc4.vc3List)
                {
                    Log1("OUT", virtualIP, virtualPort.ToString(), v.Key, "VC-3", v.Value.POH.ToString(), v.Value.C3);
                }

                sendingTextBox.Clear();
            }
            catch (Exception e)
            {
                Log2("ERR", "Error sending signal");
            }
        }
Ejemplo n.º 2
0
        private void sendSwiched(string message)
        {
            try
            {
                Dictionary <int, VirtualContainer3> vc3List = new Dictionary <int, VirtualContainer3>();
                foreach (int slot in slots)
                {
                    //Log2("DEBUG", "sloty od controla: "+slot);
                    VirtualContainer3 vc3 = new VirtualContainer3(adaptation(), "Slot" + slot + " : " + message);
                    vc3List.Add(slot, vc3);
                }
                STM1 frame = new STM1(adaptation(), vc3List);
                //SYGNAL
                List <string> temp = new List <string>();
                temp.Add(this.virtualIP);
                Signal signal = new Signal(virtualPort, frame, temp);
                string data   = JMessage.Serialize(JMessage.FromValue(signal));
                writer.Write(data);
                foreach (KeyValuePair <int, VirtualContainer3> v in frame.vc4.vc3List)
                {
                    Log1("OUT", virtualIP, virtualPort.ToString(), v.Key, "VC-3", v.Value.POH.ToString(), v.Value.C3);
                }

                sendingTextBox.Clear();
            }
            catch (Exception e)
            {
                Log2("ERR", "Error sending signal");
            }
        }
Ejemplo n.º 3
0
        private void sendPeriodically(int period, string message)
        {
            Thread myThread = new Thread(async delegate()
            {
                bool isVc3 = false;
                Signal signal;
                STM1 frame;

                string data;
                Dictionary <int, VirtualContainer3> vc3List = new Dictionary <int, VirtualContainer3>();
                foreach (int slot in slots)
                {
                    VirtualContainer3 vc3 = new VirtualContainer3(adaptation(), "Slot" + slot + " :" + message);
                    vc3List.Add(slot, vc3);
                }
                frame = new STM1(adaptation(), vc3List);
                //SYGNAL
                List <string> temp = new List <string>();
                temp.Add(this.virtualIP);
                signal = new Signal(virtualPort, frame, temp);
                data   = JMessage.Serialize(JMessage.FromValue(signal));



                while (cyclic_sending)
                {
                    try
                    {
                        writer.Write(data);
                        foreach (KeyValuePair <int, VirtualContainer3> v in frame.vc4.vc3List)
                        {
                            Log1("OUT", virtualIP, virtualPort.ToString(), v.Key, "VC-3", v.Value.POH.ToString(), v.Value.C3);
                        }

                        await Task.Delay(TimeSpan.FromMilliseconds(period));
                    }
                    catch (Exception e)
                    {
                        Log2("ERR", "Error sending signal: ");
                        break;
                    }
                }
            });

            myThread.Start();
        }