I'm Working on iOS Application(Objective-C) for Bluetooth watch which using BLE(CoreBluetooth), and my watch is having GATT Bluetooth Profile, iOS application minimum support is from iOS7.
I wants to know How can we do data transfer between iOS device and external device using Core Bluetooth framework.
Actually I'm working on the Firmware upgrade section of my Bluetooth watch, My iOS application will get Firmware code (binary data) from web service whenever any update received and then it will send data to Bluetooth watch.
I have searched and got one Apple Sample code: BTLE_Transfer: https://developer.apple.com/Library/ios/samplecode/BTLE_Transfer/Introduction/Intro.html
I guess sample code was not useful in my case as its having Central and Peripheral both code and transferring data between two iOS device.
is there any other way apart from this sample code for BLE data transfer? or it's possible with this sample code only?(if yes how?)
UPDATED:
My device have 1 service which have 2 characteristic one for read and one for write.
According to my workflow using write charateristic:
[MYDEVICEINSTANCE writeValue:NSDATACHUNK forCharacteristic:WRITECHARACTERISTIC type:CBCharacteristicWriteWithResponse];
[MYDEVICEINSTANCE setNotifyValue:TRUE forCharacteristic:READCHARACTERISTIC];
[MYDEVICEINSTANCE readValueForCharacteristic:READCHARACTERISTIC];
My query:
I wants to confirm MTU maximum limit allowed by Apple for External device communication from iOS application, which I'm starting in step-1 by sending NSDATACHUNK to BLE Watch from iOS app using writeValue
I have tested that I can send NSDATACHUNK of MTU=255 size and BLE watch is receiving same successfully.
I have found in "Apple Sample code: BTLE_Transfer" they are using MTU=20 but, I guess that sample code is for iOS device to iOS device communication (Please, correct me if I'm wrong)
So, If I use MTU=250 in my iOS application for BLE communication is there any chance that apple will reject my Application?
Or is there any one that can say what is the maximum limit allowed by Apple for MTU?
Every suggestion are appreciated,
Thanks in advance
Per the Bluetooth Core Specification, the maximum length of an attribute can be 512 bytes. In reality, it can be slightly larger than this to accommodate the ATT header. On Android, the maximum MTU can be 517 bytes.
ATT Maximum Transmission Unit (MTU) is the maximum length of an ATT packet. The ATT MTU is defined by the L2CAP and can be anywhere between 23 and infinity. The implementation of the Bluetooth stack is the key factor of determining the ATT MTU on both client and peripheral.
Introduction: One of the main features of the Bluetooth 4 specification is Bluetooth Low Energy (BLE). Also called Bluetooth smart, this technology allows peripherals to communicate by consuming much less energy than regular Bluetooth.
You can use whatever MTU size you want (up to 512).
The value that the connection will use is always the minimum between yours and theirs.
So, if for example they want to use MTU equal to, let's say, 50, then if your MTU is lower than 50, that one will be used; otherwise, whichever value you select above 50 is meaningless, as 50 gets picked.
After connect your device yo your app you should have to write a "characteristic" with:
[YOURDEVICEINSTANCE writeValue:NSDATAVALUE forCharacteristic:YOURCHARACTESITIC type:CBCharacteristicWriteWithResponse];
We spent a lot of time working with my custom BLE device and my conclusion was:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With