Freitag, 8. Februar 2013

8. Software Settings and the Device Card

The software is downloadable at Google.code. Here is the


The software is a functional version that need to be adjusted in some respects to your own needs. If you have problems, dicovered errors or improvements you should  drop me a line.

The general query of a RFID-card is very simple because of the downloadable Adafruit-Sketch (link already blogged).Now let's have a lokk to the controlling of Squeezedevices and the cooperation with the Logitech Media Server = LMS (formerly SqueezeCenter).

Fundamentals
All media devices of the Squeezegroup need for playing music content the support of a server. This is either the server on the internet (mysqueezbox.com) or as in my case, the LMS that runs on a device in the home network. individual devices have a server in the internal software (Squeezebox Touch).

I consider only the LMS variant in the local network . The most commonly used mode of operation is likely the individual control.


Individual Controlling of Squeeze-devices

Each player will be individually controlled by the LMS. To keep its individuality, is required for an RFID-control in the network, to tell the server to which device  the following command(s) are intended. This message to the LMS, which target device is desired, takes over the DeviceCard  .

If there is a single control system, there must be a group control system. Via the setup of the Squeeze-devices you can form individual groups or switch all devices logically together. The group formation can not be made ​​with this software!   Unfortunately there is not enough capacity in the memory of the Arduino.  



Group Controlling of Squeeze-devices

All actions on a device within a group affect every other out in the same way! I like calling the group-controlling as Party Mode. In all rooms the same music!

Once all devices run into control group, it is irrelevant which device is passed to the data stream. It affects all devices anyway. So you can save the DeviceCard.

The software:
I describe the SW in that substantial parts that are project-specific

// ***** Squeezebox-Settings *****
uchar serNum[5]; // Serial Number of the RFID-Card 
char namTmp[20]="SB%20Touch PC";  // device-name with default
char SBox[150]; // character arry for the message to the server
boolean deviceCard = 0; // Flag, if DeviceCard
 

In this part memory areas for specific content are reserved . I do not work with strings, because of the uncontrolled assignment of memoryspace. On my place that led me to the fact, that sometimes the sketch aborted. So I switched with the help of the German forum to the char-array. Now the locations shown above are "filled" targeted.


// + + + + + + + + + + + + + + + + + + + + + + + + + + + For information + + + + + + + + + + + + + + + + + + + + + + + + + + + +
/**** devices card IDs under which the devices are accessed ****
* const uchar Squeezebox01 [5] = {110,190,163,209,162} // = Squeezebox1 SBClassic livingroom

* const uchar Squeezebox02 [5] = {222,225,153,209,119} // = Squeezebox2 SBClassic kitchen
*
const uchar Squeezebox03 [5] = {30,211,170,209,182} // = Squeezebox3 SBTouch
*
const uchar SqueezeplayPC [5] = {94,111,152,209,120} // = Squeezebox4 SBTouch PC (Squeezeplay)
* const uchar SqueezeplayMAC [5] = {158,29,168,209,250
} // = Squeezebox5 SBTouchMAC (Squeezeplay)
* const uchar SoftsqueezePC [5] = {222,91,164,209,240} // = Squeezebox6 SBClassic PC (Softsqueeze)
* const uchar iPengIPOD [5] = {142,72,165,209,178} // = Squeezebox7 SBiPeng (iPOD) */



In this area, all the UID/CS for the Squeeze-devices are listed informative. You can delete, if you want.
 


//**2-dimensional array for alle Squeezeboxes (Devicecards)
const uchar Squeezebox[7][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}   };


There is a request in the program, where is checked the if detected Card is a DeviceCard. For this purpose, all the UID of the DeviceCards has to be known.

//**2-dimensional  array for alle Mac-adresses
byte macAdrSbox[7][6]={
{0x00,0x04,0x20,0x12,0xde,0x14},
{0x00,0x04,0x20,0x12,0xdc,0x55},
{0x00,0x04,0x20,0x23,0x72,0x16},
{0x00,0x04,0x20,0xb8,0xac,0x25},
{0x00,0x04,0x20,0x0b,0x59,0x2d},
{0x00,0x04,0x20,0xd8,0xae,0xce},
{0x00,0x04,0x20,0x89,0xc4,0x87} };

 

The command to the Logitech Media Server contains the target address of the selected Squeezebox. This address must be set up in the software. Therefore there is always a default adress selected. That is the reason why I always choose a default-Squeezebox.

// +++++++++++++++++++++++++ Einstellen des aktuellen Default-Wertes ++++++++++++++++++++++++
//byte macAdrTmp[6]= {0x00,0x04,0x20,0x12,0xde,0x14}; //default SBClassic Wohnzimmer
//byte macAdrTmp[6]= {0x00,0x04,0x20,0x12,0xdc,0x55}; //default SBClassic Küche
byte macAdrTmp[6]= {0x00,0x04,0x20,0x23,0x72,0x16}; //default SBTouch
//byte macAdrTmp[6]= {0x00,0x15,0xaf,0xb8,0xac,0x25}; //default SBTouch PC (Squeezeplay)
//byte macAdrTmp[6]= {0x00,0x04,0x20,0x23,0x72,0x16}; //default SBTouch MAC (Squeezeplay)
//byte macAdrTmp[6]= {0x00,0x04,0x20,0x23,0x72,0x16}; //default SBClassic PC (Softsqueeze)
//byte macAdrTmp[6]= {0x00,0x04,0x20,0x23,0x72,0x16}; //default SBiPeng (iPod)

 

So is it easier, I've listed all possibilities in advance , from which I choose one. For my tests, the test was very helpful.
 

/ / ** 2-dimensional array of the names of Squeeezegeräte name
/ / this can not exceed 18 characters! Otherwise change!

char namSbox[7][18]={
  {"SB-Classic%20(WZ)"},
  {"SB-Classic%20(KU)"},
  {"SB-Touch"},
  {"SB-Touch%20PC"},
  {"SB-Touch%20Mac"},
  {"SB-Classic%20PC"},
  {"SB-iPeng%20iPOD"}   };



If the stream was diverted to another Squeezebox device, a message is generated for the new device, the data stream it f was diverted olgreich. How this is done I will show you later.


Message on SB-Touch PC :
"RFID Controlling has been rerouted to SB-Touch PC sucessfully"

Message on SB Classic PC:
"RFID Controlling has been rerouted to SB-Classic PC sucessfully"


The pictures show the software versions of the SB Touch and the SB Classic. Next time we have a look onto the code snippet, which is responsible for this message.

Keine Kommentare:

Kommentar veröffentlichen