dominicusmento / CSharpTradFriLibrary

This is a .NET Standard (2.0) library to communicate with the IKEA Home (Tradfri) ZigBee-based Gateway.
GNU General Public License v3.0
37 stars 20 forks source link

Connect Method with invalid details doesnt throw #4

Closed davidwallis closed 6 years ago

davidwallis commented 6 years ago

In the example you have this:

            try
            {
                devices = new List<TradFriDevice>();
                gatewayConnection = new TradFriCoapConnector(Properties.Settings.Default.GatewayName, Properties.Settings.Default.GatewayIP, Properties.Settings.Default.GatewaySecret);
                gatewayConnection.Connect();
            }
            catch (Exception)
            {
                MessageBox.Show("Couldn't connect to TradFri gateway with provided settings");
                Environment.Exit(0);
            }

however if you feed duff names (ie imaginary ip address and secret) no exeception is thrown

dominicusmento commented 6 years ago

This is fixed. Keep in mind that it is done by contacting the gateway with the data you've provided and acquiring gatewayInfo and storing it to TradFriCoapConnector object. If the data you provided is wrong the procedure will fail after about a minute.