コード例 #1
0
        public async Task Connect()
        {
            _flagCRRecieved = false;
            ConnectionRequest builder = new ConnectionRequest();

            builder.Build(_receiveEndPoint, 0x00);
            await Send(builder.GetBytes(), true);

            await Task.Delay(500);

            if (!_flagCRRecieved)
            {
                throw new Exception("Schnittstelle ist nicht erreichbar!");
            }

            if (!IsConnected)
            {
                throw new Exception("Verbindung zur Schnittstelle konnte nicht hergestellt werden! Error: " + LastError);
            }

            bool state = await SendStatusReq();

            if (!state)
            {
                throw new Exception("Die Schnittstelle hat keine Verbindung zum Bus! Error: " + LastError);
            }
        }