IOHIDDisplay.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. IOHIDDisplay.h ... I/O Kit HID Display
  3. Copyright (c) 2009 KennyTM~ <kennytm@gmail.com>
  4. All rights reserved.
  5. Redistribution and use in source and binary forms, with or without modification,
  6. are permitted provided that the following conditions are met:
  7. * Redistributions of source code must retain the above copyright notice, this
  8. list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright notice,
  10. this list of conditions and the following disclaimer in the documentation
  11. and/or other materials provided with the distribution.
  12. * Neither the name of the KennyTM~ nor the names of its contributors may be
  13. used to endorse or promote products derived from this software without
  14. specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  16. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  19. ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  22. ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #ifndef IOHID_DISPLAY_H
  27. #define IOHID_DISPLAY_H
  28. #include <CoreFoundation/CoreFoundation.h>
  29. #include <IOKit/IOKitLib.h>
  30. #include "IOHIDNotification.h"
  31. #if __cplusplus
  32. extern "C" {
  33. #endif
  34. typedef struct __IOHIDDisplay
  35. #if 0
  36. {
  37. CFRuntimeBase _base; // 0, 4
  38. void* client; // 8
  39. io_service_t service; // c
  40. CFRunLoopRef runloop; // 10
  41. CFStringRef mode; // 14, *not retained*
  42. IONotificationPortRef port; // 18
  43. io_object_t notification; // 1c
  44. CFMutableSetRef removalNotifications; // 20, set of IOHIDNotification's
  45. CFMutableDictionaryRef properties; // 24
  46. int logLevel; // 28
  47. float brightness; // 34
  48. float brightnessMin; // 38
  49. float brightnessMax; // 3c
  50. float brightnessFactor; // 40;
  51. float x44; // 44
  52. float ambient; // 4c
  53. float brightnessAutoWeightMin; // 54
  54. float brightnessAutoWeightMax; // 58
  55. float x60; // 60
  56. float x64; // 64
  57. float x68; // 68
  58. float x70; // 70
  59. float x74; // 74
  60. int x78; // 78
  61. int x80; // 80
  62. CFTimeInterval fadePeriod; // 84
  63. }
  64. #endif
  65. * IOHIDDisplayRef;
  66. #pragma mark -
  67. #pragma mark Creators
  68. CFTypeID IOHIDDisplayGetTypeID(void);
  69. IOHIDDisplayRef _IOHIDDisplayCreate(CFAllocatorRef allocator, io_service_t service);
  70. #pragma mark -
  71. #pragma mark Accessors
  72. float _IOHIDDisplayGetAmbient(IOHIDDisplayRef display);
  73. void _IOHIDDisplaySetAmbient(IOHIDDisplayRef display, float ambient);
  74. float _IOHIDDisplayGetBrightness(IOHIDDisplayRef display);
  75. void _IOHIDDisplaySetBrightness(IOHIDDisplayRef display, float brightness);
  76. void _IOHIDDisplaySetBrightnessMax(IOHIDDisplayRef display, float brightnessMax);
  77. void _IOHIDDisplaySetBrightnessFactor(IOHIDDisplayRef display, float factor);
  78. float _IOHIDDisplayGetBrightnessFactor(IOHIDDisplayRef display);
  79. void IOHIDDisplaySetProperty(IOHIDDisplayRef display, CFStringRef property, CFTypeRef value);
  80. CFTypeRef IOHIDDisplayGetProperty(IOHIDDisplayRef display, CFStringRef property);
  81. CFTypeRef _IOHIDDisplayGetClient(IOHIDDisplayRef display);
  82. #pragma mark -
  83. #pragma mark Actions
  84. void _IOHIDDisplayUnscheduleWithRunLoop(IOHIDDisplayRef display, CFRunLoopRef runloop, CFStringRef mode);
  85. void _IOHIDDisplayScheduleWithRunLoop(IOHIDDisplayRef display, CFRunLoopRef runloop, CFStringRef mode);
  86. IOHIDNotificationRef IOHIDDisplayCreateRemovalNotification(IOHIDDisplayRef display, IOHIDNotificationCallback callback, void* target, void* refcon);
  87. Boolean _IOHIDDisplayOpen(IOHIDDisplayRef display, CFTypeRef client);
  88. void _IOHIDDisplayClose(IOHIDDisplayRef display, CFTypeRef client);
  89. #pragma mark -
  90. #pragma mark Constants
  91. static const CFStringRef kIOHIDDisplayPropertyBrightness = CFSTR("DisplayBrightness"); // float
  92. static const CFStringRef kIOHIDDisplayPropertyBrightnessAuto = CFSTR("DisplayBrightnessAuto"); // boolean
  93. static const CFStringRef kIOHIDDisplayPropertyBrightnessMin = CFSTR("DisplayBrightnessMin"); // float
  94. static const CFStringRef kIOHIDDisplayPropertyBrightnessMax = CFSTR("DisplayBrightnessMax"); // float
  95. static const CFStringRef kIOHIDDisplayPropertyBrightnessAutoWeightMax = CFSTR("DisplayBrightnessAutoWeightMax"); // float
  96. static const CFStringRef kIOHIDDisplayPropertyBrightnessAutoWeightMin = CFSTR("DisplayBrightnessAutoWeightMin"); // float
  97. static const CFStringRef kIOHIDDisplayPropertyBrightnessFactor = CFSTR("DisplayBrightnessFactor"); // float
  98. static const CFStringRef kIOHIDDisplayPropertyBrightnessFactorWithFade = CFSTR("DisplayBrightnessFactorWithFade"); // float
  99. static const CFStringRef kIOHIDDisplayPropertyBrightnessFadePeriod = CFSTR("DisplayBrightnessFadePeriod"); // float
  100. static const CFStringRef kIOHIDDisplayPropertyLogLevel = CFSTR("LogLevel"); // int
  101. #if __cplusplus
  102. }
  103. #endif
  104. #endif