Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Siri Remote orientation (or get notifications of change?)

I'm been searching for a way to check the Siri Remote's current orientation or to register for Siri Remote orientation changes, but I haven't found anything yet. Is it possible to do this (without resorting to interpreting the raw gravity data)?

I've have found out how to disable auto-orientation changes with "allowsRotation" on "microGamepad". Which is pretty cool!

like image 224
Rusty Moyher Avatar asked Dec 16 '15 18:12

Rusty Moyher


People also ask

How do I get to Siri Remote settings?

You can also change the function of the TV button and check the battery level from the same settings. From the Apple TV Home Screen, use the touch surface to open the Settings app, then go to Remotes and Devices. Go to the Remotes and Devices settings to customize your Siri Remote.

Does Siri Remote have gyroscope?

Updated Siri remote control has neither a gyroscope nor an accelerometer, and can't be used to play games that rely on these features.

Does new Siri Remote have accelerometer?

As pointed out by Digital Trends, the new Siri Remote lacks both the accelerometer and gyroscope. These sensors were available on the original Siri Remote to enable gaming experiences on the TV. These sensors let users tilt the remote to perform specific in-game actions as one can do on the iPhone or iPad.


1 Answers

I didn't see an API either, however as you mentioned, you can poll for the gravity data, and I just wanted to post that code here in case some find it useful. You can modify this to your own need, such as detecting last orientation and comparing it to current if you want a callback of the change.

    //**************************************************************
    // Update loop portion to UIViewController
    //**************************************************************
    @property (strong) CADisplayLink *updateLoopTimer;
    self.updateLoopTimer = [CADisplayLink displayLinkWithTarget:self selector:@selector(updateRefreshRate:)];
    [self.updateLoopTimer addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
    -(void)updateRefreshRate:(CADisplayLink *)displayLink
    {
        CFTimeInterval deltaTime = displayLink.duration * displayLink.frameInterval;
        [self update:(float)deltaTime];
    }

 //******************************************************
// Update loop
//******************************************************
-(void)update:(float)dt
{
#ifdef TV
    //***************************************
    // Detect button presses
    //***************************************
    //self.gameControler = [[GCController controllers] firstObject];
    if( self.gameController != nil )
    {
        GCMicroGamepad* microPad = self.gameController.microGamepad;
        if ( microPad != nil )
        {
            GCMotion *motion = self.gameController.motion;
            GCControllerDirectionPad *dpad = microPad.dpad;

            if( motion != nil )
            {
                GCAcceleration accelVector = motion.gravity;
                if( fabs(accelVector.x) > fabs(accelVector.y) )
                {
                    NSLog(@"Sideways");
                }
                else
                {
                    NSLog(@"Upright");
                }

            }
        }
    }
#endif
}
like image 51
JMan Mousey Avatar answered Nov 13 '22 21:11

JMan Mousey