iOS 6 CoreBluetooth Pairing / Forgetting (2 questions) - objective-c

We have a bondable (when we connect we are asked to Pair, see question 2) Bluetooth 4.0 peripheral that we have manufactured and have written an iOS app for.
Question 1
Is it possible in iOS 6 with CoreBluetooth to remove our peripheral from the iOS Bluetooth Settings from within our app or is this restricted to only going to iOS Settings / Bluetooth / Our Peripheral and "Forget this device".
What we are trying to do is when we remove our peripheral from within our app, we expect this peripheral to be removed from the iOS Bluetooth list as well.
Question 2
My second question is, does iOS SDK provide a way to determine if a user has chosen "Pair" or "Cancel" on the Pairing request alert? As of now, we determine the user pressed pair by reading our services / characteristics when the device is connected.

Question 1
No, I really dont think so. Clearing it through settings is the only possible way.
Question 2
The centralManager delegate has callbacks for both failed and successfully connected peripheral, so I would listen to them to check if user cancelled or not: didConnectPeripheral and didFailToConnectPeripheral

When you click 'cancel' on the bonding dialog iOS will call the delegate method 'centralManagerDidUpdateState' with the state being 'CBCentralManagerResetting'. If you click pair then the command will proceed normally.

Related

how to send a int from an iPhone to Apple Watch label(objective-c)

so I'm new to iOS development but I've been coding with java for years now.. but I've been trying to figure out how to send an integer, a single number from a variable from the iPhone to a label on an Apple Watch. I'm at the point of banging my head against the keyboard because it seems so easy but I have no idea how implement any of it. thanks for any help,,
One way to send data between iPhone and its paired Apple Watch is through the Watch Connectivity framework - you'll able to send an integer since it's a property list type.
Another way is by sending it up to the network and then fetching it from a WiFi or cellular connected Apple Watch. A more complex iPhone + Apple Watch app might make use of both.

tvOS - game control via non-Siri remote

I'm working on a game in Objective-C. The Siri remote works great via GCMicroGamepad and real MFi controllers work well via GCGamepad. However, third-party IR remotes do not work at all in-game (and neither does the Remote App on iPhone or an older Apple TV 3rd gen remote).
How can I recognize and distinguish these inputs?
Two days later... I have found that a UITapGestureRecognizer can be used to detect Up, Down, Left, Right and Select events correctly when presented with a third-party TV remote or iPhone Remote.app. The directional events are actually unique to these types of remotes as well—the Siri remote does not generate directional tap events. Unfortunately, however, tapping the Select button on either the Siri remote or the third-party or iPhone Remote.app will generate a Select event from my tap recognizer. I need some way to distinguish the two.
The only distinguishing factor I can find is that tapping the Siri remote also generates a button-A press on the GCMicroGamepad—a third-party remote or iPhone Remote.app does not affect the GCMicroGamepad at all. But it's very extremely inelegant to attempt to watch the GCMicroGamepad for tap-release events, and then use that event to filter out a matching Select button event. Certainly it's not a recommended use of the APIs; it doesn't seem like a good long-term solution. If I could tell the Siri remote to stop generating UI events when in GCMicroGamepad mode, that would be excellent.
I cannot test this right now, but you could probably differentiate the Siri Remote from a third party remote by using a GCEventViewController with the controllerUserInteractionEnabled property set to false. This way, the Siri Remote inputs shouldn't get passed to UIKit (when the GCEventViewController is the first responder). The third-party remote's input events might go through to UIKit since, unlike the Siri Remote, it's not a GCMicroGamepad.
So far, Apple really doesn't support multiplayer games with multiple Siri Remotes, iOS Remotes or IR remotes. But I think it might be coming because the Remote app on iOS will soon support multiplayer gaming (so I guess the Apple TV will recognize multiple GCMicroGamePad controllers).

Stay connected to ble when app is closed

I have one BLE device which has one physical button on it ,I want to trigger local notification in iOS device whenever I click the BLE device button even when the app is closed .Is this is possible in iOS to read characterstics event when the app is closed.
Thanks

Is it possible to capture touch events in the background on a jailbroken iOS device?

I have an installation project in mind which involves a hacked iPad - I'd like to have a background process running recording all the touch events regardless of what app is running in the foreground, and send them out via OSC.
Note that this is using a jailbroken iPad with root access, and users will be alerted about not entering any sensitive data. But I'm not an iOS developer so I'm not sure if this is even possible. I'd appreciate any kind of input/suggestions.
[edit] Since someone questioned my motive behind this question, I'll try to explain a bit: to be specific, I'd like to build a mechanical system with Arduino that emulates the user's touch input on the iPad, but I do not want to limit them to using an app that does nothing else but recording touch events.
There are three options:
Use the IOHIDFamily subsystem to capture all the touch events. This will do most of the processing for you, the only thing you'll need to do is fetch the events using a HID client, get their types, and if they are touch events, get their position, radius and other things you need.
Use the MultitouchSupport framework. This way you will have to process the digitizer data frames manually which is tricky.
Use a MobileSubstrate hook to hook the already existing HID client inside SpringBoard.

How can I turn on and off the bluetooth on iphone sdk programatically?

how can I tell programatically if the bluetooth is turned on or of on the device?
And in ethier case turn it off or on programatically?
thanks
Are you talking about the popup that appears when you run the GKTank application while bluetooth is turned off? I suspect this is a function of the PeerPicker class - I haven't seen a way to query the bluetooth status directly.
However if you attempt to make a bluetooth call when bluetooth is off you'll receive a GKSessionCannotEnableError error code (Bluetooth is not currently available).
There's currently no way to interface with Bluetooth unless you join the Made for iPod / Works With iPhone program for some hardware you're developing.