I am developing an iPhone app. the app will connect with a PCB Board by BLE and sending command.
What I have done is App did connected with Board by BLE and App can send signal to Board.
My Question is How can I transfer big file (> 500Kb)?
I read a lot posts saying that characteristics can transfer a maximum of 20 bytes at once. Is there any specific stream API I can use or should I break the file into lots of 20 bytes and send one by one?
Asked
Active
Viewed 500 times
3

user418751
- 1,937
- 2
- 18
- 21
-
2You need to break the file into 20 byte chunks. Apple has some sample code that shows one approach. This code also deals with the fact that the transfer queue isn't infinite and you may need to hold off sending until space is available; https://developer.apple.com/library/ios/samplecode/BTLE_Transfer/Listings/BTLE_Transfer_BTLEPeripheralViewController_m.html#//apple_ref/doc/uid/DTS40012927-BTLE_Transfer_BTLEPeripheralViewController_m-DontLinkElementID_8 – Paulw11 Apr 01 '16 at 01:21
-
@paulw11, thanks, I am checking – user418751 Apr 01 '16 at 01:42
-
@user418751 what are you trying to transfer? I mean, an arduino has an onboard flash of 32kB, so where do you store 500kB? – frarugi87 Apr 01 '16 at 12:45
-
@frarugi87 there is a SD card on arduino side. I am trying to upload a config file which can be read by arduino and drive devices to run. – user418751 Apr 03 '16 at 11:50
-
@user418751 Ok, so that's a perfectly licit question ;) Then I think that if you can only send 20 bytes chunks, then you will have to split the file and then send it in, well, chunks. I suggest you to reserve some bytes in the chunk to tell the arduino the progress, so you don't lose bytes here and there. And then implement a sort of CRC just to validate the whole file.. – frarugi87 Apr 03 '16 at 18:07
-
@frarugi87 exactly. Thanks for your info! – user418751 Apr 05 '16 at 02:43