• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Sending AVRCP Commands
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sending AVRCP Commands


  • Subject: Sending AVRCP Commands
  • From: Joshua Brickner <email@hidden>
  • Date: Mon, 7 Sep 2009 20:36:08 -0600

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.

- (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=:", length);
		for(i=0 ; i<length ; i++) {
			printf(" X", 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      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Sending AVRCP Commands
      • From: Roman Pixell <email@hidden>
  • Next by Date: Re: Sending AVRCP Commands
  • Next by thread: Re: Sending AVRCP Commands
  • Index(es):
    • Date
    • Thread