private static void OnSilicomData(Socket s, Packet packet, params object[] args)
        {
            SilicomData data = JsonConvert.DeserializeObject <SilicomData>(args[0].ToString());

            // TODO
            SilicomClient.Instance.QueueData(data);
        }
Esempio n. 2
0
        private void FixedUpdate()
        {
            // TODO : Ask for server every X, or does the server automatically send every X after a successful connexion ?
            // Do this in another thread ?
            // If done in main thread, spread the load across multiple frame ? -> careful about accumulation

            while (_dataQueue.Count > 0)
            {
                SilicomData data = _dataQueue.Dequeue();

                if (_equipments.ContainsKey(data.EquipmentName))
                {
                    _equipments[data.EquipmentName].ReceiveData(data);
                }
            }
        }
Esempio n. 3
0
 public void SendData(SilicomData data)
 {
     serverHandler.SendData(data);
 }
Esempio n. 4
0
 public void QueueData(SilicomData data)
 {
     _dataQueue.Enqueue(data);
 }
Esempio n. 5
0
 public abstract void SendData(SilicomData data);
Esempio n. 6
0
 public abstract void ReceiveData(SilicomData data);
 public override void SendData(SilicomData data)
 {
     _socket.Emit("SILICOM_DATA", JsonConvert.SerializeObject(data));
 }