I am an iOS Developer working an application in which I want to list the bluetooth devices names (iPod, iPad, Macbook etc ), for which O am using the MultiPeerConnectivity Framework.
MultiPeerConnectivity Framework uses MCBrowserViewController which is responsible for browsing nearby devices and MCAdvertiserAssistant which advertise the devices for the connectivity. Using MultiPeerConnectivity Framework you have two devices, one should advertise itself and the second one should browse for the devices, than its working fine.
But My Problem is:
How to search for the devices which are not able to use the app (I mean how to search for my Macbook or other bluetooth devices like bluetooth keyboard etc, am not talking about the Android devices). Is it possible through MultiPeerConnectivity Framework ? or any other solution ?
Here is my code
-(void)setupPeerAndSessionWithDisplayName:(NSString *)_displayName
{
self.peerID = [[MCPeerID alloc] initWithDisplayName:_displayName];
self.session = [[MCSession alloc] initWithPeer:self.peerID];
self.session.delegate = self;
}
-(void)setupMCBrowser{
self.browser = [[MCBrowserViewController alloc] initWithServiceType:#"chat-files" session:self.session];
}
-(void)advertiseSelf:(BOOL)shouldAdvertise{
if (shouldAdvertise) {
self.advertiser = [[MCAdvertiserAssistant alloc] initWithServiceType:#"chat-files" discoveryInfo:nil session:self.session];
[self.advertiser start];
}
else{
[self.advertiser stop];
self.advertiser = nil;
}
}
If you are looking to discover other iOS devices, as well as other Macs and also peripherals, then you'll need to combine using Multipeer Connectivity with Core Bluetooth.
MPC is intended for use in discovering other instances of your app. If you want to discover Macs then they will have to be running a Mac app with Multipeer Connectivity advertising with the same serviceType as your app.
If you want to discover peripherals you will need to use Core Bluetooth - there are lots of tutorials available online, and you can also check this SO question as a starting point.
Related
BACKGROUND INFORMATION:
I've been trying to detect a button click from Apple headphone. The headphone is connected to MacBook Pro that is running Windows. Its not virtual machine. It is running windows normally with a complete windows driver from Apple through Boot Camp.
The headphone is a standard Apple headphone consisted of three buttons: a volume up, volume down, middle buttons and a Mic.
When I am using Mac Os, If the volume up button is presses on the ear phone, Mac Os would increase its volume by one. It also decreases its volume when the voulume down button is pressed on the ear phone.
Standard ear/headphone uses three conductive pins to receive(L/R speakers only) signals while the apple version is using four conductive pins to receive(L/R speakers) and send(buttons) signals. This headphone was made for iPhone but I was surprised when it worked on Mac Os.
This made me believe that the MacBook Pro hardware is built to support this four conductive pins earphone. It works on Mac Os but NOT on Windows. My goal is to develop a tiny software that will allow the apple headphone to function on Windows running on Apple hardware.
I know how to increase Windows volume using C++ and Win32 API but I am stuck on the part where I actually have to detect the button click from the headphone.
QUESTION:
1) what ways can I detect the Input(button clicks) from the headphone?
It looks like this person here was able to read it. He only did it while running on Mac Os
Detect hardware headphone presses in mac
2) If I compile the code this person got working on Mac OS as a DLL file and then call the function while running Windows, will it work?
3) Do I need to make my own driver to get this to work?
4) The code below is from the link I posted above. What windows API function, class is equivelent to the follwoing Mac Os code below?
id array = [[DDHidDevice allDevices] filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:#"productName == \"Apple Mikey HID Driver\""]];
DDHidDevice *mic = [array count] ? [array objectAtIndex:0] : nil;
// it isn't a keyboard
NSLog(#"%#", mic.primaryUsage);
assert(mic.usage==1 && mic.usagePage==12);
THINGS I'VE TRIED:
1) I tried using GetLastInputInfo() with LASTINPUTINFO from Windows API to sniff any hardware input but failed miserably. It worked on keyboard and mouse but nothing else.
2) I also tried to use RAWINPUTDEVICE to read a low level input from hardware but it only worked on keyboards, mouse and joystick input. It didn't detect the headphone button press.
I am running out of ideas. Anyone got any solution?
NOTE: This is not a duplicate question as I am asking how to do this on Windows not Mac.
I read about the new feature released with iOS 7.1
In this version the app opened when was find the iBeacon
I make more test but this feature don't work
Can you help me?
self.beaconRegion = [[ESTBeaconRegion alloc] initWithProximityUUID:ESTIMOTE_PROXIMITY_UUID
identifier:#"EstimoteSampleRegion"];
self.beaconRegion.notifyOnEntry = TRUE;
self.beaconRegion.notifyOnExit = TRUE;
[self.beaconManager startRangingBeaconsInRegion:self.beaconRegion];
You need to start monitoring, not ranging, to launch an app on iBeacon detection. This is true regardless of whether the app is already in the background or not. Make sure you have implemented the monitoring callback methods, too.
[self.beaconManager startMonitoringBeaconsInRegion:self.beaconRegion];
reference: Browsers in 2013 with Web MIDI API?
I'm currently running Chrome 34.0.1847.116 on OS 10.9.2 and experimenting with the Web Midi API. After enabling chrome://flags/#enable-web-midi, I'm able to get a midiAccess object by pasting the following code from http://www.w3.org/TR/webmidi/ into the DevTools console.
var midi = null; // global MIDIAccess object
function onMIDISuccess( midiAccess ) {
console.log( "MIDI ready!" );
midi = midiAccess; // store in the global (in real usage, would probably keep in an object instance)
}
function onMIDIFailure(msg) {
console.log( "Failed to get MIDI access - " + msg );
}
navigator.requestMIDIAccess().then( onMIDISuccess, onMIDIFailure );
When I query midi.inputs() and midi.outputs(), the returned list contains only IAC Bus devices. My midi keyboard (connected with a Turtle Beach USB midi adapter) does not show up. In trying to diagnose the problem, I've so far found the following:
The adapter is visible in OS X's Audio/Midi Setup and the keyboard works correctly with Logic Pro as well as with homebrew CoreMidi code.
The web synth example at http://webaudiodemos.appspot.com/monosynth/index.html also fails to find the keyboard and does not make sound when keys are pressed.
The web synth example at http://djazz.se/lab/synth/ does make sound when I click on its virtual keys. DevTools shows that it's using an IAC Bus device.
What do I need to do to help Chrome find non-IAC MIDI devices?
The answer to the question (linked below) from developer cwilso explains the problem. The browser has to be rebooted to detect new connected devices (even if web-midi is already enabled). Doing caused my adapter to be detected and available as an input device
Detect if a MIDI interface is connected in Web MIDI API
I've read here that Apple computers from mid-2011 should support BLE (Bluetooth Low Energy). Is there a way (perhaps using the command line) to check if the device and the operating system supports BLE?
In the Mac OS X Terminal app, you can type the following:
system_profiler -detailLevel full SPBluetoothDataType | grep "LMP Version"
If this command outputs >= '0x6' then Bluetooth 4.0 is supported and thus, BLE is also supported.
1) Install LightBlue for Mac OS through the AppStore.
2) If it complains like the screenshot attached, your hardware does not support Bluetooth LE, if it does not complain "it's all good".
Apparently the CBCentralManager api for iOS and OSX is the same or very similar (not sure if that was to be expected as Im just starting with iOS and OS X), in the sense that it is possible to run the code:
switch ([_manager state])
{
case CBCentralManagerStateUnsupported:
state = #"This device does not support Bluetooth Low Energy.";
break;
case CBCentralManagerStateUnauthorized:
state = #"This app is not authorized to use Bluetooth Low Energy.";
break;
case CBCentralManagerStatePoweredOff:
state = #"Bluetooth on this device is currently powered off.";
break;
case CBCentralManagerStateResetting:
state = #"The BLE Manager is resetting; a state update is pending.";
break;
case CBCentralManagerStatePoweredOn:
state = #"Bluetooth LE is turned on and ready for communication.";
break;
case CBCentralManagerStateUnknown:
state = #"The state of the BLE Manager is unknown.";
break;
default:
state = #"The state of the BLE Manager is unknown.";
}
provided in the equivalent iOS Q&A (the credits goes to Bob there) in OS X and get to know if the device supports ble or not.
Click apple icon on top left corner, then click About This Mac -> System Report... on the left side click Hardware -> Bluetooth,
you will find Bluetooth Low Energy Supported under Hardware, Features, and Settings.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Detecting iPad 3 vs iPad 2 device?
Programmatically detect an iPad 3 (HD)?
I am making an iPad app and want to know if the app is running in an iPad 2 or 3 so accordingly I can perform some action.
What would be the best way to find this?
I am currently using
NSString *platform = [[UIDevice currentDevice] platformString];
But it returns "Unknown iPad" when I run on iPad 3.
It's generally best to check for the device features you're interested in rather than looking for a specific model of device. Apple recommends this, and for good reason: if you design for features of the new iPad, your customers won't be happy if Apple releases another device with those features and your app doesn't support them.
If you need to determine whether you're on an iPad, check UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad. If you need to see if you have a Retina display, check [UIScreen mainScreen].scale. Combine the two and you can find out if you're on an iPad with Retina display.
If you need other features specific to the new iPad, look in the API for those features: AV Foundation can tell you about the capabilities of the built-in camera, for example. There's probably some way to check for LTE, too, but I'm not aware of it.