(Posting here since the empeg connection is ancillary to my problem.)

I've been developing an empeg XM radio interface, and I've got all the basics working, but there's one snag I've run into that I was hoping for some insight on.

The problem has to do with getting the artist and title of the currently-playing song. The serial protocol for the XM receiver I"m using has "regular" and "extended" versions of the commands to get this artist/title information, the extended versions being the ones that give you 32 characters instead of 16. Unfortunately, these extended commands are not working the way they're supposed to.

Here are the basics of what I'm up against:
  • The regular get artist/title commands work properly, and seem to always give me back the correct first 16 characters of the artist/title.
  • The extended artist and title commands both contain the full artist or title -- there is no truncation of the data except when it's too long for the field.
  • When the artist/title is under 32 characters, the remainder of the field is full of junk data.
  • There's no terminating character such as a NULL that I can look for to separate the real data from the junk.
  • There's no length field I can look for to know where the real data ends.
  • The "data valid" field that comes back from these commands is worthless -- it always says the data is valid, but it isn't.

Now, with the above stipulations, normally we'd be screwed whenever the data is 17 <= n <= 32 characters, but the "junk" data is just recognizable enough that I think I can make this work. The thing I've noticed about it is that the junk data appears to be, for both artist and title fields, a portion of the title of the song. That normally wouldn't be enough to go on, but, specifically, it's a portion of the title that starts at index 17 of the buffer, except for the portion that's overwritten with the actual data.

It's probably easier to illustrate. Here are a few of the fields I pulled off of my serial console during testing last night. The green characters are legit data, the red data is junk that's left in the buffer, and the white lines are what the buffer looks like when I get it.


1 character overlap:

01234567890123456789012345678901
One O'Clock Boogie
One O'Clock Boogie

One O'Clock Boogiene O'Clock Boo


6 character overlap

01234567890123456789012345678901
Jenny Take a Ride ('66)
Jenny Take a Ride ('66)

Jenny Take a Ride ('66)Take a Ri


11 character overlap

01234567890123456789012345678901
Back on the Chain Gang ('83)
Back on the Chain Gang ('83)

Back on the Chain Gang ('83) Cha


Title completely fills buffer (degenerate case)

01234567890123456789012345678901
Did You See Jackie Robinson Hit
Did You See Jackie Robinson Hit

Did You See Jackie Robinson Hitc


So, armed with the above knowledge, can anyone figure out how I'd go about reconstructing valid artist/title data beyond 16 characters? It seems like it should be doable for at least some cases, if not most -- I just can't quite figure out the magic incantation to make it work.


Edited by tonyc (27/07/2010 17:09)
_________________________
- Tony C
my empeg stuff