Exemplo n.º 1
0
 public BoardControl()
 {
     InitializeComponent();
     calculateCellSizes();
     brd = new cBoard(_boardDimension, _boardDimension);
 }
Exemplo n.º 2
0
 public void Reset()
 {
     brd = new cBoard(_boardDimension, _boardDimension);
     Invalidate();
 }
Exemplo n.º 3
0
 public NauCom(
     Protocols p,
     string SerialPort = "ANY",
     NauBeeChannels nWirelessChannel = NauBeeChannels.CHANNEL_0,
     bool bPassiveListenerMode       = false,
     int SelectedGroup  = 15,
     int teamDispLength = 24)
 {
     this.Protocol            = p;
     this.PassiveListenerMode = bPassiveListenerMode;
     this._teamDispLength     = teamDispLength;
     this.Board = new cBoard(this);
     this.Com   = new Communication(this.Board);
     if (this.Protocol == Protocols.NG12)
     {
         this.PacketBuilder = (iPacketBuilder) new PacketBuilderNG12(this, this.Board);
     }
     else
     {
         if (this.Protocol == Protocols.NG08Direct && !SttyExecution.IsPlatformCompatible())
         {
             throw new PlatformNotSupportedException("This serial implementation only works on platforms with stty");
         }
         this.PacketBuilder = (iPacketBuilder) new PacketBuilderNG08(this, this.Board);
         if (SelectedGroup > 15)
         {
             throw new Exception("illegal group for NG08");
         }
     }
     this.Group           = SelectedGroup;
     this.WirelessChannel = nWirelessChannel;
     this.Com.CommunicationUpdateChannel(this);
     this.Com.CommunicationSetDBM(this);
     this.PacketBuilder.ClearFlags();
     this.NB = new List <NauBee>();
     if (SerialPort.ToUpper() != "ANY" && SerialPort.ToUpper() != "ALL")
     {
         this.NB.Add(new NauBee(SerialPort, this.Protocol));
     }
     else
     {
         foreach (string portName in System.IO.Ports.SerialPort.GetPortNames())
         {
             try
             {
                 this.NB.Add(new NauBee(portName, this.Protocol));
             }
             catch (Exception ex)
             {
             }
         }
     }
     if (this.Protocol == Protocols.NG08Direct)
     {
         foreach (NauBee nauBee in this.NB)
         {
             SttyExecution.CallStty("-F " + nauBee.ListeningPort.PortName + " inpck parmrk -parenb cmspar parodd");
         }
     }
     if (this.NB.Count == 0)
     {
         throw new Exception("No Given Com Ports Could be opened");
     }
     foreach (NauBee nauBee in this.NB)
     {
         NauBee N = nauBee;
         N.NauBeeEvent += PacketBuilder.NauBeeEvent;
         if (PassiveListenerMode)
         {
             N.DataRecieved += () => DataAccepted(N);
         }
     }
     TaskTimerStart().GetAwaiter().GetResult();
 }
Exemplo n.º 4
0
 public Communication(cBoard instance2) => _board = instance2;
Exemplo n.º 5
0
 public PacketBuilderNG12(NauCom instance, cBoard instance2)
 {
     this.Instance = instance;
     this.Board    = instance2;
 }