Example #1
0
 /// <summary>
 /// Private method which handles the osc messages for the server.
 /// </summary>
 /// <param name="zoneAddress">Zone Address.</param>
 /// <param name="oscEvent">Osc event.</param>
 private void processOscNuvoEventAsServer(Address zoneAddress, OscEvent oscEvent)
 {
     if (oscEvent.OscCommand == eOscEvent.NuvoControl)
     {
         if (oscEvent.OscLabel.Contains("/Status"))
         {
             if (oscEvent.getOscData == 0)
             {
                 _protocolDriver.CommandSwitchZoneOFF(zoneAddress);
             }
             else if (oscEvent.getOscData == 1)
             {
                 _protocolDriver.CommandSwitchZoneON(zoneAddress);
             }
             else
             {
                 // Trace error, received an unkown status
             }
         }
         else if (oscEvent.OscLabel.Contains("/SourceSelection"))
         {
             if (oscEvent.getOscData == 0)
             {
                 // ignore message with value 0, as this is only the "disable" message for the previous selected source
             }
             else if (oscEvent.getOscData == 1)
             {
                 _protocolDriver.CommandSetSource(zoneAddress, new Address(zoneAddress.DeviceId, oscEvent.getSourceId));
             }
             else
             {
                 // Trace error, received an unkown source command
             }
         }
         else if (oscEvent.OscLabel.Contains("/VolumeUp"))
         {
             if (oscEvent.getOscData == 0)
             {
                 _protocolDriver.CommandStopRampVolume(zoneAddress);
             }
             else if (oscEvent.getOscData == 1)
             {
                 _protocolDriver.CommandRampVolumeUP(zoneAddress);
             }
             else
             {
                 // Trace error, received an unkown source command
             }
         }
         else if (oscEvent.OscLabel.Contains("/VolumeDown"))
         {
             if (oscEvent.getOscData == 0)
             {
                 _protocolDriver.CommandStopRampVolume(zoneAddress);
             }
             else if (oscEvent.getOscData == 1)
             {
                 _protocolDriver.CommandRampVolumeDOWN(zoneAddress);
             }
             else
             {
                 // Trace error, received an unkown source command
             }
         }
         else if (oscEvent.OscLabel.Contains("/Volume"))
         {
             _protocolDriver.CommandSetVolume(zoneAddress, oscEvent.getOscData);
         }
         else if (oscEvent.OscLabel.Contains("/Mute"))
         {
             if (oscEvent.getOscData == 0)
             {
                 _protocolDriver.CommandMuteOFF(zoneAddress);
             }
             else if (oscEvent.getOscData == 1)
             {
                 _protocolDriver.CommandMuteON(zoneAddress);
             }
             else
             {
                 // Trace error, received an unkown status
             }
         }
         else if (oscEvent.OscLabel.Contains("/KeyPadLock"))
         {
             if (oscEvent.getOscData == 0)
             {
                 _protocolDriver.CommandSetKeypadLockOFF(zoneAddress);
             }
             else if (oscEvent.getOscData == 1)
             {
                 _protocolDriver.CommandSetKeypadLockON(zoneAddress);
             }
             else
             {
                 // Trace error, received an unkown status
             }
         }
         else if (oscEvent.OscLabel.Contains("/Bass"))
         {
             _protocolDriver.CommandSetBassLevel(zoneAddress, oscEvent.getOscData);
         }
         else if (oscEvent.OscLabel.Contains("/Treble"))
         {
             _protocolDriver.CommandSetTrebleLevel(zoneAddress, oscEvent.getOscData);
         }
     }
 }