site_archiver@lists.apple.com Delivered-To: bluetooth-dev@lists.apple.com - (IBAction) play:(id)sender { IOReturn ret; int i; const char data[5] = {0x00, 0x48, 0x7C, 0x44, 0x00}; unsigned int length = 5; unsigned char buf[5]; memset(buf,0,5); memcpy(buf, data, length); printf ("send%3d:", length); for(i=0 ; i<length ; i++) { printf(" %02X", buf[i]); } printf("\n"); for (i = 0; i < 10; i++){ ret = [l2channel writeSync:buf length:length]; if (kIOReturnSuccess == ret) break; usleep(10000); } } Cheers -Josh _______________________________________________ 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... I'm trying to learn how to write commands to a bluetooth device using the IOBluetooth framework. I've gotten as far as discovering, pairing, and connecting with the device. I'm at the point where I have an L2CAP channel open and I'm using - (IOReturn)writeSync:(void *)data length: (UInt16)length; to send data. My problem is figuring how to send the specific command that I want. I'm using the AVRCP profile, and the device I'm working with is a media player. For starters I just want to send a play command. From reading the spec for AVRCP I'm pretty sure that this example is what I'm going for: http://imgur.com/K9uUG.png Here is the code I have so far, but it doesn't seem to work. The data goes through and I get back a seemingly random set of data (usually something like: 0x480010) Can anyone give me some pointers? I haven't had much experience with this lower level C stuff such as hex and the like, but I'm eager to learn. This email sent to site_archiver@lists.apple.com
participants (1)
-
Joshua Brickner