Esempio n. 1
0
 public GemSession(GemServer server)
 {
     Server                      = server;
     ReceiveEventArgs            = new SocketAsyncEventArgs();
     ReceiveEventArgs.Completed += OnAsyncCompleted;
     Id     = Guid.NewGuid();
     Packet = new Bin48NetTime();
     ReceiveEventArgs.SetBuffer(new byte[BufferSize]);
     Lock = new object();
 }
Esempio n. 2
0
        public void ProcessPacket(Bin48NetTime packet)
        {
            // Log output
            Console.WriteLine(packet.Gem.ToString());
            OutputFile.LogPacket(packet.Gem);

            // Save the previous value keyed by the GEM serial number
            // Make a deep copy so that the values are not modified as the packet is reused
            Gems.TryAdd(packet.Gem.SerialNumber, new Gem(packet.Gem));

            // TODO : Use the previous value to calculate the consumption / delta values
        }