src/power/uikit/SDL_syspower.m
changeset 10340 5724f5087acd
parent 9998 f67cf37e9cd4
child 10737 3406a0f8b041
     1.1 --- a/src/power/uikit/SDL_syspower.m	Tue Sep 13 19:51:10 2016 -0300
     1.2 +++ b/src/power/uikit/SDL_syspower.m	Tue Sep 13 22:18:06 2016 -0300
     1.3 @@ -30,6 +30,7 @@
     1.4  #include "SDL_assert.h"
     1.5  #include "SDL_syspower.h"
     1.6  
     1.7 +#if !TARGET_OS_TV
     1.8  /* turn off the battery monitor if it's been more than X ms since last check. */
     1.9  static const int BATTERY_MONITORING_TIMEOUT = 3000;
    1.10  static Uint32 SDL_UIKitLastPowerInfoQuery = 0;
    1.11 @@ -46,10 +47,22 @@
    1.12          }
    1.13      }
    1.14  }
    1.15 +#else
    1.16 +void
    1.17 +SDL_UIKit_UpdateBatteryMonitoring(void)
    1.18 +{
    1.19 +    /* Do nothing. */
    1.20 +}
    1.21 +#endif /* !TARGET_OS_TV */
    1.22  
    1.23  SDL_bool
    1.24  SDL_GetPowerInfo_UIKit(SDL_PowerState * state, int *seconds, int *percent)
    1.25  {
    1.26 +#if TARGET_OS_TV
    1.27 +    *state = SDL_POWERSTATE_NO_BATTERY;
    1.28 +    *seconds = -1;
    1.29 +    *percent = -1;
    1.30 +#else /* TARGET_OS_TV */
    1.31      @autoreleasepool {
    1.32          UIDevice *uidev = [UIDevice currentDevice];
    1.33  
    1.34 @@ -88,8 +101,10 @@
    1.35  
    1.36          const float level = uidev.batteryLevel;
    1.37          *percent = ( (level < 0.0f) ? -1 : ((int) ((level * 100) + 0.5f)) );
    1.38 -        return SDL_TRUE; /* always the definitive answer on iOS. */
    1.39      }
    1.40 +#endif /* TARGET_OS_TV */
    1.41 +
    1.42 +    return SDL_TRUE; /* always the definitive answer on iOS. */
    1.43  }
    1.44  
    1.45  #endif /* SDL_POWER_UIKIT */