Last active
July 25, 2022 21:54
-
-
Save gus33000/8720db998a7ab9c164bd6a96e00dac32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <windows.h> | |
| #include <winrt/Windows.Foundation.h> | |
| #include <winrt/Windows.Foundation.Collections.h> | |
| #include <winrt/Windows.Devices.Lights.h> | |
| #include <winrt/Windows.Devices.Enumeration.h> | |
| using namespace winrt; | |
| using namespace Windows::Foundation; | |
| using namespace Windows::Foundation::Collections; | |
| using namespace Windows::Devices::Lights; | |
| using namespace Windows::Devices::Enumeration; | |
| int main() | |
| { | |
| init_apartment(); | |
| printf("Searching for lamps\n"); | |
| for (auto lampId : DeviceInformation::FindAllAsync(Lamp::GetDeviceSelector()).get()) | |
| { | |
| std::cout << "Found a Lamp with the following interface id: " << to_string(lampId.Id()) << std::endl; | |
| printf("Preparing to enable the lamp. Please wait...\n"); | |
| Lamp lamp = Lamp::FromIdAsync(lampId.Id()).get(); | |
| lamp.IsEnabled(true); | |
| std::cout << "Lamp Brightness level: " << lamp.BrightnessLevel() << std::endl; | |
| printf("Done!\n"); | |
| } | |
| printf("Press any key to stop\n"); | |
| std::cin.get(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment