Found the answer:
- (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];
}
For my specific case:
[self sendData:@"a" toChannel:self.rfcommChannel];