Does anybody know how to establish a bluetooth connection from a self-written iOS app to the new LEGO Mindstorms EV3 programmable brick?
I tried to do this via the scanForPeripheralsWithServices:options: method of CBCentralManager, but the brick is not recognized.
But if I enable Bluetooth in the Settings of the iPhone, then the EV3 device is displayed there. There is also an app in the AppStore from LEGO ("Commander") which talks to the brick via Bluetooth, so I think this should be possible in general (as I know, it was not possible for the previous Mindstorms NXT brick).
Does anybody have an idea how I can do this?
Thanks!
As said, the device isn't listed using CoreBluetooth, got it using EAcessory framework, you need to have the item "COM.LEGO.MINDSTORMS.EV3" in UISupportedExternalAccessoryProtocols in your App-Info.plist :
<EAAccessory: 0x15567180> {
connected:YES
connectionID:18565483
name: MFI Accessory
manufacturer: LEGO
modelNumber: DM240411
serialNumber:
firmwareRevision: 1.0.0
hardwareRevision: 1.0.0
protocols: (
"COM.LEGO.MINDSTORMS.EV3"
)
delegate: (null)
}
As with the Lego app, you need to first connect to the EV3 using Settings App. Then, look at the Apple EADemo sample, it show how to use EASession (encapsulate read/write stream).
Maybe sending data like the C# gathered from monobrick.dk source code (said in Mailerdaimon answer) will work... I'll get a try via Wifi (after porting C# to ObjC, long job), after that, writing to EASession might be easier. I'll update this answer when done.