jordanebelanger / SwiftyBluetooth

Closures based APIs for CoreBluetooth
MIT License
209 stars 66 forks source link

Bluetooth Device writing error #33

Closed goldenmobile028 closed 6 years ago

goldenmobile028 commented 6 years ago

Hi @jordanebelanger

Hope you are doing well. I am using your framework to write data to bluetooth device this is great framework for me. This is the code to write data. peripheral.writeValue(ofCharacWithUUID: authCharacteristic, fromServiceWithUUID: self.serviceUUID, value: keyBytes, completion: completion) I am getting following error. Error Domain=CBATTErrorDomain Code=132 "Unknown ATT error." UserInfo={NSLocalizedDescription=Unknown ATT error.} I have checked the code carefully but I could not find the problem. Can you please let me know how to write the data to bluetooth device? Kind Regards. Hua.

jordanebelanger commented 6 years ago

Interesting error, code 132 seem to be a weird one.

Are you able to write to that device at all? Either on some other characteristic or by writing some other data?

goldenmobile028 commented 6 years ago

Hi @jordanebelanger. Thank you for your reply. I am able to write data for some characteristic. And I am not able to write several characteristic. I am sorry I am new to bluetooth and fortunately I found this framework. How can I write data to several characteristic? Kind Regards. Hua.

jordanebelanger commented 6 years ago

It seems like you're getting a GATT busy error from whatever device you're writing to, i.e a peripheral error.

code 132 | 0x84 | GATT_BUSY

Check out https://www.google.com/search?client=safari&rls=en&q=gatt+busy+error&ie=UTF-8&oe=UTF-8

goldenmobile028 commented 6 years ago

I checked the docs but could not find the solution. I have two apps. One is from app store and it works well. It writes the data for any characteristic always. Other one is mine that I am developing. I just wanted to ask that there are any functions or notifications to unlock the bluetooth device. Can you please let me know about this? Kind Regards. Hua.

goldenmobile028 commented 6 years ago

Hi. It's was my mistake. Everything is working well. Thanks for your help.