Corebluetooth - Send and receive a large data pack

Asked

Viewed 48 times

0

I am developing an iOS app using only Corebluetooth, in the same application the device can be a Central or a Peripheral. Well, everything works fine, until I try to send a data packet above the limit allowed by the "slave" (peripheral device that commands the limit of data that can traffic to each request of the central).

I possess 3 characteristic:

    CBCharacteristicPropertyNotify
    CBCharacteristicPropertyRead
    CBCharacteristicPropertyWrite

I can send a very large package from the peripheral to the center using the form indicated by Apple in the Btle_transfer app (Cbcharacteristicpropertynotify), however, I need the following methods to send a larger data package than stipulated:

    - (void)writeValue:(NSData *)data forCharacteristic:(CBCharacteristic *)characteristic type:(CBCharacteristicWriteType)type;
    - (void)readValueForCharacteristic:(CBCharacteristic *)characteristic;

When I call these methods with a small byte package, everything happens normally, but when this package increases, it always returns in the delegate responsible for the response of each method, a 628 byte package (smaller than the package that was sent from the other side). If sending over 628 bytes, it is always returned 628 bytes, and it is not possible to deserialize the date on the other side (peripheral or central).

Does anyone know why this happens? I realized that when I send a package of 2000 bytes for example, the delegate responsible for the readValueForCharacteristic is called 4 times, but I cannot mount the package properly. Someone would have an explanation?

  • Already considered in using the Gamekit that has the full support for communication via Bluetooth.

  • No. Do you know if Peer communicates with Android? I followed the line to develop on top of Corebluetooth because my final application needs to communicate with a similar Android app, and this way I got this communication.

  • I thought Bump did what you want to do but he uses the internet to transfer from Ios to android. http://canaltech.com.br/dica/mobile/bump-basta-bater-para-transfirerir-arquivos-entre-iphone-android-e-pc/

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.