5450| 3
|
[已解决] 求助 Bluno 字符最大接受18个 |
Angelo 发表于 2014-4-14 14:14 请问“BLUNO with accessory shield”里面哪一个文件的哪一个部分是分包的代码呢?不是很熟悉oc语言。谢谢啦! |
Bluno一次只能接受20个字节,如果超过20个字节,需要用户自己做分包,并且Bluno端也需要做相应的接收动作。 Xcode端,你可以这样做分包: NSString* strTest = @"abcdljskdhfkahshkljhkhkhlkhflka"; NSData* data = [strTest dataUsingEncoding:NSUTF8StringEncoding]; NSInteger count = data.length/20; NSInteger remainder = data.length%20; int i = 0; for (; i<count; i++) { NSRange range; range.length = 20; range.location = i*20; NSData* subData = [data subdataWithRange:range]; [self.blunoManager writeDataToDevice:subData Device:self.blunoDev]; } if (remainder>0) { NSRange range; range.length = remainder; range.location = i*20; NSData* subData = [data subdataWithRange:range]; [self.blunoManager writeDataToDevice:subData Device:self.blunoDev]; } |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed