public static Device CreateDevice(IClientModel client, string ID) { if (!IsReady) { throw new Exception("DeviceManager is not ready, please call Setup() first."); } if (client != null || string.IsNullOrEmpty(ID)) { throw new ArgumentException("Invalid arguments"); } // Create a new Device var device = new Device(ID); // Register device to internal dictionary Devices.Add(ID, device); // Use client to subscribe to this particular Device ID client.Subscribe(string.Join("/", BaseTopic, ID, "#"), ProcessData); return(device); }