但我搜索网络,找不到例子. Apple文档仍然没有示例代码.
解决方法 我搞定了.这是我的工作代码:// Processes write command received from a central.- (voID)peripheralManager:(CBPeripheralManager *)peripheral dIDReceiveWriteRequests:(NSArray *)requests{ CBATTRequest* request = [requests objectAtIndex: 0]; NSData* request_data = request.value; CBCharacteristic* write_char = request.characteristic; //CBCentral* write_central = request.central; //NSUInteger multi_message_offset = request.offset; // Face commands this PWR RX to advertise serno UUID? int total_write_requests = 0; if([ write_char.UUID isEqual: [CBUUID UUIDWithString: YOUR_CHaraCTERISTIC_UUID]] ) { // Read desired new_state data from central: unsigned char* new_state = (unsigned char*)[request_data bytes]; my_new_state = new_state[0]; #endif NSLog(@" - advertise serno UUID: %s",my_new_state ? "TRUE" : "FALSE" ); // Select UUID that includes serno of PWR RX,for advertisements: ++total_write_requests; } if( total_write_requests ) [peripheral respondToRequest:request withResult:CBATTErrorSuccess]; // result = success else { NSLog(@"_no_write_request_FAulT !!"); }}总结
以上是内存溢出为你收集整理的iphone – iOS蓝牙LE peripheralManager didReceiveWriteRequests的例子全部内容,希望文章能够帮你解决iphone – iOS蓝牙LE peripheralManager didReceiveWriteRequests的例子所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)