private static void CommandThreadMain(object state) { CommandThreadState cmdState = (CommandThreadState)state; Action <byte[]> handler = delegate(byte[] data) { HandleCommandFrame(data, cmdState.Queue); }; CommonThreadMain(state, handler); }
public DroneIo(string hostName) { cmdClient = new UdpClient(hostName, CommandPort); videoClient = new UdpClient(hostName, VideoPort); CommandThreadState cmdState = new CommandThreadState() { Client = cmdClient, Queue = commandQueue }; EventThreadState eventState = new EventThreadState() { Client = cmdClient, Queue = commandQueue, Handler = HandleCommandEvent }; VideoThreadState videoState = new VideoThreadState() { Client = cmdClient }; cmdThread.Start(cmdState); videoThread.Start(videoState); eventThread.Start(eventState); RequestConnection(); }