Esempio n. 1
0
        internal void GetListOfMqttDevices()
        {
            Device[]     devices = IcueSdk.ListDevices();
            CorsairError error   = IcueSdk.CorsairGetLastError();

            if (error != CorsairError.Success)
            {
                Logger.LogError("SDK error getting list of devices", new Exception(error.ToString()));
            }
            Dictionary <string, int> modelCount = new Dictionary <string, int>();

            for (int i = 0; i < devices.Length; i++)
            {
                //handle multiple devices of same model
                int modelSuffix = 0;
                if (modelCount.ContainsKey(devices[i].CorsairDevice.Model))
                {
                    modelSuffix = modelCount[devices[i].CorsairDevice.Model] + 1;
                    modelCount[devices[i].CorsairDevice.Model] = modelSuffix;
                }
                else
                {
                    modelCount.Add(devices[i].CorsairDevice.Model, modelSuffix);
                }
                MqttIcueDeviceList.AddIcueDevice(devices[i], modelSuffix);
            }
        }