Ejemplo n.º 1
0
        static void DataReceivedHandler(
            object sender,
            SerialDataReceivedEventArgs e)
        {
            SerialPort sp = (SerialPort)sender;
            //sp.Write(GET_TIME, 0, GET_TIME.Length);
            //Thread.Sleep(500);//Даем больше времени на ожидание данных
            //string readex = newPort.ReadExisting();//Убираем эту строку и заменяем на
            int byteRecieved = sp.BytesToRead;

            byte[] messByte = new byte[byteRecieved];
            sp.Read(messByte, 0, byteRecieved);
            string indata = BitConverter.ToString(messByte);

            indata = indata.Replace('-', ' ');
            // MultiServer.SocketServer.WebSocketServices.Broadcast(indata);
            //Console.WriteLine("Data Received:");
            //  RaceThread thr = new RaceThread(new AdminControl(2016));
            // AMB20RX Res = thr.AMB20_Decode(indata);
            // Object obj = new Object("method": "data":Res);
            Webanounserdata data = new Webanounserdata {
                method = "newlap", data = indata
            };

            anouncer.action(data);
            //Console.WriteLine(Res.Transponder);
        }
Ejemplo n.º 2
0
        public void action(Webanounserdata data)
        {
            string serialized = JsonConvert.SerializeObject(data);

            MultiServer.SocketServer.WebSocketServices.Broadcast(serialized);
        }