public void SendEvents(KnxWriter writer)
 {
     KnxEvent ev;
     while (_transferQueue.TryDequeue(out ev))
     {
         writer.Write(ev.Address, ev.Data);
     }
 }
Ejemplo n.º 2
-1
 public static void Run(Action<TelegramGateway, KnxWriter> eventLoop, bool useDefault = true)
 {
     using (var router = new RouterActor(useDefault))
     {
         TelegramGateway gateway = new TelegramGateway();
         LoosePipeline<ReceivedGroupTelegramEventArgs> pipe = new LoosePipeline<ReceivedGroupTelegramEventArgs>((args) =>
         {
             gateway.RouteGroupTelegram(args.Telegram);
         });
         EventHandler<ReceivedGroupTelegramEventArgs> ReceivedGroupTelegram = (o, args) =>
             {
                 pipe.Insert(args);
             };
         KnxWriter writer = new KnxWriter();
         EventHandler<WriteGroupTelegramEventArgs> writeTelegram = (o, args) =>
             {
                 router.Write(args.Address, args.Data);
             };
         router.ReceivedGroupTelegram += ReceivedGroupTelegram;
         writer.WriteGroupTelegram += writeTelegram;
         eventLoop(gateway, writer);
         writer.WriteGroupTelegram -= writeTelegram;
         router.ReceivedGroupTelegram -= ReceivedGroupTelegram;
         pipe.Shutdown(true);
     }
 }