I am trying to develop an application using bluetooth in my Mac mini. However, after searching all over net, all that I could find was the "Bluetooth Device Access Guide" from Apple, and not a single sample program!
Can anyone suggest of any sample code for this available ?
what I am trying to do in my program:
I want to pair my iPhone with my Mac programmatically over the PAN profile, and then send data (streams) both ways. I paired them manually, and I was successfully able to transfer data. I just want to do that programmatically!
[In 2016] I suspect you want CoreBluetooth
The Core Bluetooth framework provides the classes needed for your iOS and Mac apps to communicate with devices that are equipped with Bluetooth low energy wireless technology
You can do things like discover paired devices around you, read and write, and it documents best practices!
Related
From macOS, I'd like to detect the presence/proximity of already paired (via iCloud) Bluetooth LE devices such as a user's iPhone or Apple Watch. Is there a way to do this without running a custom-built app on the user's iPhone/Watch?
I can easily get a list of devices using CoreBluetooth, and seemingly also get RSSI signal strength from this device list, but I don't see a way to correlate the random UUID with a known device, as described in this question.
I've looked at some possible solutions including turning an iPhone into an iBeacon and the MultipeerConnectivity framework, but it looks like both of these require an app to be running on all devices (Mac, iPhone, and Watch). An example app that does not appear to require an app running on the iPhone/Watch is here.
Please note that I am working within a sandboxed environment. Thank you in advance for any suggestions.
I need to write a number of drivers for both HID USB devices as well as some old serial devices. The drivers are to pull data off the device and then send the data over to an application that then consumes it. Since the Apple Docs mention that a lot of USB and HID communication can be done from the user space I had assumed that I would not need to write a kernel extension, at least not for the HID devices. Could some one tell me a more solid way to determine this?
Thanks!
If you're writing a single application that must talk to one or more USB HID devices you may well find you can just access the devices straight from the application using the application-level USB APIs.
A kernel driver would be more for something like a networking or mass storage device that needed to integrate with the kernel to be be available to multiple applications.
This Apple document Common QA and Roadmap for USB Software Development on Mac OS X goes into some detail on the matter and links to example code too.
I've been starting to read about the above and on BLE devices in general and trying to find the differences between those 2 frameworks. Is there something that the iBeacon API offers beside the option to use startMonitoringForRegion with CLBeaconRegion (which will basically "wake up" or notify the app that you're in range)?
To my understanding on iPhone 4S and up I can get a list of BLE devices and check their signal strength on iOS 6 sure, i't will not be as simple as the API for ranging but still, am I missing something?
Thanks
Yes, the CoreLocation APIs allow you to see iBeacon devices where CoreBluetooth does not. See my in depth discussion of this here: http://developer.radiusnetworks.com/2013/10/21/corebluetooth-doesnt-let-you-see-ibeacons.html
This may not matter if you want to roll your own Bluetooth LE devices that are fully visible by CoreBluetooth. But such devices are somewhat more complex and more power-hungry. iBeacons by contrast are transmit only and send a minimal amount of data.
The bottom line is that if you want your app to see standard iBeacons, CoreBluetooth simply will not do the job.
Has anyone found a good example of how to discover, connect, and disconnect BLE devices on Windows 8 using C/C++?
I'm not sure how to get a device handle to use with the "Bluetooth Low Energy Functions" API http://msdn.microsoft.com/en-us/library/windows/hardware/hh450825(v=vs.85).aspx
The Windows 8 Bluetooth GATT apis requires that the device be paired using the built-in UI and does not allow application to connect to an arbitrary Bluetooth LE device.
Source: MSDN Forum
MSDN has code samples(Windows 8+) on interfacing different BLE devices using either one the predefined Bluetooth SIG profiles (blood pressure, heart rate, thermometer) or the Texas Instruments CC2540 Mini development kit).
I don't know whether it is good or not but it looks quite comprehensive:
http://code.msdn.microsoft.com/windowsdesktop/Bluetooth-Generic-4f4ea968
I want to catch commands from bluetooth peripheral in iOS.
Could anyone help me out?
There are a few ways of doing Bluetooth on iOS, and different ones have different methods:
An accessory that's part of the Made for iPhone program (see the answer to this question if you want to know what that entails)
A device that uses Bluetooth 4.0 Low Energy mode
Talking to another iPhone with GameKit
A device using one of the Bluetooth profiles Apple support natively: Hands-free profile, headset profile, A2DP, AVRCP, etc.
To answer those in order:
If you're part of the Made for iPhone program, you'll already know where to find this information, and it's not public: ask your contact at Apple for help.
If your device uses Bluetooth 4.0 Low Energy, look into the Core Bluetooth framework.
If you're trying to get two iPhones talking together, look into GameKit.
If you're working with a device that uses an Apple provided profile, you shouldn't have to do anything, it'll just work. For example, an A2DP device will stream audio played from the phone without needing programmer intervention. You can do a few things to control it: there's a Core Audio function somewhere that lets you choose whether to send audio to a Bluetooth device. If you're trying to support AVRCP, look into handling remote control events.
If your device doesn't fall into any of the above categories, you're probably out of luck and can't use it with iOS.