IOS蓝牙BLE writevalue返回"未知错误"
我的深化发展我的第一个智能蓝牙(BLE)软件上的IOS 6。
I am developping my first Smart Bluetooth (BLE) software on IOS 6.
我能够接收通知和阅读chracteristics值用的北欧开发套件包括从自定义配置文件关贸总协定我创造(与服务和特点的具体的UUID)。
I am able to receive notifications and read chracteristics values exchanged with a Nordic Development kit including from a custom GATT profile I have created (with specific UUIDs for service and characteristics).
不过,每次我试图在一座独具特色的写值,我得到错误信息未知错误
没有更多的信息。没有错误code,没有 CoreBluetooth【警告】
根据X code。
But, everytime I am trying to write a value in a characteristic, I get the error message Unknown Error
without more information. No error code, no CoreBluetooth[WARNING]
from XCode.
我已经设置我的服务和特征属性的权限,而不验证来写。使用开发工具北欧,我能够在我的特点来写一个值,所以它不会是一个权限问题。
I have set my service and characteristics attributes permissions to write without authentication. Using a development Nordic tool, I am able to write a value in my characteristic, so it would not be a permission problem.
下面是code,我用写值
Here is the code I am using to write the value
uint16_t val = 2;
NSData * valData = [NSData dataWithBytes:(void*)&val length:sizeof(val)];
[testPeripheral writeValue:valData forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse];
和那里的错误未知错误惜售回调
And the callback where the error "Unknown error" is rised
- (void) peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:
(CBCharacteristic *)characteristic error:(NSError *)error
{
NSLog(@"Did write characteristic value : %@ with ID %@", characteristic.value, characteristic.UUID);
NSLog(@"With error: %@", [error localizedDescription]);
//code...
}
在控制台中的错误文本是
The error text in the console is
Did write characteristic value : <068c0e00 fedc070c 050b3200 04> with ID Unknown (<4444>)
With error: Unknown error.
在错误信息的价值是不是我想写?? !! 444是我使用了我的测试中正确的UUID。
The value in the error message is not what I am trying to write??!! 444 is the correct UUID I am using for my tests.
是值的长度来写重要?
在互联网上寻找hoirs和尝试了很多测试之后,我需要这么弄明白。
有什么建议?
After looking hoirs on the internet and tried a lot tests, I need SO to figure it out. Any advice?
问题是位于设备DB管理,而不是在IOS的一面。但是,没有从CoreBluetooth错误code,这是很难看着办吧!
The problem was located in the device DB management, not in the IOS side. But, without error code from CoreBluetooth, it was hard to figure it out!