Dienstag, 12. Februar 2013

12. A new DeviceCard is added.

A kind people gave me an iPhone, which is an elderly Version. The App iPeng makes it a fully-flegdes Squeezedevice. This Device we want to add to the Squeezeduino-Software.

I wondered a long time, why my deviceCard does not work with my iPhone. The german Squeezeforum - especially pippin - helped me troubleshooting my problems. At this point sincere thanks is given to all.

You should note the following fact: The description below does only work, if the in iPeng choosen device is the master!!! That means, the name of the device is displayed at the top of the screen. See the following pcture:



1. Step: The iPhone gets its name
We have to give a name to the iPhone, because we want to receive a conformation that the datastream ist reroutet to the iPhone. I will call my device SB-iPhone.


2. Step: The 2-dimensional array is adapted
The 2-dimensional array in the program has to be adapted and should look like the lines below. The blue types mark the changes:

//**2-dimensionales Array der Namen der Squeeezegeräte-Namen
char namSbox[8][18]={             // von 7 nach 8 verändert
{"SB-Classic%2001"},
{"SB-Classic%2002"},
{"SB-Touch"},
{"SB-Touch%20PC"},
{"SB-Touch%20Mac"},
{"SB-Classic%20PC"},
{"SB-iPod"},
{"SB-iPhone"} };                  // hinzugefügt


3. Step: The Mac-Adress of the iPhone
Wir need the Mac-adress of the iPhone. You can find this under settings - General - About - Wi-Fi Adress. My Mac-Adress is: 64:B9:E8:28:23:9A, and now we enter this:

//**2-dimensionales Array für alle Mac-Adressen
byte macAdrSbox[8][6]={
{0x00,0x04,0x20,0x12,0xde,0x14},
{0x00,0x04,0x20,0x12,0xdc,0x55},
{0x00,0x04,0x20,0x23,0x72,0x16},
{0x00,0x15,0xaf,0xb8,0xac,0x25},
{0x00,0x26,0xbb,0x0b,0x59,0x2d},
{0xe3,0xf8,0xd4,0xd8,0xae,0xce},
{0x00,0x24,0x36,0x89,0xc4,0x87},
{0x64,0xB9,0xE8,0x28,0x23,0x9A} };


4.Step: The Intergration of the DeviceCard
I always have some RFID-Cards in stock, of which the the UID/PZ already readout. I choose the card with the number 62-222-174-209-159 and intergrate it into the software:

//**2-dimensionales Array für alle Squeezeboxen (Gerätekarten)
const uchar Squeezebox[8][5]= {
  {110,190,163,209,162},
  {222,225,153,209,119},
  {30,211,170,209,182},
  {94,111,152,209,120},
  {158,29,168,209,250},
  {222,91,164,209,240},
  {142,72,165,209,178},
  {62,222,174,209,159}   };

That was it? No in the progarm something has to be changed.


5. Step:One more change of the program
There is a while-loop that samples the UID/PZ of all kown DeviceCards. The loop-counter has to be changed from '7' to '8'.

 while( i<8)            // es werden 8 DeviceCards überprüft
{
  if (memcmp(Squeezebox[i],serNum,5)==0) //Wenn eine DeviceCard gefunden wurde
  {
    memcpy(namTmp,namSbox[i],18);        // Der Name der SBox wird in eine temporäre Variable geschrieben


6. Step: Updating the software
you should know how to do, therefore no comment :-)


7. Step: Testing the new DeviceCard
Please note, the softwared oes not interpret the repeatedly placing of the same card. That means, if you want to test the new device card twice or more you have to place a different  card in between.

If everything is done properly, the following message is shown on the SB-iPhone after you place the new deviceCard on your reader






So far for today .. the planned video is still in process.