IOBluetoothRFCOMMChannel writeSync:length: hangs or crashes
site_archiver@lists.apple.com Delivered-To: bluetooth-dev@lists.apple.com Hi, I have the following method that writes AT commands to a RFCOMM channel: - (void) sendData:(NSString *)string toChannel:(IOBluetoothRFCOMMChannel*)rfcommChannel { int i; // Turn the string into data. NSData *data = [string dataUsingEncoding:NSASCIIStringEncoding]; char buffer[ [data length] +4]; char *bytes = (char *) [data bytes]; // Add a CRLF to the start buffer[0] = 13; buffer[1] = 10; // Copy the data into the buffer. for (i=0;i<[data length];i++) { buffer[2+i] = bytes[i]; } // Append a CRLF buffer[ [data length]+2] = 13; buffer[ [data length]+3] = 10; // Synchronously write the data to the channel. [rfcommChannel writeSync:&buffer length:[data length]+4]; } That works fine in most cases, but sometimes the call of writeSync:length: takes around 5 seconds while my program is in busy waiting. Sometimes the whole system even crashes during the call of writeSync:length: and I have to hard-reset my MacBook:( I cannot find anything in the logs. Did anyone on the list experience problems like that? I have OS 10.6.2 installed and the version of the Apple Bluetooth Software is 2.2.4f3. Thanks for your help, Jan _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Jan-Felix Schwarz