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-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]={
{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]= {
  {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.