Пример #1
0
        protected DvStateVariable _relatedStateVariable; // References the related state variable in our parent action's parent service

        /// <summary>
        /// Creates a new formal argument for a device's action.
        /// </summary>
        /// <param name="name">Name of the argument. The name SHOULD be chosen to reflect the semantic use
        /// of the argument. MUST NOT contain a hyphen character ("-") nor
        /// a hash character (“#”, 23 Hex in UTF-8). Case sensitive. First character MUST be a USASCII
        /// letter ("A"-"Z", "a"-"z"), USASCII digit ("0"-"9"), an underscore ("_"), or a non-experimental
        /// Unicode letter or digit greater than U+007F. Succeeding characters MUST be a USASCII letter
        /// ("A"-"Z", "a"-"z"), USASCII digit ("0"-"9"), an underscore ("_"), a period ("."), a Unicode
        /// combiningchar, an extender, or a non-experimental Unicode letter or digit greater than
        /// U+007F. The first three letters MUST NOT be "XML" in any combination of case.
        /// Case sensitive. SHOULD be &lt; 32 characters.
        /// </param>
        /// <param name="relatedStateVariable">Defines the type of the argument; see further explanation in (DevArch).</param>
        /// <param name="direction">Defines whether argument is an input or output parameter.</param>
        /// <param name="isReturnValue">Returns the information if this argument is the return value of the parent
        /// action. This argument is allowed to be <c>true</c> at most for one argument per action. If it is set to
        /// <c>true</c> for an argument, that argument MUST be the first output argument of the action.</param>
        public DvArgument(string name, DvStateVariable relatedStateVariable, ArgumentDirection direction, bool isReturnValue)
        {
            _name = name;
            _relatedStateVariable = relatedStateVariable;
            _direction            = direction;
            _isReturnValue        = isReturnValue;
        }
Пример #2
0
    protected DvStateVariable _relatedStateVariable; // References the related state variable in our parent action's parent service

    /// <summary>
    /// Creates a new formal argument for a device's action.
    /// </summary>
    /// <param name="name">Name of the argument. The name SHOULD be chosen to reflect the semantic use
    /// of the argument. MUST NOT contain a hyphen character ("-") nor
    /// a hash character (“#”, 23 Hex in UTF-8). Case sensitive. First character MUST be a USASCII
    /// letter ("A"-"Z", "a"-"z"), USASCII digit ("0"-"9"), an underscore ("_"), or a non-experimental
    /// Unicode letter or digit greater than U+007F. Succeeding characters MUST be a USASCII letter
    /// ("A"-"Z", "a"-"z"), USASCII digit ("0"-"9"), an underscore ("_"), a period ("."), a Unicode
    /// combiningchar, an extender, or a non-experimental Unicode letter or digit greater than
    /// U+007F. The first three letters MUST NOT be "XML" in any combination of case.
    /// Case sensitive. SHOULD be &lt; 32 characters.
    /// </param>
    /// <param name="relatedStateVariable">Defines the type of the argument; see further explanation in (DevArch).</param>
    /// <param name="direction">Defines whether argument is an input or output parameter.</param>
    /// <param name="isReturnValue">Returns the information if this argument is the return value of the parent
    /// action. This argument is allowed to be <c>true</c> at most for one argument per action. If it is set to
    /// <c>true</c> for an argument, that argument MUST be the first output argument of the action.</param>
    public DvArgument(string name, DvStateVariable relatedStateVariable, ArgumentDirection direction, bool isReturnValue)
    {
      _name = name;
      _relatedStateVariable = relatedStateVariable;
      _direction = direction;
      _isReturnValue = isReturnValue;
    }
Пример #3
0
 /// <summary>
 /// Checks if the specified <paramref name="variable"/> is moderated, calculates the next eventing
 /// time for the variable and adapts internal moderation data.
 /// </summary>
 /// <remarks>
 /// The specified <paramref name="variable"/> will be added to the pending event notifications.
 /// </remarks>
 /// <param name="variable">Variable which was changed.</param>
 public void ModerateChangeEvent(DvStateVariable variable)
 {
   ModerationData md;
   bool wasCreated = false;
   if (!_moderationData.TryGetValue(variable, out md))
   {
     wasCreated = true;
     _moderationData[variable] = md = new ModerationData();
   }
   DateTime now = DateTime.Now;
   DateTime scheduleTime;
   if (variable.ModeratedMaximumRate.HasValue)
   {
     if (wasCreated || md.LastEventTime + variable.ModeratedMaximumRate < now)
       scheduleTime = now;
     else
       scheduleTime = now + variable.ModeratedMaximumRate.Value;
   }
   else if (variable.ModeratedMinimumDelta != 0)
   {
     if (!(variable.DataType is DvStandardDataType))
       scheduleTime = now;
     else
     {
       if (!wasCreated &&
           Math.Abs(((DvStandardDataType) variable.DataType).GetNumericDelta(md.LastValue, variable.Value)) < variable.ModeratedMinimumDelta)
         return;
       scheduleTime = now;
     }
   }
   else
     scheduleTime = now;
   _scheduledEventNotifications.Add(scheduleTime, new DvStateVariable[] {variable});
 }
    public UPnPClientControllerServiceImpl() : base(
        UPnPTypesAndIds.CLIENT_CONTROLLER_SERVICE_TYPE, UPnPTypesAndIds.CLIENT_CONTROLLER_SERVICE_TYPE_VERSION,
        UPnPTypesAndIds.CLIENT_CONTROLLER_SERVICE_ID)
    {
      // Used for a system ID string
      DvStateVariable A_ARG_TYPE_SystemId = new DvStateVariable("A_ARG_TYPE_SystemId", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_SystemId);

      // Used to transport a resource path expression
      DvStateVariable A_ARG_TYPE_ResourcePath = new DvStateVariable("A_ARG_TYPE_ResourcePath", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_ResourcePath);

      // CSV of media category strings
      DvStateVariable A_ARG_TYPE_MediaCategoryEnumeration = new DvStateVariable("A_ARG_TYPE_MediaCategoryEnumeration", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_MediaCategoryEnumeration);

      // Used to transport the import modes "Import" and "Refresh" for the ImportLocation action
      DvStateVariable A_ARG_TYPE_ImportMode = new DvStateVariable("A_ARG_TYPE_ImportMode", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_ImportMode);

      // More state variables go here

      DvAction getHomeServerSystemIdAction = new DvAction("GetHomeServerSystemId", OnGetHomeServerSystemId,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("HomeServerSystemId", A_ARG_TYPE_SystemId, ArgumentDirection.Out),
          });
      AddAction(getHomeServerSystemIdAction);

      DvAction importLocationAction = new DvAction("ImportLocation", OnImportLocation,
          new DvArgument[] {
            new DvArgument("Path", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
            new DvArgument("MediaCategories", A_ARG_TYPE_MediaCategoryEnumeration, ArgumentDirection.In),
            new DvArgument("ImportMode", A_ARG_TYPE_ImportMode, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(importLocationAction);

      // More actions go here
    }
Пример #5
0
 internal void FireStateVariableChanged(DvStateVariable variable)
 {
     try
     {
         StateVariableChangedDlgt stateVariableChanged = StateVariableChanged;
         if (stateVariableChanged != null)
         {
             stateVariableChanged(variable);
         }
     }
     catch (Exception e)
     {
         UPnPConfiguration.LOGGER.Warn("DvService: Error invoking StateVariableChanged delegate", e);
     }
 }
Пример #6
0
    public FanArtServiceImpl()
      : base(Consts.FANART_SERVICE_TYPE, Consts.FANART_SERVICE_TYPE_VERSION, Consts.FANART_SERVICE_ID)
    {
      DvStateVariable A_ARG_TYPE_MediaType = new DvStateVariable("A_ARG_TYPE_MediaType", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_MediaType);

      DvStateVariable A_ARG_TYPE_FanArtType = new DvStateVariable("A_ARG_TYPE_FanArtType", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_FanArtType);

      DvStateVariable A_ARG_TYPE_Name = new DvStateVariable("A_ARG_TYPE_Name", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_Name);

      DvStateVariable A_ARG_TYPE_Width = new DvStateVariable("A_ARG_TYPE_Width", new DvStandardDataType(UPnPStandardDataType.Int)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_Width);

      DvStateVariable A_ARG_TYPE_Height = new DvStateVariable("A_ARG_TYPE_Height", new DvStandardDataType(UPnPStandardDataType.Int)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_Height);

      DvStateVariable A_ARG_TYPE_Bool = new DvStateVariable("A_ARG_TYPE_Bool", new DvStandardDataType(UPnPStandardDataType.Boolean)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_Bool);

      DvStateVariable A_ARG_TYPE_ImgCollection = new DvStateVariable("A_ARG_TYPE_ImgCollection", new DvExtendedDataType(UPnPDtImageCollection.Instance)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_ImgCollection);

      DvAction getFanArt = new DvAction("GetFanArt", OnGetFanArt,
                                   new[]
                                     {
                                       new DvArgument("MediaType", A_ARG_TYPE_MediaType, ArgumentDirection.In),
                                       new DvArgument("FanArtType", A_ARG_TYPE_FanArtType, ArgumentDirection.In),
                                       new DvArgument("Name", A_ARG_TYPE_Name, ArgumentDirection.In),
                                       new DvArgument("MaxWidth", A_ARG_TYPE_Width, ArgumentDirection.In),
                                       new DvArgument("MaxHeight", A_ARG_TYPE_Height, ArgumentDirection.In),
                                       new DvArgument("SingleRandom", A_ARG_TYPE_Bool, ArgumentDirection.In)
                                     },
                                   new[]
                                     {
                                       new DvArgument("FanArts", A_ARG_TYPE_ImgCollection, ArgumentDirection.Out, true)
                                     });
      AddAction(getFanArt);
    }
Пример #7
0
    public ServerSettingsImpl()
      : base(Consts.SERVERSETTINGS_SERVICE_TYPE, Consts.SERVERSETTINGS_SERVICE_TYPE_VERSION, Consts.SERVERSETTINGS_SERVICE_ID)
    {
      DvStateVariable A_ARG_TYPE_SettingsType = new DvStateVariable("A_ARG_TYPE_SettingsType", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_SettingsType);
      DvStateVariable A_ARG_TYPE_SettingsValue = new DvStateVariable("A_ARG_TYPE_SettingsValue", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_SettingsValue);

      DvAction loadAction = new DvAction(Consts.ACTION_LOAD, OnLoad,
                             new DvArgument[] { new DvArgument("SettingsTypeName", A_ARG_TYPE_SettingsType, ArgumentDirection.In) },
                             new DvArgument[] { new DvArgument("Result", A_ARG_TYPE_SettingsValue, ArgumentDirection.Out, true) });

      AddAction(loadAction);
      DvAction saveAction = new DvAction(Consts.ACTION_SAVE, OnSave,
                             new DvArgument[]
                               {
                                 new DvArgument("SettingsTypeName", A_ARG_TYPE_SettingsType, ArgumentDirection.In),
                                 new DvArgument("Settings", A_ARG_TYPE_SettingsValue, ArgumentDirection.In)
                               },
                             new DvArgument[] { });

      AddAction(saveAction);
    }
Пример #8
0
 public DvArgument(string name, DvStateVariable relatedStateVariable, ArgumentDirection direction) :
     this(name, relatedStateVariable, direction, false) { }
        public UPnPContentDirectoryServiceImpl()
            : base(UPnPMediaServerDevice.CONTENT_DIRECTORY_SERVICE_TYPE, UPnPMediaServerDevice.CONTENT_DIRECTORY_SERVICE_TYPE_VERSION,
                UPnPMediaServerDevice.CONTENT_DIRECTORY_SERVICE_ID)
        {
            // Used for a boolean value
            DvStateVariable A_ARG_TYPE_BrowseFlag = new DvStateVariable("A_ARG_TYPE_BrowseFlag",
                                                                        new DvStandardDataType(
                                                                            UPnPStandardDataType.String))
                                                        {
                                                            SendEvents = false,
                                                            AllowedValueList = new List<string>() { "BrowseMetadata", "BrowseDirectChildren" }
                                                        };
            AddStateVariable(A_ARG_TYPE_BrowseFlag);

            DvStateVariable A_ARG_TYPE_Count = new DvStateVariable("A_ARG_TYPE_Count",
                                                                   new DvStandardDataType(UPnPStandardDataType.Ui4))
                                                   {
                                                       SendEvents = false
                                                   };
            AddStateVariable(A_ARG_TYPE_Count);

            DvStateVariable A_ARG_TYPE_Filter = new DvStateVariable("A_ARG_TYPE_Filter",
                                                                    new DvStandardDataType(UPnPStandardDataType.String))
                                                    {
                                                        SendEvents = false
                                                    };
            AddStateVariable(A_ARG_TYPE_Filter);

            DvStateVariable A_ARG_TYPE_Index = new DvStateVariable("A_ARG_TYPE_Index",
                                                                   new DvStandardDataType(UPnPStandardDataType.Ui4))
                                                   {
                                                       SendEvents = false
                                                   };
            AddStateVariable(A_ARG_TYPE_Index);

            DvStateVariable A_ARG_TYPE_ObjectID = new DvStateVariable("A_ARG_TYPE_ObjectID",
                                                                      new DvStandardDataType(UPnPStandardDataType.String))
                                                      {
                                                          SendEvents = false
                                                      };
            AddStateVariable(A_ARG_TYPE_ObjectID);

            DvStateVariable A_ARG_TYPE_Result = new DvStateVariable("A_ARG_TYPE_Result",
                                                                    new DvStandardDataType(UPnPStandardDataType.String))
                                                    {
                                                        SendEvents = false
                                                    };
            AddStateVariable(A_ARG_TYPE_Result);

            DvStateVariable A_ARG_TYPE_SearchCriteria = new DvStateVariable("A_ARG_TYPE_SearchCriteria",
                                                                            new DvStandardDataType(
                                                                                UPnPStandardDataType.String))
                                                            {
                                                                SendEvents = false
                                                            };
            AddStateVariable(A_ARG_TYPE_SearchCriteria);

            DvStateVariable A_ARG_TYPE_SortCriteria = new DvStateVariable("A_ARG_TYPE_SortCriteria",
                                                                          new DvStandardDataType(
                                                                              UPnPStandardDataType.String))
                                                          {
                                                              SendEvents = false
                                                          };
            AddStateVariable(A_ARG_TYPE_SortCriteria);

            DvStateVariable A_ARG_TYPE_UpdateID = new DvStateVariable("A_ARG_TYPE_UpdateID",
                                                                      new DvStandardDataType(UPnPStandardDataType.Ui4))
                                                      {
                                                          SendEvents = false
                                                      };
            AddStateVariable(A_ARG_TYPE_UpdateID);

            DvStateVariable SearchCapabilities = new DvStateVariable("SearchCapabilities",
                                                          new DvStandardDataType(UPnPStandardDataType.String))
            {
                SendEvents = false
            };
            AddStateVariable(SearchCapabilities);

            DvStateVariable SortCapabilities = new DvStateVariable("SortCapabilities",
                                                          new DvStandardDataType(UPnPStandardDataType.String))
            {
                SendEvents = false
            };
            AddStateVariable(SortCapabilities);

            DvStateVariable SystemUpdateID = new DvStateVariable("SystemUpdateID",
                                                          new DvStandardDataType(UPnPStandardDataType.Ui4))
            {
                SendEvents = true
            };
            AddStateVariable(SystemUpdateID);

            DvAction browseAction = new DvAction("Browse", OnBrowse,
                                                      new DvArgument[]
                                                          {
                                                              new DvArgument("ObjectID", A_ARG_TYPE_ObjectID,
                                                                             ArgumentDirection.In),
                                                              new DvArgument("BrowseFlag", A_ARG_TYPE_BrowseFlag,
                                                                             ArgumentDirection.In),
                                                              new DvArgument("Filter", A_ARG_TYPE_Filter,
                                                                             ArgumentDirection.In),
                                                              new DvArgument("StartingIndex",
                                                                             A_ARG_TYPE_Index,
                                                                             ArgumentDirection.In),
                                                              new DvArgument("RequestedCount",
                                                                             A_ARG_TYPE_Count,
                                                                             ArgumentDirection.In),
                                                              new DvArgument("SortCriteria",
                                                                             A_ARG_TYPE_SortCriteria,
                                                                             ArgumentDirection.In)
                                                          },
                                                      new DvArgument[]
                                                          {
                                                              new DvArgument("Result",
                                                                             A_ARG_TYPE_Result,
                                                                             ArgumentDirection.Out),
                                                              new DvArgument("NumberReturned",
                                                                             A_ARG_TYPE_Count,
                                                                             ArgumentDirection.Out),
                                                              new DvArgument("TotalMatches",
                                                                             A_ARG_TYPE_Count,
                                                                             ArgumentDirection.Out),
                                                              new DvArgument("UpdateID",
                                                                             A_ARG_TYPE_Count,
                                                                             ArgumentDirection.Out)
                                                          });
            AddAction(browseAction);

            DvAction getSearchCapabilitiesAction = new DvAction("GetSearchCapabilities", OnGetSearchCapabilities,
                                          new DvArgument[]
                                                          {
                                                          },
                                          new DvArgument[]
                                                          {
                                                              new DvArgument("SearchCaps",
                                                                             SearchCapabilities,
                                                                             ArgumentDirection.Out),
                                                          });
            AddAction(getSearchCapabilitiesAction);

            DvAction getSortCapabilitiesAction = new DvAction("GetSortCapabilities", OnGetSortCapabilities,
                                         new DvArgument[]
                                                          {
                                                          },
                                         new DvArgument[]
                                                          {
                                                              new DvArgument("SortCaps",
                                                                             SortCapabilities,
                                                                             ArgumentDirection.Out),
                                                          });
            AddAction(getSortCapabilitiesAction);

            DvAction getSystemUpdateIDAcion = new DvAction("GetSystemUpdateID", OnGetSystemUpdateID,
                                         new DvArgument[]
                                                          {
                                                          },
                                         new DvArgument[]
                                                          {
                                                              new DvArgument("Id",
                                                                             SystemUpdateID,
                                                                             ArgumentDirection.Out),
                                                          });
            AddAction(getSystemUpdateIDAcion);

            DvAction searchAction = new DvAction("Search", OnSearch,
                                          new DvArgument[]
                                                          {
                                                              new DvArgument("ContainerID", A_ARG_TYPE_ObjectID,
                                                                             ArgumentDirection.In),
                                                              new DvArgument("SearchCriteria", A_ARG_TYPE_SearchCriteria,
                                                                             ArgumentDirection.In),
                                                              new DvArgument("Filter", A_ARG_TYPE_Filter,
                                                                             ArgumentDirection.In),
                                                              new DvArgument("StartingIndex",
                                                                             A_ARG_TYPE_Index,
                                                                             ArgumentDirection.In),
                                                              new DvArgument("RequestedCount",
                                                                             A_ARG_TYPE_Count,
                                                                             ArgumentDirection.In),
                                                              new DvArgument("SortCriteria",
                                                                             A_ARG_TYPE_SortCriteria,
                                                                             ArgumentDirection.In)
                                                          },
                                          new DvArgument[]
                                                          {
                                                              new DvArgument("Result",
                                                                             A_ARG_TYPE_Result,
                                                                             ArgumentDirection.Out),
                                                              new DvArgument("NumberReturned",
                                                                             A_ARG_TYPE_Count,
                                                                             ArgumentDirection.Out),
                                                              new DvArgument("TotalMatches",
                                                                             A_ARG_TYPE_Count,
                                                                             ArgumentDirection.Out),
                                                              new DvArgument("UpdateID",
                                                                             A_ARG_TYPE_Count,
                                                                             ArgumentDirection.Out)
                                                          });
            AddAction(searchAction);
        }
Пример #10
0
 public DvArgument(string name, DvStateVariable relatedStateVariable, ArgumentDirection direction) :
     this(name, relatedStateVariable, direction, false)
 {
 }
Пример #11
0
 /// <summary>
 /// Called when a state variable has changed its value.
 /// </summary>
 /// <remarks>
 /// This method will check if the variable is evented. If not, nothing happens. If yes, and the variable
 /// is moderated in rate or minimum change, it will be scheduled to be evented later, or will
 /// be evented at once, depending on the moderation.
 /// </remarks>
 /// <param name="variable">The variable which changed its value.</param>
 public void StateVariableChanged(DvStateVariable variable)
 {
   if (!variable.SendEvents)
     return;
   lock (_serverData.SyncObj)
   {
     // Only send event if:
     // - Subscription is not expired
     // - Initial event was already sent
     if (DateTime.Now > Expiration)
     {
       Dispose();
       return;
     }
     if (_eventingState.EventKey == 0)
       // Avoid sending "normal" change events before the initial event was sent
       return;
     _eventingState.ModerateChangeEvent(variable);
   }
   // Outside the lock
   ScheduleEvents();
 }
Пример #12
0
 /// <summary>
 /// Adds the specified state <paramref name="variable"/> to this service.
 /// </summary>
 /// <remarks>
 /// The state variables need to be added in a special order. If this service is a standard service, state variables
 /// of the standard service type need to be added first. After that, additional state variables might be added.
 /// </remarks>
 /// <param name="variable">UPnP state variable to add.</param>
 public void AddStateVariable(DvStateVariable variable)
 {
   _stateVariables.Add(variable.Name, variable);
   variable.ParentService = this;
 }
    public UPnPAVTransportServiceImpl()
      : base(
        UPnPDevice.AV_TRANSPORT_SERVICE_TYPE,
        UPnPDevice.AV_TRANSPORT_SERVICE_TYPE_VERSION,
        UPnPDevice.AV_TRANSPORT_SERVICE_ID)
    {

      #region DvStateVariables

      // Used for a boolean value
      DvStateVariable AbsoluteCounterPosition = new DvStateVariable("AbsoluteCounterPosition", new DvStandardDataType(UPnPStandardDataType.I4))
      {
        SendEvents = false,
        Value = 2147483647,
      };
      AddStateVariable(AbsoluteCounterPosition);

      // Used for a boolean value
      DvStateVariable AbsoluteTimePosition = new DvStateVariable("AbsoluteTimePosition", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "NOT_IMPLEMENTED",
      };
      AddStateVariable(AbsoluteTimePosition);

      // Used for a boolean value
      DvStateVariable AVTransportURI = new DvStateVariable("AVTransportURI", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
      };
      AddStateVariable(AVTransportURI);

      // Used for a boolean value
      DvStateVariable AVTransportURIMetaData = new DvStateVariable("AVTransportURIMetaData", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
      };
      AddStateVariable(AVTransportURIMetaData);

      // Used for a boolean value
      DvStateVariable CurrentMediaDurtaion = new DvStateVariable("CurrentMediaDuration", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "00:00:00",
      };
      AddStateVariable(CurrentMediaDurtaion);

      // Used for a boolean value
      DvStateVariable CurrentPlayMode = new DvStateVariable("CurrentPlayMode", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "NORMAL",
        AllowedValueList = new List<string>
        {
          "NORMAL",
          "REPEAT_ALL",
          "INTRO"
        }
      };
      AddStateVariable(CurrentPlayMode);

      // Used for a boolean value
      DvStateVariable CurrentRecordQualityMode = new DvStateVariable("CurrentRecordQualityMode", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "NOT_IMPLEMENT",
        AllowedValueList = new List<string>
        {
          "0:EP",
          "1:LP",
          "2:SP",
          "0:BASIC",
          "1:MEDIUM",
          "2:HIGH",
          "NOT_IMPLEMENTED",
          "vendor-defined"
        }
      };
      AddStateVariable(CurrentRecordQualityMode);

      // Used for a boolean value
      DvStateVariable CurrentTrack = new DvStateVariable("CurrentTrack", new DvStandardDataType(UPnPStandardDataType.Ui4))
      {
        SendEvents = false,
        Value = (UInt32)0,
        // TODO Add allowed Range
        // AllowedValueRange = new DvAllowedValueRange()
      };
      AddStateVariable(CurrentTrack);

      // Used for a boolean value
      DvStateVariable CurrentTrackDurtion = new DvStateVariable("CurrentTrackDuration", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "00:00:00",
      };
      AddStateVariable(CurrentTrackDurtion);

      // Used for a boolean value
      DvStateVariable CurrentTrackMetaData = new DvStateVariable("CurrentTrackMetaData", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
      };
      AddStateVariable(CurrentTrackMetaData);

      // Used for a boolean value
      DvStateVariable CurrentTrackURI = new DvStateVariable("CurrentTrackURI", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
      };
      AddStateVariable(CurrentTrackURI);

      // Used for a boolean value
      DvStateVariable CurrentTransportActions = new DvStateVariable("CurrentTransportActions", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
      };
      AddStateVariable(CurrentTransportActions);

      // Used for a boolean value
      DvStateVariable LastChange = new DvStateVariable("LastChange", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = true,
        Value = "<Event xmlns=\"urn:schemas-upnp-org:metadata-1-0/AVT/\"></Event>"
      };
      AddStateVariable(LastChange);

      // Used for a boolean value
      DvStateVariable NextAVTransportURI = new DvStateVariable("NextAVTransportURI", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
      };
      AddStateVariable(NextAVTransportURI);

      // Used for a boolean value
      DvStateVariable NextAVTransportURIMetaData = new DvStateVariable("NextAVTransportURIMetaData", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
      };
      AddStateVariable(NextAVTransportURIMetaData);

      // Used for a boolean value
      DvStateVariable NumberOfTracks = new DvStateVariable("NumberOfTracks", new DvStandardDataType(UPnPStandardDataType.Ui4))
      {
        SendEvents = false,
        Value = (UInt32)0,
        // TODO Add valueRange
      };
      AddStateVariable(NumberOfTracks);

      // Used for a boolean value
      DvStateVariable PlaybackStorageMedium = new DvStateVariable("PlaybackStorageMedium", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "NONE",
        AllowedValueList = new List<string>
        {
          "UNKNOWN",
          "DV",
          "MINI-DV",
          "VHS",
          "W-VHS",
          "S-VHS",
          "D-VHS",
          "VHSC",
          "VIDEO8",
          "HI8",
          "CD-ROM",
          "CD-DA",
          "CD-R",
          "CD-RW",
          "VIDEO-CD",
          "SACD",
          "MD-AUDIO",
          "MD-PICTURE",
          "DVD-ROM",
          "DVD-VIDEO",
          "DVD-R",
          "DVD+RW",
          "DVD-RW",
          "DVD-RAM",
          "DVD-AUDIO",
          "DAT",
          "LD",
          "HDD",
          "MICRO-MV",
          "NETWORK",
          "NONE",
          "NOT_IMPLEMENTED",
          "vendor-defined"
        }
      };
      AddStateVariable(PlaybackStorageMedium);

      // Used for a boolean value
      DvStateVariable PossiblePlaybackStorageMedia = new DvStateVariable("PossiblePlaybackStorgrageMedia", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = String.Join(",", PlaybackStorageMedium.AllowedValueList),
      };
      AddStateVariable(PossiblePlaybackStorageMedia);

      // Used for a boolean value
      DvStateVariable PossibleRecordQualityModes = new DvStateVariable("PossibleRecordQualityModes", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "NOT_IMPLEMENT",
      };
      AddStateVariable(PossibleRecordQualityModes);


      // Used for a boolean value
      DvStateVariable RecordStorageMedium = new DvStateVariable("RecordStorageMedium", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "NONE",
        AllowedValueList = new List<string>
        {
          "UNKNOWN",
          "DV",
          "MINI-DV",
          "VHS",
          "W-VHS",
          "S-VHS",
          "D-VHS",
          "VHSC",
          "VIDEO8",
          "HI8",
          "CD-ROM",
          "CD-DA",
          "CD-R",
          "CD-RW",
          "VIDEO-CD",
          "SACD",
          "MD-AUDIO",
          "MD-PICTURE",
          "DVD-ROM",
          "DVD-VIDEO",
          "DVD-R",
          "DVD+RW",
          "DVD-RW",
          "DVD-RAM",
          "DVD-AUDIO",
          "DAT",
          "LD",
          "HDD",
          "MICRO-MV",
          "NETWORK",
          "NONE",
          "NOT_IMPLEMENTED",
          "vendor-defined"
        }
      };
      AddStateVariable(RecordStorageMedium);

      // Used for a boolean value
      DvStateVariable PossibleRecordStorageMedia = new DvStateVariable("PossibleRecordStorageMedia", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = String.Join(",", RecordStorageMedium.AllowedValueList),
      };
      AddStateVariable(PossibleRecordStorageMedia);

      // Used for a boolean value
      DvStateVariable RecordMediumWriteStatus = new DvStateVariable("RecordMediumWriteStatus", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "NOT_IMPLEMENT",
        AllowedValueList = new List<string>
        {
          "WRITABLE",
          "PROTECTED",
          "NOT_WRITABLE",
          "UNKNOWN",
          "NOT_IMPLEMENTED"
        }
      };
      AddStateVariable(RecordMediumWriteStatus);

      // Used for a boolean value
      DvStateVariable RelativeCounterPosition = new DvStateVariable("RelativeCounterPosition", new DvStandardDataType(UPnPStandardDataType.I4))
      {
        SendEvents = false,
        Value = 2147483647,
      };
      AddStateVariable(RelativeCounterPosition);

      // Used for a boolean value
      DvStateVariable RelativeTimePosition = new DvStateVariable("RelativeTimePosition", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "NOT_IMPLEMENTED",
      };
      AddStateVariable(RelativeTimePosition);

      // Used for a boolean value
      DvStateVariable TransportPlaySpeed = new DvStateVariable("TransportPlaySpeed", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "1",
        AllowedValueList = new List<string>
        {
          "1",
          "vendor-defined"
        }
      };
      AddStateVariable(TransportPlaySpeed);

      // Used for a boolean value
      DvStateVariable TransportState = new DvStateVariable("TransportState", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "NO_MEDIA_PRESENT",
        AllowedValueList = new List<string>
        {
          "STOPPED",
          "PAUSED_PLAYBACK",
          "PAUSED_RECORDING",
          "PLAYING",
          "RECORDING",
          "TRANSITIONING",
          "NO_MEDIA_PRESENT"
        }
      };
      AddStateVariable(TransportState);

      // Used for a boolean value 
      DvStateVariable TransportStatus = new DvStateVariable("TransportStatus", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "OK",
        AllowedValueList = new List<string>
        {
          "OK",
          "ERROR_OCCURRED",
          "vendor-defined"
        }
      };
      AddStateVariable(TransportStatus);

      #endregion DvStateVariables

      #region A_ARG_TYPE

      // Used for a boolean value
      DvStateVariable A_ARG_TYPE_InstanceID = new DvStateVariable("A_ARG_TYPE_InstanceID", new DvStandardDataType(UPnPStandardDataType.Ui4)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_InstanceID);

      // Used for a boolean value
      DvStateVariable A_ARG_TYPE_SeekMode = new DvStateVariable("A_ARG_TYPE_SeekMode", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        AllowedValueList = new List<string>
        {
          //"ABS_TIME",
          "REL_TIME", // we only support REL_TIME => checked in "onAction
          //"ABS_COUNT",
          //"REL_COUNT",
          //"TRACK_NR",
          //"CHANNEL_FREQ",
          //"TAPE-INDEX",
          //"FRAME"
        }
      };
      AddStateVariable(A_ARG_TYPE_SeekMode);

      // Used for a boolean value
      DvStateVariable A_ARG_TYPE_SeekTarget = new DvStateVariable("A_ARG_TYPE_SeekTarget", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_SeekTarget);

      #endregion A_ARG_TYPE;

      #region Actions

      DvAction getCurrentTransportActionsction = new DvAction("GetCurrentTransportActions", OnGetCurrentTransportActions,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("Sink",
            CurrentTransportActions,
            ArgumentDirection.Out),
        });
      AddAction(getCurrentTransportActionsction);

      DvAction getDeviceCapabilitiesAction = new DvAction("GetDeviceCapabilities", OnGetDeviceCapabilities,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("PlayMedia",
            PossiblePlaybackStorageMedia,
            ArgumentDirection.Out),
          new DvArgument("RecMedia",
            PossibleRecordStorageMedia,
            ArgumentDirection.Out),
          new DvArgument("RecQualityModes",
            PossibleRecordQualityModes,
            ArgumentDirection.Out),
        });
      AddAction(getDeviceCapabilitiesAction);

      DvAction getMediaInfoAction = new DvAction("GetMediaInfo", OnGetMediaInfo,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("NrTracks",
            NumberOfTracks,
            ArgumentDirection.Out),
          new DvArgument("MediaDuration",
            CurrentMediaDurtaion,
            ArgumentDirection.Out),
          new DvArgument("CurrentURI",
            AVTransportURI,
            ArgumentDirection.Out),
          new DvArgument("CurrentURIMetaData",
            AVTransportURIMetaData,
            ArgumentDirection.Out),
          new DvArgument("NextURI",
            NextAVTransportURI,
            ArgumentDirection.Out),
          new DvArgument("NextURIMetaData",
            NextAVTransportURIMetaData,
            ArgumentDirection.Out),
          new DvArgument("PlayMedium",
            PlaybackStorageMedium,
            ArgumentDirection.Out),
          new DvArgument("RecordMedium",
            RecordStorageMedium,
            ArgumentDirection.Out),
          new DvArgument("WriteStatus",
            RecordMediumWriteStatus,
            ArgumentDirection.Out),
        });
      AddAction(getMediaInfoAction);

      DvAction getPositionInfoAction = new DvAction("GetPositionInfo", OnGetPositionInfo,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("Track",
            CurrentTrack,
            ArgumentDirection.Out),
          new DvArgument("TrackDuration",
            CurrentTrackDurtion,
            ArgumentDirection.Out),
          new DvArgument("TrackMetaData",
            CurrentTrackMetaData,
            ArgumentDirection.Out),
          new DvArgument("TrackURI",
            CurrentTrackURI,
            ArgumentDirection.Out),
          new DvArgument("RelTime",
            RelativeTimePosition,
            ArgumentDirection.Out),
          new DvArgument("AbsTime",
            AbsoluteTimePosition,
            ArgumentDirection.Out),
          new DvArgument("RelCount",
            RelativeCounterPosition,
            ArgumentDirection.Out),
          new DvArgument("AbsCount",
            AbsoluteCounterPosition,
            ArgumentDirection.Out),
        });
      AddAction(getPositionInfoAction);

      DvAction getTransportInfoAction = new DvAction("GetTransportInfo", OnGetTransportInfo,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("CurrentTransportState",
            TransportState,
            ArgumentDirection.Out),
          new DvArgument("CurrentTransportStatus",
            TransportStatus,
            ArgumentDirection.Out),
          new DvArgument("CurrentSpeed",
            TransportPlaySpeed,
            ArgumentDirection.Out),
        });
      AddAction(getTransportInfoAction);

      DvAction getTransportSettingsAction = new DvAction("GetTransportSettings", OnGetTransportSettings,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("PlayMode",
            CurrentPlayMode,
            ArgumentDirection.Out),
          new DvArgument("RecQualityMode",
            CurrentRecordQualityMode,
            ArgumentDirection.Out),
        });
      AddAction(getTransportSettingsAction);

      DvAction nextAction = new DvAction("Next", OnNext,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
        });
      AddAction(nextAction);

      DvAction pauseAction = new DvAction("Pause", OnPause,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
        });
      AddAction(pauseAction);

      DvAction playAction = new DvAction("Play", OnPlay,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
          new DvArgument("Speed",
            TransportPlaySpeed,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          
        });
      AddAction(playAction);

      DvAction previousAction = new DvAction("Previous", OnPrevious,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
        });
      AddAction(previousAction);

      DvAction seekAction = new DvAction("Seek", OnSeek,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
          new DvArgument("Unit",
            A_ARG_TYPE_SeekMode,
            ArgumentDirection.In),
          new DvArgument("Target",
            A_ARG_TYPE_SeekTarget,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
        });
      AddAction(seekAction);

      DvAction setAVTransportURIAction = new DvAction("SetAVTransportURI", OnSetAVTransportURI,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
          new DvArgument("CurrentURI",
            AVTransportURI,
            ArgumentDirection.In),
          new DvArgument("CurrentURIMetaData",
            AVTransportURIMetaData,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
        });
      AddAction(setAVTransportURIAction);

      DvAction setNextAVTransportURIAction = new DvAction("SetNextAVTransportURI", OnSetNextAVTransportURI,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
          new DvArgument("NextURI",
            NextAVTransportURI,
            ArgumentDirection.In),
          new DvArgument("NextURIMetaData",
            NextAVTransportURIMetaData,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
        });
      AddAction(setNextAVTransportURIAction);

      DvAction setPlayModeAction = new DvAction("SetPlayMode", OnSetPlayMode,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
          new DvArgument("NewPlayMode",
            CurrentPlayMode,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
        });
      AddAction(setPlayModeAction);

      DvAction stopction = new DvAction("Stop", OnStop,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
        });
      AddAction(stopction);

      #endregion Actions
    }
Пример #14
0
    public SlimTvServiceImpl()
      : base(Consts.SLIMTV_SERVICE_TYPE, Consts.SLIMTV_SERVICE_TYPE_VERSION, Consts.SLIMTV_SERVICE_ID)
    {
      #region DvStateVariable definitions

      DvStateVariable A_ARG_TYPE_SlotIndex = new DvStateVariable("A_ARG_TYPE_SlotIndex", new DvStandardDataType(UPnPStandardDataType.Int)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_SlotIndex);

      DvStateVariable A_ARG_TYPE_ChannelId = new DvStateVariable("A_ARG_TYPE_ChannelId", new DvStandardDataType(UPnPStandardDataType.Int)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_ChannelId);

      DvStateVariable A_ARG_TYPE_ProgramId = new DvStateVariable("A_ARG_TYPE_ProgramId", new DvStandardDataType(UPnPStandardDataType.Int)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_ProgramId);

      DvStateVariable A_ARG_TYPE_ChannelGroupId = new DvStateVariable("A_ARG_TYPE_ChannelGroupId", new DvStandardDataType(UPnPStandardDataType.Int)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_ChannelGroupId);

      DvStateVariable A_ARG_TYPE_Bool = new DvStateVariable("A_ARG_TYPE_Bool", new DvStandardDataType(UPnPStandardDataType.Boolean)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_Bool);

      DvStateVariable A_ARG_TYPE_DateTime = new DvStateVariable("A_ARG_TYPE_DateTime", new DvStandardDataType(UPnPStandardDataType.DateTime)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_DateTime);

      DvStateVariable A_ARG_TYPE_MediaItem = new DvStateVariable("A_ARG_TYPE_MediaItem", new DvExtendedDataType(UPnPDtLiveTvMediaItem.Instance)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_MediaItem);

      DvStateVariable A_ARG_TYPE_ChannelGroups = new DvStateVariable("A_ARG_TYPE_ChannelGroups", new DvExtendedDataType(UPnPDtChannelGroupList.Instance)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_ChannelGroups);

      DvStateVariable A_ARG_TYPE_Channels = new DvStateVariable("A_ARG_TYPE_Channels", new DvExtendedDataType(UPnPDtChannelList.Instance)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_Channels);

      DvStateVariable A_ARG_TYPE_Program = new DvStateVariable("A_ARG_TYPE_Program", new DvExtendedDataType(UPnPDtProgram.Instance)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_Program);

      DvStateVariable A_ARG_TYPE_Programs = new DvStateVariable("A_ARG_TYPE_Programs", new DvExtendedDataType(UPnPDtProgramList.Instance)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_Programs);

      DvStateVariable A_ARG_TYPE_Schedule = new DvStateVariable("A_ARG_TYPE_Schedule", new DvExtendedDataType(UPnPDtSchedule.Instance)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_Schedule);

      DvStateVariable A_ARG_TYPE_RecordingStatus = new DvStateVariable("A_ARG_TYPE_RecordingStatus", new DvStandardDataType(UPnPStandardDataType.String)) { SendEvents = false };
      AddStateVariable(A_ARG_TYPE_RecordingStatus);

      #endregion

      #region Init / Deinit

      DvAction deInit = new DvAction(Consts.ACTION_DEINIT, OnDeInit,
                             new DvArgument[] { },
                             new DvArgument[] { new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true) });

      AddAction(deInit);

      #endregion

      #region ITimeshiftControl actions

      DvAction startTimeshift = new DvAction(Consts.ACTION_START_TIMESHIFT, OnStartTimeshift,
                                   new[]
                                     {
                                       new DvArgument("SlotIndex", A_ARG_TYPE_SlotIndex, ArgumentDirection.In),
                                       new DvArgument("ChannelId", A_ARG_TYPE_ChannelId, ArgumentDirection.In),
                                     },
                                   new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
                                       new DvArgument("TimeshiftMediaItem", A_ARG_TYPE_MediaItem, ArgumentDirection.Out, false)
                                     });
      AddAction(startTimeshift);

      DvAction stopTimeshift = new DvAction(Consts.ACTION_STOP_TIMESHIFT, OnStopTimeshift,
                                   new[]
                                     {
                                       new DvArgument("SlotIndex", A_ARG_TYPE_SlotIndex, ArgumentDirection.In)
                                     },
                                   new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
                                     });
      AddAction(stopTimeshift);

      #endregion

      #region IChannelAndGroupInfo actions

      DvAction getChannelGroups = new DvAction(Consts.ACTION_GET_CHANNELGROUPS, OnGetChannelGroups,
                                   new DvArgument[0],
                                   new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
                                       new DvArgument("ChannelGroups", A_ARG_TYPE_ChannelGroups, ArgumentDirection.Out, false)
                                     });
      AddAction(getChannelGroups);

      DvAction getChannels = new DvAction(Consts.ACTION_GET_CHANNELS, OnGetChannels,
                                   new[]
                                     {
                                       new DvArgument("ChannelGroupId", A_ARG_TYPE_ChannelGroupId, ArgumentDirection.In)
                                     },
                                   new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
                                       new DvArgument("Channels", A_ARG_TYPE_Channels, ArgumentDirection.Out, false)
                                     });
      AddAction(getChannels);

      #endregion

      #region IProgramInfo members

      DvAction getPrograms = new DvAction(Consts.ACTION_GET_PROGRAMS, OnGetPrograms,
                             new[]
                                     {
                                       new DvArgument("ChannelId", A_ARG_TYPE_ChannelId, ArgumentDirection.In),
                                       new DvArgument("TimeFrom", A_ARG_TYPE_DateTime, ArgumentDirection.In),
                                       new DvArgument("TimeTo", A_ARG_TYPE_DateTime, ArgumentDirection.In)
                                     },
                             new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
                                       new DvArgument("Programs", A_ARG_TYPE_Programs, ArgumentDirection.Out, false)
                                     });
      AddAction(getPrograms);

      DvAction getProgramsGroup = new DvAction(Consts.ACTION_GET_PROGRAMS_GROUP, OnGetProgramsGroup,
                             new[]
                                     {
                                       new DvArgument("ChannelGroupId", A_ARG_TYPE_ChannelGroupId, ArgumentDirection.In),
                                       new DvArgument("TimeFrom", A_ARG_TYPE_DateTime, ArgumentDirection.In),
                                       new DvArgument("TimeTo", A_ARG_TYPE_DateTime, ArgumentDirection.In)
                                     },
                             new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
                                       new DvArgument("Programs", A_ARG_TYPE_Programs, ArgumentDirection.Out, false)
                                     });
      AddAction(getProgramsGroup);

      DvAction getNowNextProgram = new DvAction(Consts.ACTION_GET_NOW_NEXT_PROGRAM, OnGetNowNextProgram,
                             new[]
                                     {
                                       new DvArgument("ChannelId", A_ARG_TYPE_ChannelId, ArgumentDirection.In)
                                     },
                             new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
                                       new DvArgument("ProgramNow", A_ARG_TYPE_Program, ArgumentDirection.Out, false),
                                       new DvArgument("ProgramNext", A_ARG_TYPE_Program, ArgumentDirection.Out, false)
                                     });
      AddAction(getNowNextProgram);

      #endregion

      #region IScheduleControl members

      DvAction createSchedule = new DvAction(Consts.ACTION_CREATE_SCHEDULE, OnCreateSchedule,
                            new[]
                                     {
                                       new DvArgument("ProgramId", A_ARG_TYPE_ProgramId, ArgumentDirection.In),
                                     },
                            new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
                                       new DvArgument("Schedule", A_ARG_TYPE_Schedule, ArgumentDirection.Out, true)
                                     });
      AddAction(createSchedule);

      DvAction createScheduleByTime = new DvAction(Consts.ACTION_CREATE_SCHEDULE_BY_TIME, OnCreateScheduleByTime,
                            new[]
                                     {
                                       new DvArgument("ChannelId", A_ARG_TYPE_ChannelId, ArgumentDirection.In),
                                       new DvArgument("TimeFrom", A_ARG_TYPE_DateTime, ArgumentDirection.In),
                                       new DvArgument("TimeTo", A_ARG_TYPE_DateTime, ArgumentDirection.In)
                                     },
                            new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
                                       new DvArgument("Schedule", A_ARG_TYPE_Schedule, ArgumentDirection.Out, true)
                                     });
      AddAction(createScheduleByTime);

      DvAction removeSchedule = new DvAction(Consts.ACTION_REMOVE_SCHEDULE, OnRemoveSchedule,
                            new[]
                                     {
                                       new DvArgument("ProgramId", A_ARG_TYPE_ProgramId, ArgumentDirection.In),
                                     },
                            new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
                                     });
      AddAction(removeSchedule);

      DvAction getRecordingStatus = new DvAction(Consts.ACTION_GET_REC_STATUS, OnGetRecordingStatus,
                            new[]
                                     {
                                       new DvArgument("ProgramId", A_ARG_TYPE_ProgramId, ArgumentDirection.In),
                                     },
                            new[]
                                     {
                                       new DvArgument("Result", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
                                       new DvArgument("RecordingStatus", A_ARG_TYPE_RecordingStatus, ArgumentDirection.Out, true)
                                     });
      AddAction(getRecordingStatus);

      #endregion
    }
    public UPnPServerControllerServiceImpl() : base(
        UPnPTypesAndIds.SERVER_CONTROLLER_SERVICE_TYPE, UPnPTypesAndIds.SERVER_CONTROLLER_SERVICE_TYPE_VERSION,
        UPnPTypesAndIds.SERVER_CONTROLLER_SERVICE_ID)
    {
      // Used for system ID strings
      DvStateVariable A_ARG_TYPE_SystemId = new DvStateVariable("A_ARG_TYPE_SystemId", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_SystemId);

      // Used for bool values
      DvStateVariable A_ARG_TYPE_Bool = new DvStateVariable("A_ARG_TYPE_Bool", new DvStandardDataType(UPnPStandardDataType.Boolean))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Bool);

      // Used to transport a system name - contains the hostname string
      DvStateVariable A_ARG_TYPE_SystemName = new DvStateVariable("A_ARG_TYPE_SystemName", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_SystemName);

      // Used to transport an enumeration of MPClientMetadata objects
      DvStateVariable A_ARG_TYPE_ClientMetadataEnumeration = new DvStateVariable("A_ARG_TYPE_ClientMetadataEnumeration", new DvExtendedDataType(UPnPExtendedDataTypes.DtMPClientMetadataEnumeration))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_ClientMetadataEnumeration);

      // CSV of GUID strings
      DvStateVariable A_ARG_TYPE_UuidEnumeration = new DvStateVariable("A_ARG_TYPE_UuidEnumeration", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_UuidEnumeration);

      // CSV of system id strings
      DvStateVariable A_ARG_TYPE_SystemIdEnumeration = new DvStateVariable("A_ARG_TYPE_SystemIdEnumeration", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_SystemIdEnumeration);

      // Used to transport the import modes "Import" and "Refresh" for the ImportLocation action
      DvStateVariable A_ARG_TYPE_ImportMode = new DvStateVariable("A_ARG_TYPE_ImportMode", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_ImportMode);

      AttachedClientsChangeCounter = new DvStateVariable("AttachedClientsChangeCounter", new DvStandardDataType(UPnPStandardDataType.Ui4))
        {
            SendEvents = true,
            Value = (uint) 0
        };
      AddStateVariable(AttachedClientsChangeCounter);

      // Csv of client's system ids
      ConnectedClientsChangeCounter = new DvStateVariable("ConnectedClientsChangeCounter", new DvStandardDataType(UPnPStandardDataType.Ui4))
        {
            SendEvents = true,
            Value = (uint) 0
        };
      AddStateVariable(ConnectedClientsChangeCounter);

      // More state variables go here

      DvAction attachClientAction = new DvAction("AttachClient", OnAttachClient,
          new DvArgument[] {
            new DvArgument("ClientSystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(attachClientAction);

      DvAction detachClientAction = new DvAction("DetachClient", OnDetachClient,
          new DvArgument[] {
            new DvArgument("ClientSystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(detachClientAction);

      DvAction getAttachedClientsAction = new DvAction("GetAttachedClients", OnGetAttachedClients,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("AttachedClients", A_ARG_TYPE_ClientMetadataEnumeration, ArgumentDirection.Out, true),
          });
      AddAction(getAttachedClientsAction);

      DvAction getConnectedClientsAction = new DvAction("GetConnectedClients", OnGetConnectedClients,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("ConnectedClients", A_ARG_TYPE_SystemIdEnumeration, ArgumentDirection.Out, true),
          });
      AddAction(getConnectedClientsAction);

      DvAction scheduleImportsAction = new DvAction("ScheduleImports", OnScheduleImports,
          new DvArgument[] {
            new DvArgument("ShareIds", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In, true),
            new DvArgument("ImportMode", A_ARG_TYPE_ImportMode, ArgumentDirection.In, true),
          },
          new DvArgument[] {
          });
      AddAction(scheduleImportsAction);

      DvAction getSystemNameForSytemIdAction = new DvAction("GetSystemNameForSystemId", OnGetSystemNameForSytemId,
          new DvArgument[] {
            new DvArgument("SystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("SystemName", A_ARG_TYPE_SystemName, ArgumentDirection.Out),
          });
      AddAction(getSystemNameForSytemIdAction);

      // More actions go here

      _messageQueue = new AsynchronousMessageQueue(this, new string[]
        {
            ClientManagerMessaging.CHANNEL,
        });
      _messageQueue.MessageReceived += OnMessageReceived;
      _messageQueue.Start();
    }
    public UPnPContentDirectoryServiceImpl() : base(
        UPnPTypesAndIds.CONTENT_DIRECTORY_SERVICE_TYPE, UPnPTypesAndIds.CONTENT_DIRECTORY_SERVICE_TYPE_VERSION,
        UPnPTypesAndIds.CONTENT_DIRECTORY_SERVICE_ID)
    {
      #region Device State Variables
      // Generic Types

      // Used for a boolean value
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_Bool = new DvStateVariable("A_ARG_TYPE_Bool", new DvStandardDataType(UPnPStandardDataType.Boolean))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Bool);

      // Used for any single GUID value
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_Uuid = new DvStateVariable("A_ARG_TYPE_Id", new DvStandardDataType(UPnPStandardDataType.Uuid))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Uuid);

      // CSV of GUID strings
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_UuidEnumeration = new DvStateVariable("A_ARG_TYPE_UuidEnumeration", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_UuidEnumeration);

      // Used for a system ID string
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_SystemId = new DvStateVariable("A_ARG_TYPE_SystemId", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_SystemId);

      // UPnP 1.0 State variables

      // (Optional) TransferIDs                 string (CSV ui4),             2.5.2
      //  Evented = true (Not Moderated)

      // Used for several parameters
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable A_ARG_TYPE_ObjectId = new DvStateVariable("A_ARG_TYPE_ObjectId", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false
      };
      AddStateVariable(A_ARG_TYPE_ObjectId);

      // Used for several return values
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable A_ARG_TYPE_Result = new DvStateVariable("A_ARG_TYPE_Result", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false
      };
      AddStateVariable(A_ARG_TYPE_Result);

      // (Optional) A_ARG_TYPE_SearchCriteria   string,                       2.5.5
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable A_ARG_TYPE_SearchCriteria = new DvStateVariable("A_ARG_TYPE_SearchCriteria", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false
      };
      AddStateVariable(A_ARG_TYPE_SearchCriteria);

      // Used for several parameters
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable A_ARG_TYPE_BrowseFlag = new DvStateVariable("A_ARG_TYPE_BrowseFlag", new DvStandardDataType(UPnPStandardDataType.String))
      {
        AllowedValueList = new string[] { "BrowseMetadata", "BrowseDirectChildren" },
        SendEvents = false
      };
      AddStateVariable(A_ARG_TYPE_BrowseFlag);

      // Used for several parameters
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable A_ARG_TYPE_Filter = new DvStateVariable("A_ARG_TYPE_Filter", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false
      };
      AddStateVariable(A_ARG_TYPE_Filter);

      // Used for several parameters
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable A_ARG_TYPE_SortCriteria = new DvStateVariable("A_ARG_TYPE_SortCriteria", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false
      };
      AddStateVariable(A_ARG_TYPE_SortCriteria);

      // Used for several parameters
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable A_ARG_TYPE_Index = new DvStateVariable("A_ARG_TYPE_Index", new DvStandardDataType(UPnPStandardDataType.Ui4))
      {
        SendEvents = false
      }; // Is int sufficent here?
      AddStateVariable(A_ARG_TYPE_Index);

      // Used for several parameters and result values
      // Warning: UPnPStandardDataType.Int used before, changed to follow UPnP standard.
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable A_ARG_TYPE_Count = new DvStateVariable("A_ARG_TYPE_Count", new DvStandardDataType(UPnPStandardDataType.Ui4))
      {
        SendEvents = false
      }; // Is int sufficient here?
      AddStateVariable(A_ARG_TYPE_Count);

      // Used to indicate a change has occured
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable A_ARG_TYPE_UpdateID = new DvStateVariable("A_ARG_TYPE_UpdateID", new DvStandardDataType(UPnPStandardDataType.Ui4));
      AddStateVariable(A_ARG_TYPE_UpdateID);

      // (Optional) A_ARG_TYPE_TransferId,      ui4,                          2.5.12
      // (Optional) A_ARG_TYPE_TransferStatus   string,                       2.5.13
      // (Optional) A_ARG_TYPE_TransferLength   string,                       2.5.14
      // (Optional) A_ARG_TYPE_TransferTotal    string                        2.5.15
      // (Optional) A_ARG_TYPE_TagValueList     string (CSV string),          2.5.16

      // (Optional)
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable A_ARG_TYPE_URI = new DvStateVariable("A_ARG_TYPE_URI", new DvStandardDataType(UPnPStandardDataType.Uri))
      {
        SendEvents = false
      };
      AddStateVariable(A_ARG_TYPE_URI);

      // TODO: Define
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable SearchCapabilities = new DvStateVariable("SearchCapabilities", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false
      };
      AddStateVariable(SearchCapabilities);

      // TODO: Define
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable SortCapabilities = new DvStateVariable("SortCapabilities", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false
      };
      AddStateVariable(SortCapabilities);

      // TODO: Define
      // Evented, Moderated Event, Max Event Rate = 2
      // ReSharper disable once InconsistentNaming - Following UPnP 1.0 standards variable naming convention.
      DvStateVariable SystemUpdateID = new DvStateVariable("SystemUpdateID", new DvStandardDataType(UPnPStandardDataType.Ui4))
      {
        SendEvents = true,
        ModeratedMaximumRate = TimeSpan.FromSeconds(2)
      };
      AddStateVariable(SystemUpdateID);

      // (Optional) ContainerUpdateIDs          string (CSV {string, ui4}),   2.5.21
      // Evented, Moderated Event, Max Event Rate = 2


      // MPnP 1.0 State variables

      // Used to transport a resource path expression
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_ResourcePath = new DvStateVariable("A_ARG_TYPE_ResourcePath", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_ResourcePath);

      // Used to transport an enumeration of directories data
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_ResourcePaths = new DvStateVariable("A_ARG_TYPE_ResourcePaths", new DvExtendedDataType(UPnPExtendedDataTypes.DtResourcePathMetadataEnumeration))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_ResourcePaths);

      // Used to hold names for several objects
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_Name = new DvStateVariable("A_ARG_TYPE_Name", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Name);

      // CSV of media category strings
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_MediaCategoryEnumeration = new DvStateVariable("A_ARG_TYPE_MediaCategoryEnumeration", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_MediaCategoryEnumeration);

      // Used to transport the data of a share structure
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_Share = new DvStateVariable("A_ARG_TYPE_Share", new DvExtendedDataType(UPnPExtendedDataTypes.DtShare))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Share);

      // Used to transport an enumeration of shares data
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_ShareEnumeration = new DvStateVariable("A_ARG_TYPE_ShareEnumeration", new DvExtendedDataType(UPnPExtendedDataTypes.DtShareEnumeration))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_ShareEnumeration);

      // Used to transport a media item aspect metadata structure
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_MediaItemAspectMetadata = new DvStateVariable("A_ARG_TYPE_MediaItemAspectMetadata", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemAspectMetadata))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_MediaItemAspectMetadata);

      // Used to give a mode of relocating media items after a share edit.
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_MediaItemRelocationMode = new DvStateVariable("A_ARG_TYPE_MediaItemRelocationMode", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false,
            AllowedValueList = new List<string> {"Relocate", "ClearAndReImport"}
          };
      AddStateVariable(A_ARG_TYPE_MediaItemRelocationMode);

      // Used to transport an argument of type MediaItemQuery
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_MediaItemQuery = new DvStateVariable("A_ARG_TYPE_MediaItemQuery", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemQuery))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItemQuery);

      // Used to transport a value indicating if only online objects are referred or all.
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_OnlineState = new DvStateVariable("A_ARG_TYPE_OnlineState", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
            AllowedValueList = new List<string> {"All", "OnlyOnline"}
        };
      AddStateVariable(A_ARG_TYPE_OnlineState);

      // Used to transport a value indicating if query has to be done case sensitive or not.
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_CapitalizationMode = new DvStateVariable("A_ARG_TYPE_CapitalizationMode", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        AllowedValueList = new List<string> { "CaseSensitive", "CaseInsensitive" }
      };
      AddStateVariable(A_ARG_TYPE_CapitalizationMode);

      // Used to transport a single media item with some media item aspects
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_MediaItem = new DvStateVariable("A_ARG_TYPE_MediaItem", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItem))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItem);

      // Used to transport a collection of media items with some media item aspects
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_MediaItems = new DvStateVariable("A_ARG_TYPE_MediaItems", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemEnumeration))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItems);

      // Used to transport a single media item filter
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_MediaItemFilter = new DvStateVariable("A_ARG_TYPE_MediaItemFilter", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemsFilter))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItemFilter);

      // Used to transport a collection of media item attribute values
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_MediaItemAttributeValues = new DvStateVariable("A_ARG_TYPE_MediaItemAttributeValues", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemAttributeValues))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItemAttributeValues);

      // Used to transport an enumeration of media item aspects for a media item specified elsewhere
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_MediaItemAspects = new DvStateVariable("A_ARG_TYPE_MediaItemAspects", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemAspectEnumeration))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItemAspects);

      // Used to transport the text to be used in a simple text search
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_SearchText = new DvStateVariable("A_ARG_TYPE_SearchText", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_SearchText);

      // Used to transport a value indicating if only online objects are referred or all.
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_TextSearchMode = new DvStateVariable("A_ARG_TYPE_TextSearchMode", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
            AllowedValueList = new List<string> {"Normal", "ExcludeCLOBs"}
        };
      AddStateVariable(A_ARG_TYPE_TextSearchMode);

      // Used to transport an enumeration of value group instances
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_MLQueryResultGroupEnumeration = new DvStateVariable("A_ARG_TYPE_MLQueryResultGroupEnumeration", new DvExtendedDataType(UPnPExtendedDataTypes.DtMLQueryResultGroupEnumeration))
          {
            SendEvents = false,
          };
      AddStateVariable(A_ARG_TYPE_MLQueryResultGroupEnumeration);

      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_ProjectionFunction = new DvStateVariable("A_ARG_TYPE_ProjectionFunction", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
            AllowedValueList = new List<string> {"None", "DateToYear"}
        };
      AddStateVariable(A_ARG_TYPE_ProjectionFunction);

      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_GroupingFunction = new DvStateVariable("A_ARG_TYPE_GroupingFunction", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
            AllowedValueList = new List<string> {"FirstCharacter"}
        };
      AddStateVariable(A_ARG_TYPE_GroupingFunction);

      // Used to transport the data of a PlaylistContents instance
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_PlaylistContents = new DvStateVariable("A_ARG_TYPE_PlaylistContents", new DvExtendedDataType(UPnPExtendedDataTypes.DtPlaylistContents))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_PlaylistContents);

      // Used to transport the data of a PlaylistRawData instance
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_PlaylistRawData = new DvStateVariable("A_ARG_TYPE_PlaylistRawData", new DvExtendedDataType(UPnPExtendedDataTypes.DtPlaylistRawData))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_PlaylistRawData);

      // Used to transport an enumeration of playlist identification data (id, name) instances
      // ReSharper disable once InconsistentNaming - Following UPnP standards variable naming convention.
      DvStateVariable A_ARG_TYPE_PlaylistIdentificationDataEnumeration = new DvStateVariable("A_ARG_TYPE_PlaylistIdentificationDataEnumeration", new DvExtendedDataType(UPnPExtendedDataTypes.DtPlaylistInformationDataEnumeration))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_PlaylistIdentificationDataEnumeration);

      // Used to transport an IDictionary<Guid, DateTime> such as the MediaItemAspectCreationDates
      DvStateVariable A_ARG_TYPE_DictionaryGuidDateTime = new DvStateVariable("A_ARG_TYPE_DictionaryGuidDateTime", new DvExtendedDataType(UPnPExtendedDataTypes.DtDictionaryGuidDateTime))
      {
        SendEvents = false
      };
      AddStateVariable(A_ARG_TYPE_DictionaryGuidDateTime);

      // Change event for playlists
      PlaylistsChangeCounter = new DvStateVariable("PlaylistsChangeCounter", new DvStandardDataType(UPnPStandardDataType.Ui4))
        {
            SendEvents = true,
            Value = (uint) 0
        };
      AddStateVariable(PlaylistsChangeCounter);

      // Change event for MIA type registrations
      MIATypeRegistrationsChangeCounter = new DvStateVariable("MIATypeRegistrationsChangeCounter", new DvStandardDataType(UPnPStandardDataType.Ui4))
        {
            SendEvents = true,
            Value = (uint) 0
        };
      AddStateVariable(MIATypeRegistrationsChangeCounter);

      // Change event for registered shares
      RegisteredSharesChangeCounter = new DvStateVariable("RegisteredSharesChangeCounter", new DvStandardDataType(UPnPStandardDataType.Ui4))
        {
            SendEvents = true,
            Value = (uint) 0
        };
      AddStateVariable(RegisteredSharesChangeCounter);

      // Change event for currently importing shares
      CurrentlyImportingSharesChangeCounter = new DvStateVariable("CurrentlyImportingSharesChangeCounter", new DvStandardDataType(UPnPStandardDataType.Ui4))
        {
            SendEvents = true,
            Value = (uint) 0
        };
      AddStateVariable(CurrentlyImportingSharesChangeCounter);

      // More state variables go here

      #endregion

      #region Device Actions

      #region UPnP 1.0 Device Actions

      // UPnP 1.0 - 2.7.1 GetSearchCapabilities - Required
      DvAction getSearchCapabiltiesAction = new DvAction("GetSearchCapabilities", OnGetSearchCapabilities,
        new DvArgument[] {
        },
          new DvArgument[] {
            new DvArgument("SearchCaps", SearchCapabilities, ArgumentDirection.Out, true), 
          });
      AddAction(getSearchCapabiltiesAction);

      // UPnP 1.0 - 2.7.2 GetSortCapabilities - Required
      DvAction getSortCapabilitiesAction = new DvAction("GetSortCapabilities", OnGetSortCapabilities,
        new DvArgument[] {
        },
        new DvArgument[] {
          new DvArgument("SortCapabilities", SortCapabilities, ArgumentDirection.Out, true)
        });
      AddAction(getSortCapabilitiesAction);

      // UPnP 1.0 - 2.7.3 GetSystemUpdateId - Required
      DvAction getSystemUpdateIDAction = new DvAction("GetSystemUpdateID", OnGetSystemUpdateID,
        new DvArgument[]
        {
          
        },
        new DvArgument[]
        {
          new DvArgument("Id", SystemUpdateID, ArgumentDirection.Out), 
        });
      AddAction(getSystemUpdateIDAction);

      // UPnP 1.0 - 2.7.4 Browse - Required
      DvAction browseAction = new DvAction("Browse", OnBrowse,
          new DvArgument[] {
            new DvArgument("ObjectId", A_ARG_TYPE_Uuid, ArgumentDirection.In),               // ParentDirectory
            new DvArgument("BrowseFlag", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),  // NecessaryMIATypes
            new DvArgument("Filter", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),      // OptionalMIATypes
            new DvArgument("StartingIndex", A_ARG_TYPE_Index, ArgumentDirection.In), 
            new DvArgument("RequestedCount", A_ARG_TYPE_Count, ArgumentDirection.In), 
            new DvArgument("SortCriteria", A_ARG_TYPE_SortCriteria, ArgumentDirection.In), 
          },
          new DvArgument[] {
            new DvArgument("Result", A_ARG_TYPE_Result, ArgumentDirection.Out, true),
            new DvArgument("NumberReturned", A_ARG_TYPE_Count, ArgumentDirection.Out, true),
            new DvArgument("TotalMatches", A_ARG_TYPE_Count, ArgumentDirection.Out, true),
            new DvArgument("UpdateID", A_ARG_TYPE_UpdateID, ArgumentDirection.Out, true), 
          });
      AddAction(browseAction);

      // UPnP 1.0 - 2.7.5 Search - Optional
      DvAction searchAction = new DvAction("Search", OnSearch,
          new DvArgument[] {
            new DvArgument("ContainerID", A_ARG_TYPE_ObjectId, ArgumentDirection.In),
            new DvArgument("SearchCriteria", A_ARG_TYPE_SearchCriteria, ArgumentDirection.In),
            new DvArgument("StartingIndex", A_ARG_TYPE_Index, ArgumentDirection.In), 
            new DvArgument("RequestedCount", A_ARG_TYPE_Count, ArgumentDirection.In), 
            new DvArgument("SortCriteria", A_ARG_TYPE_SortCriteria, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("Result", A_ARG_TYPE_Result, ArgumentDirection.Out, true),
            new DvArgument("NumberReturned", A_ARG_TYPE_Count, ArgumentDirection.Out, true),
            new DvArgument("TotalMatches", A_ARG_TYPE_Count, ArgumentDirection.Out, true),
            new DvArgument("UpdateID", A_ARG_TYPE_UpdateID, ArgumentDirection.Out, true), 
          });
      AddAction(searchAction);

      // UPnP 1.0 - 2.7.6 CreateObject - Optional
      // UPnP 1.0 - 2.7.7 DestoryObject - Optional
      // UPnP 1.0 - 2.7.8 UpdateObject - Optional
      // UPnP 1.0 - 2.7.9 ImportResource - Optional
      // UPnP 1.0 - 2.7.10 ExportResource - Optional
      // UPnP 1.0 - 2.7.11 StopTransferResource - Optional
      // UPnP 1.0 - 2.7.12 GetTransferProgress - Optional
      // UPnP 1.0 - 2.7.13 DeleteResource - Optional
      // UPnP 1.0 - 2.7.14 CreateReference - Optional

      #endregion

      // UPnP 1.0 - 2.7.15 Non-Stanard Actions Implementations

      #region MPnP 1.0 Device Actions

      // Shares management
      DvAction mpnp10RegisterShareAction = new DvAction("X_MediaPortal_RegisterShare", OnMPnP10RegisterShare,
          new DvArgument[] {
            new DvArgument("Share", A_ARG_TYPE_Share, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(mpnp10RegisterShareAction);

      DvAction mpnp10RemoveShareAction = new DvAction("X_MediaPortal_RemoveShare", OnMPnP10RemoveShare,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In)
          },
          new DvArgument[] {
          });
      AddAction(mpnp10RemoveShareAction);

      DvAction mpnp10UpdateShareAction = new DvAction("X_MediaPortal_UpdateShare", OnMPnP10UpdateShare,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("BaseResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
            new DvArgument("ShareName", A_ARG_TYPE_Name, ArgumentDirection.In),
            new DvArgument("MediaCategories", A_ARG_TYPE_MediaCategoryEnumeration, ArgumentDirection.In),
            new DvArgument("RelocateMediaItems", A_ARG_TYPE_MediaItemRelocationMode, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("NumAffectedMediaItems", A_ARG_TYPE_Count, ArgumentDirection.Out, true)
          });
      AddAction(mpnp10UpdateShareAction);

      DvAction mpnp10GetSharesAction = new DvAction("X_MediaPortal_GetShares", OnMPnP10GetShares,
          new DvArgument[] {
            new DvArgument("SystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
            new DvArgument("SharesFilter", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("Shares", A_ARG_TYPE_ShareEnumeration, ArgumentDirection.Out, true)
          });
      AddAction(mpnp10GetSharesAction);

      DvAction mpnp10GetShareAction = new DvAction("X_MediaPortal_GetShare", OnMPnP10GetShare,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("Share", A_ARG_TYPE_Share, ArgumentDirection.Out, true)
          });
      AddAction(mpnp10GetShareAction);

      DvAction mpnp10ReImportShareAction = new DvAction("X_MediaPortal_ReImportShare", OnMPnP10ReImportShare,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(mpnp10ReImportShareAction);

      DvAction mpnp10SetupDefaultServerSharesAction = new DvAction("X_MediaPortal_SetupDefaultServerShares", OnMPnP10SetupDefaultServerShares,
          new DvArgument[] {
          },
          new DvArgument[] {
          });
      AddAction(mpnp10SetupDefaultServerSharesAction);

      // Media item aspect storage management

      DvAction mpnp10AddMediaItemAspectStorageAction = new DvAction("X_MediaPortal_AddMediaItemAspectStorage", OnMPnP10AddMediaItemAspectStorage,
          new DvArgument[] {
            new DvArgument("MIAM", A_ARG_TYPE_MediaItemAspectMetadata, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(mpnp10AddMediaItemAspectStorageAction);

      DvAction mpnp10RemoveMediaItemAspectStorageAction = new DvAction("X_MediaPortal_RemoveMediaItemAspectStorage", OnMPnP10RemoveMediaItemAspectStorage,
          new DvArgument[] {
            new DvArgument("MIAM_Id", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(mpnp10RemoveMediaItemAspectStorageAction);

      DvAction mpnp10GetAllManagedMediaItemAspectTypesAction = new DvAction("X_MediaPortal_GetAllManagedMediaItemAspectTypes", OnMPnP10GetAllManagedMediaItemAspectTypes,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("MIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.Out, true),
          });
      AddAction(mpnp10GetAllManagedMediaItemAspectTypesAction);

      DvAction mpnp10GetMediaItemAspectMetadataAction = new DvAction("X_MediaPortal_GetMediaItemAspectMetadata", OnMPnP10GetMediaItemAspectMetadata,
          new DvArgument[] {
            new DvArgument("MIAM_Id", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MIAM", A_ARG_TYPE_MediaItemAspectMetadata, ArgumentDirection.Out, true),
          });
      AddAction(mpnp10GetMediaItemAspectMetadataAction);

      DvAction mpnp10GetAllManagedMediaItemAspectCreationDatesAction = new DvAction("X_MediaPortal_GetAllManagedMediaItemAspectCreationDates", OnMPnP10GetAllManagedMediaItemAspectCreationDates,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("MIACreationDates", A_ARG_TYPE_DictionaryGuidDateTime, ArgumentDirection.Out, true),
          });
      AddAction(mpnp10GetAllManagedMediaItemAspectCreationDatesAction);

      // Media query

      DvAction mpnp10LoadItemAction = new DvAction("X_MediaPortal_LoadItem", OnMPnP10LoadItem,
          new DvArgument[] {
            new DvArgument("SystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
            new DvArgument("Path", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MediaItem", A_ARG_TYPE_MediaItem, ArgumentDirection.Out, true),
          });
      AddAction(mpnp10LoadItemAction);

      // Superseded MPnP 1.1
      //DvAction mpnp10BrowseAction = new DvAction("X_MediaPortal_Browse", OnMPnP10Browse,
      //    new DvArgument[] {
      //      new DvArgument("ParentDirectory", A_ARG_TYPE_Uuid, ArgumentDirection.In),
      //      new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
      //      new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
      //    },
      //    new DvArgument[] {
      //      new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true),
      //    });
      //AddAction(mpnp10BrowseAction);

      DvAction mpnp10SearchAction = new DvAction("X_MediaPortal_Search", OnMPnP10Search,
          new DvArgument[] {
            new DvArgument("Query", A_ARG_TYPE_MediaItemQuery, ArgumentDirection.In),
            new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true),
          });
      AddAction(mpnp10SearchAction);

      // Superseded MPnP 1.1
      //DvAction mpnp10TextSearchAction = new DvAction("X_MediaPortal_SimpleTextSearch", OnMPnP10TextSearch,
      //    new DvArgument[] {
      //      new DvArgument("SearchText", A_ARG_TYPE_SearchText, ArgumentDirection.In),
      //      new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
      //      new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
      //      new DvArgument("Filter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
      //      new DvArgument("SearchMode", A_ARG_TYPE_TextSearchMode, ArgumentDirection.In),
      //      new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
      //      new DvArgument("CapitalizationMode", A_ARG_TYPE_CapitalizationMode, ArgumentDirection.In),
      //    },
      //    new DvArgument[] {
      //      new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true),
      //    });
      //AddAction(mpnp10TextSearchAction);

      DvAction mpnp10GetValueGroupsAction = new DvAction("X_MediaPortal_GetValueGroups", OnMPnP10GetValueGroups,
          new DvArgument[] {
            new DvArgument("MIAType", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("AttributeName", A_ARG_TYPE_Name, ArgumentDirection.In),
            new DvArgument("SelectAttributeFilter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("ProjectionFunction", A_ARG_TYPE_ProjectionFunction, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("Filter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("ValueGroups", A_ARG_TYPE_MediaItemAttributeValues, ArgumentDirection.Out, true),
          });
      AddAction(mpnp10GetValueGroupsAction);

      DvAction mpnp10GroupValueGroupsAction = new DvAction("X_MediaPortal_GroupValueGroups", OnMPnP10GroupValueGroups,
          new DvArgument[] {
            new DvArgument("MIAType", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("AttributeName", A_ARG_TYPE_Name, ArgumentDirection.In),
            new DvArgument("SelectAttributeFilter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("ProjectionFunction", A_ARG_TYPE_ProjectionFunction, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("Filter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
            new DvArgument("GroupingFunction", A_ARG_TYPE_GroupingFunction, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("ResultGroups", A_ARG_TYPE_MLQueryResultGroupEnumeration, ArgumentDirection.Out, true),
          });
      AddAction(mpnp10GroupValueGroupsAction);

      DvAction mpnp10CountMediaItemsAction = new DvAction("X_MediaPortal_CountMediaItems", OnMPnP10CountMediaItems,
          new DvArgument[] {
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("Filter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("NumMediaItems", A_ARG_TYPE_Count, ArgumentDirection.Out, true),
          });
      AddAction(mpnp10CountMediaItemsAction);

      // Playlist management

      DvAction mpnp10GetPlaylistsAction = new DvAction("X_MediaPortal_GetPlaylists", OnMPnP10GetPlaylists,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("Playlists", A_ARG_TYPE_PlaylistIdentificationDataEnumeration, ArgumentDirection.Out, true),
          });
      AddAction(mpnp10GetPlaylistsAction);

      DvAction mpnp10SavePlaylistAction = new DvAction("X_MediaPortal_SavePlaylist", OnMPnP10SavePlaylist,
          new DvArgument[] {
            new DvArgument("PlaylistRawData", A_ARG_TYPE_PlaylistRawData, ArgumentDirection.In)
          },
          new DvArgument[] {
          });
      AddAction(mpnp10SavePlaylistAction);

      DvAction mpnp10DeletePlaylistAction = new DvAction("X_MediaPortal_DeletePlaylist", OnMPnP10DeletePlaylist,
          new DvArgument[] {
            new DvArgument("PlaylistId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(mpnp10DeletePlaylistAction);

      DvAction mpnp10ExportPlaylistAction = new DvAction("X_MediaPortal_ExportPlaylist", OnMPnP10ExportPlaylist,
          new DvArgument[] {
            new DvArgument("PlaylistId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("PlaylistRawData", A_ARG_TYPE_PlaylistRawData, ArgumentDirection.Out, true)
          });
      AddAction(mpnp10ExportPlaylistAction);

      // Superseded
      //DvAction mpnp10LoadCustomPlaylistAction = new DvAction("X_MediaPortal_LoadCustomPlaylist", OnMPnP10LoadCustomPlaylist,
      //    new DvArgument[] {
      //      new DvArgument("MediaItemIds", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
      //      new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
      //      new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
      //    },
      //    new DvArgument[] {
      //      new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true)
      //    });
      //AddAction(mpnp10LoadCustomPlaylistAction);

      // Media import

      DvAction mpnp10AddOrUpdateMediaItemAction = new DvAction("X_MediaPortal_AddOrUpdateMediaItem", OnMPnP10AddOrUpdateMediaItem,
          new DvArgument[] {
            new DvArgument("ParentDirectoryId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("SystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
            new DvArgument("Path", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
            new DvArgument("UpdatedMediaItemAspects", A_ARG_TYPE_MediaItemAspects, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MediaItemId", A_ARG_TYPE_Uuid, ArgumentDirection.Out, true),
          });
      AddAction(mpnp10AddOrUpdateMediaItemAction);

      DvAction mpnp10DeleteMediaItemOrPathAction = new DvAction("X_MediaPortal_DeleteMediaItemOrPath", OnMPnP10DeleteMediaItemOrPath,
          new DvArgument[] {
            new DvArgument("SystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
            new DvArgument("Path", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
            new DvArgument("Inclusive", A_ARG_TYPE_Bool, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(mpnp10DeleteMediaItemOrPathAction);

      DvAction mpnp10ClientStartedShareImportAction = new DvAction("X_MediaPortal_ClientStartedShareImport", OnMPnP10ClientStartedShareImport,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(mpnp10ClientStartedShareImportAction);

      DvAction mpnp10ClientCompletedShareImportAction = new DvAction("X_MediaPortal_ClientCompletedShareImport", OnMPnP10ClientCompletedShareImport,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(mpnp10ClientCompletedShareImportAction);

      DvAction mpnp10GetCurrentlyImportingSharesAction = new DvAction("X_MediaPortal_GetCurrentlyImportingShares", OnMPnP10GetCurrentlyImportingShares,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("ShareIds", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.Out, true), 
          });
      AddAction(mpnp10GetCurrentlyImportingSharesAction);

      // Media playback

      DvAction mpnp10NotifyPlaybackAction = new DvAction("X_MediaPortal_NotifyPlayback", OnMPnP10NotifyPlayback,
          new DvArgument[] {
            new DvArgument("MediaItemId", A_ARG_TYPE_Uuid, ArgumentDirection.In), 
          },
          new DvArgument[] {
          });
      AddAction(mpnp10NotifyPlaybackAction);
      
      #endregion

      #region MPnP 1.1 Device Actions

      DvAction mpnp11BrowseAction = new DvAction("X_MediaPortal_Browse", OnMPnP11Browse,
          new DvArgument[] {
            new DvArgument("ParentDirectory", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("Offset", A_ARG_TYPE_Index, ArgumentDirection.In), 
            new DvArgument("Limit", A_ARG_TYPE_Count, ArgumentDirection.In), 
          },
          new DvArgument[] {
            new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true),
          });
      AddAction(mpnp11BrowseAction);

      DvAction mpnp11TextSearchAction = new DvAction("X_MediaPortal_SimpleTextSearch", OnMPnP11TextSearch,
          new DvArgument[] {
            new DvArgument("SearchText", A_ARG_TYPE_SearchText, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("Filter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("SearchMode", A_ARG_TYPE_TextSearchMode, ArgumentDirection.In),
            new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
            new DvArgument("CapitalizationMode", A_ARG_TYPE_CapitalizationMode, ArgumentDirection.In),
            new DvArgument("Offset", A_ARG_TYPE_Index, ArgumentDirection.In), 
            new DvArgument("Limit", A_ARG_TYPE_Count, ArgumentDirection.In), 
          },
          new DvArgument[] {
            new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true),
          });
      AddAction(mpnp11TextSearchAction);

      DvAction mpnp11LoadCustomPlaylistAction = new DvAction("X_MediaPortal_LoadCustomPlaylist", OnMPnP11LoadCustomPlaylist,
          new DvArgument[] {
            new DvArgument("MediaItemIds", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("Offset", A_ARG_TYPE_Index, ArgumentDirection.In), 
            new DvArgument("Limit", A_ARG_TYPE_Count, ArgumentDirection.In), 
          },
          new DvArgument[] {
            new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true)
          });
      AddAction(mpnp11LoadCustomPlaylistAction);

      #endregion

      // More actions go here

      #endregion

      _messageQueue = new AsynchronousMessageQueue(this, new string[]
        {
            ContentDirectoryMessaging.CHANNEL,
            ImporterWorkerMessaging.CHANNEL,
        });
      _messageQueue.MessageReceived += OnMessageReceived;
      _messageQueue.Start();
    }
    public UPnPResourceInformationServiceImpl() : base(
        UPnPTypesAndIds.RESOURCE_INFORMATION_SERVICE_TYPE, UPnPTypesAndIds.RESOURCE_INFORMATION_SERVICE_TYPE_VERSION,
        UPnPTypesAndIds.RESOURCE_INFORMATION_SERVICE_ID)
    {
      // Used for any single GUID value
      DvStateVariable A_ARG_TYPE_Uuid = new DvStateVariable("A_ARG_TYPE_Id", new DvStandardDataType(UPnPStandardDataType.Uuid))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_Uuid);

      // Simple boolean value
      DvStateVariable A_ARG_TYPE_Bool = new DvStateVariable("A_ARG_TYPE_Bool", new DvStandardDataType(UPnPStandardDataType.Boolean))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_Bool);

      // Simple DateTime value (with time)
      DvStateVariable A_ARG_TYPE_DateTime = new DvStateVariable("A_ARG_TYPE_DateTime", new DvStandardDataType(UPnPStandardDataType.DateTime))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_DateTime);

      DvStateVariable A_ARG_TYPE_FileSize = new DvStateVariable("A_ARG_TYPE_FileSize", new DvStandardDataType(UPnPStandardDataType.I8))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_FileSize);

      // Used to transport a resource path expression
      DvStateVariable A_ARG_TYPE_ResourcePath = new DvStateVariable("A_ARG_TYPE_ResourcePath", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_ResourcePath);

      // Used to transport an enumeration of directories data
      DvStateVariable A_ARG_TYPE_ResourcePaths = new DvStateVariable("A_ARG_TYPE_ResourcePaths", new DvExtendedDataType(UPnPExtendedDataTypes.DtResourcePathMetadataEnumeration))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_ResourcePaths);

      // Used to transport a short resource path string which can be evaluated by a resource provider
      DvStateVariable A_ARG_TYPE_ResourcePathString = new DvStateVariable("A_ARG_TYPE_ResourcePathString", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_ResourcePathString);

      DvStateVariable A_ARG_TYPE_URL_String = new DvStateVariable("A_ARG_TYPE_URL_String", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_URL_String);

      // CSV of media category strings
      DvStateVariable A_ARG_TYPE_MediaCategoryEnumeration = new DvStateVariable("A_ARG_TYPE_MediaCategoryEnumeration", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaCategoryEnumeration))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_MediaCategoryEnumeration);

      // Used to transport a resource provider metadata structure
      DvStateVariable A_ARG_TYPE_ResourceProviderMetadata = new DvStateVariable("A_ARG_TYPE_ResourceProviderMetadata", new DvExtendedDataType(UPnPExtendedDataTypes.DtResourceProviderMetadata))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_ResourceProviderMetadata);

      // Used to transport an enumeration of resource provider metadata structures
      DvStateVariable A_ARG_TYPE_ResourceProviderMetadataEnumeration = new DvStateVariable("A_ARG_TYPE_ResourceProviderMetadataEnumeration", new DvExtendedDataType(UPnPExtendedDataTypes.DtResourceProviderMetadataEnumeration))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_ResourceProviderMetadataEnumeration);

      // Used to transport a display name for a resource or a resource path
      DvStateVariable A_ARG_TYPE_ResourceDisplayName = new DvStateVariable("A_ARG_TYPE_ResourceDisplayName", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_ResourceDisplayName);

      // More state variables go here

      DvAction getMediaCategoriesFromMetadataExtractorsAction = new DvAction("GetMediaCategoriesFromMetadataExtractors", OnGetMediaCategoriesFromMetadataExtractors,
          new DvArgument[] {
          },
          new DvArgument[] {
              new DvArgument("MediaCategories", A_ARG_TYPE_MediaCategoryEnumeration, ArgumentDirection.Out, true),
          });
      AddAction(getMediaCategoriesFromMetadataExtractorsAction);

      DvAction getAllBaseResourceProviderMetadataAction = new DvAction("GetAllBaseResourceProviderMetadata", OnGetAllBaseResourceProviderMetadata,
          new DvArgument[] {
          },
          new DvArgument[] {
              new DvArgument("ResourceProviderMetadata", A_ARG_TYPE_ResourceProviderMetadataEnumeration, ArgumentDirection.Out, true),
          });
      AddAction(getAllBaseResourceProviderMetadataAction);

      DvAction getResourceProviderMetadataAction = new DvAction("GetResourceProviderMetadata", OnGetResourceProviderMetadata,
          new DvArgument[] {
              new DvArgument("ResourceProviderId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
              new DvArgument("ResourceProviderMetadata", A_ARG_TYPE_ResourceProviderMetadata, ArgumentDirection.Out, true),
          });
      AddAction(getResourceProviderMetadataAction);

      DvAction getResourcePathDisplayNameAction = new DvAction("GetResourcePathDisplayName", OnGetResourcePathDisplayName,
          new DvArgument[] {
              new DvArgument("ResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
          },
          new DvArgument[] {
              new DvArgument("ResourcePathDisplayName", A_ARG_TYPE_ResourceDisplayName, ArgumentDirection.Out, true),
          });
      AddAction(getResourcePathDisplayNameAction);

      DvAction getResourceDisplayNameAction = new DvAction("GetResourceDisplayName", OnGetResourceDisplayName,
          new DvArgument[] {
              new DvArgument("ResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
          },
          new DvArgument[] {
              new DvArgument("ResourcePathDisplayName", A_ARG_TYPE_ResourceDisplayName, ArgumentDirection.Out, true),
          });
      AddAction(getResourceDisplayNameAction);

      DvAction getChildDirectoriesDataAction = new DvAction("GetChildDirectoriesData", OnGetChildDirectoriesData,
          new DvArgument[] {
              new DvArgument("ResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
          },
          new DvArgument[] {
              new DvArgument("ChildDirectoriesData", A_ARG_TYPE_ResourcePaths, ArgumentDirection.Out, true),
          });
      AddAction(getChildDirectoriesDataAction);

      DvAction getFilesDataAction = new DvAction("GetFilesData", OnGetFilesData,
          new DvArgument[] {
              new DvArgument("ResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
          },
          new DvArgument[] {
              new DvArgument("FilesData", A_ARG_TYPE_ResourcePaths, ArgumentDirection.Out, true),
          });
      AddAction(getFilesDataAction);

      DvAction doesResourceExistAction = new DvAction("DoesResourceExist", OnDoesResourceExist,
          new DvArgument[] {
              new DvArgument("ResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
          },
          new DvArgument[] {
              new DvArgument("ResourceExists", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
          });
      AddAction(doesResourceExistAction);

      DvAction getResourceInformationAction = new DvAction("GetResourceInformation", OnGetResourceInformation,
          new DvArgument[] {
              new DvArgument("ResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
          },
          new DvArgument[] {
              new DvArgument("IsFileSystemResource", A_ARG_TYPE_Bool, ArgumentDirection.Out, false),
              new DvArgument("IsFile", A_ARG_TYPE_Bool, ArgumentDirection.Out, false),
              new DvArgument("ResourcePathDisplayName", A_ARG_TYPE_ResourcePathString, ArgumentDirection.Out, false),
              new DvArgument("ResourceDisplayName", A_ARG_TYPE_ResourcePathString, ArgumentDirection.Out, false),
              new DvArgument("LastChanged", A_ARG_TYPE_DateTime, ArgumentDirection.Out, false),
              new DvArgument("Size", A_ARG_TYPE_FileSize, ArgumentDirection.Out, false),
              new DvArgument("ResourceExists", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
          });
      AddAction(getResourceInformationAction);

      DvAction doesResourceProviderSupportTreeListingAction = new DvAction("DoesResourceProviderSupportTreeListing", OnDoesResourceProviderSupportTreeListing,
          new DvArgument[] {
              new DvArgument("ResourceProviderId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
              new DvArgument("SupportsTreeListing", A_ARG_TYPE_Bool, ArgumentDirection.Out, true),
          });
      AddAction(doesResourceProviderSupportTreeListingAction);

      DvAction expandResourcePathFromStringAction = new DvAction("ExpandResourcePathFromString", OnExpandResourcePathFromString,
          new DvArgument[] {
              new DvArgument("ResourceProviderId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
              new DvArgument("ResourcePathStr", A_ARG_TYPE_ResourcePathString, ArgumentDirection.In),
          },
          new DvArgument[] {
              new DvArgument("ResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.Out, true),
          });
      AddAction(expandResourcePathFromStringAction);

      DvAction concatenatePathsAction = new DvAction("ConcatenatePaths", OnConcatenatePaths,
          new DvArgument[] {
              new DvArgument("ResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
              new DvArgument("RelativePath", A_ARG_TYPE_ResourcePathString, ArgumentDirection.In),
          },
          new DvArgument[] {
              new DvArgument("ResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.Out, true),
          });
      AddAction(concatenatePathsAction);

      DvAction getResourceServerBaseURLAction = new DvAction("GetResourceServerBaseURL", OnGetResourceServerBaseURL,
          new DvArgument[] {
          },
          new DvArgument[] {
              new DvArgument("BaseURL", A_ARG_TYPE_URL_String, ArgumentDirection.Out, true),
          });
      AddAction(getResourceServerBaseURLAction);

      // More actions go here
    }
 public UPnPConnectionManagerServiceImpl()
   : base(
     UPnPDevice.CONNECTION_MANAGER_SERVICE_TYPE,
     UPnPDevice.CONNECTION_MANAGER_SERVICE_TYPE_VERSION,
     UPnPDevice.CONNECTION_MANAGER_SERVICE_ID)
 {
   // Used for a boolean value
   DvStateVariable SourceProtocolInfo = new DvStateVariable("SourceProtocolInfo",
     new DvStandardDataType(UPnPStandardDataType.String))
   {
     SendEvents = false,
   };
   AddStateVariable(SourceProtocolInfo);
   // Used for a boolean value
   DvStateVariable SinkProtocolInfo = new DvStateVariable("SinkProtocolInfo",
     new DvStandardDataType(UPnPStandardDataType.String))
   {
     SendEvents = false,
   };
   AddStateVariable(SinkProtocolInfo);
   // Used for a boolean value
   DvStateVariable CurrentConnectionIDs = new DvStateVariable("CurrentConnectionIDs",
     new DvStandardDataType(UPnPStandardDataType.String))
   {
     SendEvents = true,
     Value = "0" // we only support one connection => connectionID is always 0
   };
   AddStateVariable(CurrentConnectionIDs);
   // Used for a boolean value
   DvStateVariable A_ARG_TYPE_ConnectionStatus = new DvStateVariable("A_ARG_TYPE_ConnectionStatus",
     new DvStandardDataType(UPnPStandardDataType.String))
   {
     SendEvents = false,
     AllowedValueList =
       new List<string>
       {
         "OK",
         "ContentFormatMismatch",
         "InsufficientBandwidth",
         "UnreliableChannel",
         "Unknown"
       }
   };
   AddStateVariable(A_ARG_TYPE_ConnectionStatus);
   // Used for a boolean value
   DvStateVariable A_ARG_TYPE_ConnectionManager = new DvStateVariable("A_ARG_TYPE_ConnectionManager",
     new DvStandardDataType(UPnPStandardDataType.String))
   {
     SendEvents = false,
   };
   AddStateVariable(A_ARG_TYPE_ConnectionManager);
   // Used for a boolean value
   DvStateVariable A_ARG_TYPE_Direction = new DvStateVariable("A_ARG_TYPE_Direction",
     new DvStandardDataType(UPnPStandardDataType.String))
   {
     SendEvents = false,
     AllowedValueList = new List<string> { "Output", "Input" }
   };
   AddStateVariable(A_ARG_TYPE_Direction);
   // Used for a boolean value
   DvStateVariable A_ARG_TYPE_ProtocolInfo = new DvStateVariable("A_ARG_TYPE_ProtocolInfo",
     new DvStandardDataType(UPnPStandardDataType.String))
   {
     SendEvents = false,
   };
   AddStateVariable(A_ARG_TYPE_ProtocolInfo);
   // Used for a boolean value
   DvStateVariable A_ARG_TYPE_ConnectionID = new DvStateVariable("A_ARG_TYPE_ConnectionID",
     new DvStandardDataType(
       UPnPStandardDataType.I4))
   {
     SendEvents = false,
   };
   AddStateVariable(A_ARG_TYPE_ConnectionID);
   // Used for a boolean value
   DvStateVariable A_ARG_TYPE_AVTransportID = new DvStateVariable("A_ARG_TYPE_AVTransportID",
     new DvStandardDataType(UPnPStandardDataType.I4))
   {
     SendEvents = false,
   };
   AddStateVariable(A_ARG_TYPE_AVTransportID);
   // Used for a boolean value
   DvStateVariable A_ARG_TYPE_RcsID = new DvStateVariable("A_ARG_TYPE_RcsID",
     new DvStandardDataType(UPnPStandardDataType.I4))
   {
     SendEvents = false,
   };
   AddStateVariable(A_ARG_TYPE_RcsID);
   DvAction getProtocolInfoAction = new DvAction("GetProtocolInfo", OnGetProtocolInfo,
     new DvArgument[]
     {
     },
     new DvArgument[]
     {
       new DvArgument("Source",
         SourceProtocolInfo,
         ArgumentDirection.Out),
       new DvArgument("Sink",
         SinkProtocolInfo,
         ArgumentDirection.Out),
     });
   AddAction(getProtocolInfoAction);
   DvAction getCurrentConnectionIDsAction = new DvAction("GetCurrentConnectionIDs", OnGetCurrentConnectionIDs,
     new DvArgument[]
     {
     },
     new DvArgument[]
     {
       new DvArgument("ConnectionIDs",
         CurrentConnectionIDs,
         ArgumentDirection.Out),
     });
   AddAction(getCurrentConnectionIDsAction);
   DvAction getCurrentConnectionInfoAction = new DvAction("GetCurrentConnectionInfo", OnGetCurrentConnectionInfo,
     new DvArgument[]
     {
       new DvArgument("ConnectionID",
         A_ARG_TYPE_ConnectionID,
         ArgumentDirection.In),
     },
     new DvArgument[]
     {
       new DvArgument("RcsID",
         A_ARG_TYPE_RcsID,
         ArgumentDirection.Out),
       new DvArgument("AVTransportID",
         A_ARG_TYPE_AVTransportID,
         ArgumentDirection.Out),
       new DvArgument("ProtocolInfo",
         A_ARG_TYPE_ProtocolInfo,
         ArgumentDirection.Out),
       new DvArgument("PeerConnectionManager",
         A_ARG_TYPE_ConnectionManager,
         ArgumentDirection.Out),
       new DvArgument("PeerConnectionID",
         A_ARG_TYPE_ConnectionID,
         ArgumentDirection.Out),
       new DvArgument("Direction",
         A_ARG_TYPE_Direction,
         ArgumentDirection.Out),
       new DvArgument("Status",
         A_ARG_TYPE_ConnectionStatus,
         ArgumentDirection.Out),
     });
   AddAction(getCurrentConnectionInfoAction);
 }
    public UPnPRenderingControlServiceImpl()
      : base(
        UPnPDevice.RENDERING_CONTROL_SERVICE_TYPE,
        UPnPDevice.RENDERING_CONTROL_SERVICE_TYPE_VERSION,
        UPnPDevice.RENDERING_CONTROL_SERVICE_ID)
    {

      #region DvStateVariables

      // Used for a boolean value
      DvStateVariable BlueVideoBlackLevel = new DvStateVariable("BlueVideoBlackLevel",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = false,
        // TODO add value range
      };
      AddStateVariable(BlueVideoBlackLevel);

      // Used for a boolean value
      DvStateVariable BlueVideoGain = new DvStateVariable("BlueVideoGain",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = false,
        // TODO add vlue range
      };
      AddStateVariable(BlueVideoGain);

      // Used for a boolean value
      DvStateVariable Brightness = new DvStateVariable("Brightness",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = false,
        // TODO add value range
      };
      AddStateVariable(Brightness);

      // Used for a boolean value
      DvStateVariable ColorTemperature = new DvStateVariable("ColorTemperature",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = false,
        // TODO add value range
      };
      AddStateVariable(ColorTemperature);

      // Used for a boolean value
      DvStateVariable Contrast = new DvStateVariable("Contrast",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = false,
        // TODO add value range
      };
      AddStateVariable(Contrast);

      // Used for a boolean value
      DvStateVariable GreenVideoBlackLevel = new DvStateVariable("GreenVideoBlackLevel",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = false,
        // TODO add range
      };
      AddStateVariable(GreenVideoBlackLevel);

      // Used for a boolean value
      DvStateVariable GreenVideoGain = new DvStateVariable("GreenVideoGain",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = false,
        // TODO add range
      };
      AddStateVariable(GreenVideoGain);

      // Used for a boolean value
      DvStateVariable HorizontalKeystone = new DvStateVariable("HorizontalKeystone",
        new DvStandardDataType(UPnPStandardDataType.I2))
      {
        SendEvents = false,
        // TODO Add allowed Range
        // AllowedValueRange = new DvAllowedValueRange()
      };
      AddStateVariable(HorizontalKeystone);

      // Used for a boolean value
      DvStateVariable LastChange = new DvStateVariable("LastChange",
        new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = true,
        Value = "<Event xmlns=\"urn:schemas-upnp-org:metadata-1-0/AVT/\"></Event>"
      };
      AddStateVariable(LastChange);

      // Used for a boolean value
      DvStateVariable Loudness = new DvStateVariable("Loudness",
        new DvStandardDataType(UPnPStandardDataType.Boolean))
      {
        SendEvents = false,
      };
      AddStateVariable(Loudness);

      // Used for a boolean value
      DvStateVariable Mute = new DvStateVariable("Mute",
        new DvStandardDataType(UPnPStandardDataType.Boolean))
      {
        SendEvents = false,
      };
      AddStateVariable(Mute);

      // Used for a boolean value
      DvStateVariable PresetNameList = new DvStateVariable("PresetNameList",
        new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        Value = "FactoryDefaults," +
                "InstallationDefaults",
      };
      AddStateVariable(PresetNameList);

      // Used for a boolean value
      DvStateVariable RedVideoBlackLevel = new DvStateVariable("RedVideoBlackLevel",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = true,
        // TODO add range
      };
      AddStateVariable(RedVideoBlackLevel);

      // Used for a boolean value
      DvStateVariable RedVideoGain = new DvStateVariable("RedVideoGain",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = false,
        // TODO add range
      };
      AddStateVariable(RedVideoGain);

      // Used for a boolean value
      DvStateVariable Sharpness = new DvStateVariable("Sharpness",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = false,
        // TODO add range 
      };
      AddStateVariable(Sharpness);

      // Used for a boolean value
      DvStateVariable VerticalKeystone = new DvStateVariable("VerticalKeystone",
        new DvStandardDataType(UPnPStandardDataType.I2))
      {
        SendEvents = false,
        // TODO Add valueRange
      };
      AddStateVariable(VerticalKeystone);

      // Used for a boolean value
      DvStateVariable Volume = new DvStateVariable("Volume",
        new DvStandardDataType(UPnPStandardDataType.Ui2))
      {
        SendEvents = false,
        AllowedValueRange = new DvAllowedValueRange(new DvStandardDataType(UPnPStandardDataType.Ui2), 0.0, 100.0, 1.0)
      };
      AddStateVariable(Volume);

      // Used for a boolean value
      DvStateVariable VolumeDB = new DvStateVariable("VolumeDB",
        new DvStandardDataType(UPnPStandardDataType.I2))
      {
        SendEvents = false,
        // TODO add range
      };
      AddStateVariable(VolumeDB);

      #endregion DvStateVariables

      #region A_ARG_TYPE

      // Used for a boolean value
      DvStateVariable A_ARG_TYPE_Channel = new DvStateVariable("A_ARG_TYPE_Channel",
        new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        AllowedValueList = new List<string>
        {
          "Master",
        }
      };
      AddStateVariable(A_ARG_TYPE_Channel);

      // Used for a boolean value
      DvStateVariable A_ARG_TYPE_InstanceID = new DvStateVariable("A_ARG_TYPE_InstanceID",
        new DvStandardDataType(UPnPStandardDataType.Ui4))
      {
        SendEvents = false,
      };
      AddStateVariable(A_ARG_TYPE_InstanceID);

      // Used for a boolean value
      DvStateVariable A_ARG_TYPE_PresetName = new DvStateVariable("A_ARG_TYPE_PresetName",
        new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        AllowedValueList = new List<string>
        {
          "FactoryDefaults",
          "InstallationDefaults",
          "Vendor defined"
        }
      };
      AddStateVariable(A_ARG_TYPE_PresetName);

      #endregion A_ARG_TYPE;

      #region Actions

      DvAction getBlueVideoBlackLevelAction = new DvAction("GetBlueVideoBlackLevel", OnGetBlueVideoBlackLevel,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("CurrentBlueVideoBlackLevel",
            BlueVideoBlackLevel,
            ArgumentDirection.Out),
        });
      AddAction(getBlueVideoBlackLevelAction);

      DvAction getBlueVideoGainAction = new DvAction("GetBlueVideoGain", OnGetBlueVideoGain,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("CurrentBlueVideoGain",
            BlueVideoGain,
            ArgumentDirection.Out),
        });
      AddAction(getBlueVideoGainAction);

      DvAction getBrightnessAction = new DvAction("GetBrightness", OnGetBrightness,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("CurrentBrightness",
            Brightness,
            ArgumentDirection.Out),
        });
      AddAction(getBrightnessAction);

      DvAction getColorTemperatureAction = new DvAction("GetColorTemperature", OnGetColorTemperature,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("CurrentColorTemperature",
            ColorTemperature,
            ArgumentDirection.Out),
        });
      AddAction(getColorTemperatureAction);

      DvAction GetContrastAction = new DvAction("GetContrast", OnGetContrast,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("CurrentContrast",
            Contrast,
            ArgumentDirection.Out),
        });
      AddAction(GetContrastAction);

      DvAction getGreenVideoBlackLevelAction = new DvAction("GetGreenVideoBlackLevel", OnGetGreenVideoBlackLevel,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("CurrentGreenVideoBlackLevel",
            GreenVideoBlackLevel,
            ArgumentDirection.Out),
        });
      AddAction(getGreenVideoBlackLevelAction);

      DvAction getGreenVideoGainAction = new DvAction("GetGreenVideoGain", OnGetGreenVideoGain,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("CurrentGreenVideoGain",
            GreenVideoGain,
            ArgumentDirection.Out),
        });
      AddAction(getGreenVideoGainAction);

      // stopped implementing optional stuff...

      DvAction ListPresetsAction = new DvAction("ListPresets", OnListPresets,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("CurrentPresetNameList",
            PresetNameList,
            ArgumentDirection.Out),
        });
      AddAction(ListPresetsAction);

      DvAction SelectPresetAction = new DvAction("SelectPreset", OnSelectPreset,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
          new DvArgument("PresetName",
            A_ARG_TYPE_PresetName,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
        });
      AddAction(SelectPresetAction);

      DvAction GetVolumeAction = new DvAction("GetVolume", OnGetVolume,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
          new DvArgument("Channel",
            A_ARG_TYPE_Channel,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
          new DvArgument("CurrentVolume",
            Volume,
            ArgumentDirection.Out),
        });
      AddAction(GetVolumeAction);

      DvAction SetVolumeAction = new DvAction("SetVolume", OnSetVolume,
        new DvArgument[]
        {
          new DvArgument("InstanceID",
            A_ARG_TYPE_InstanceID,
            ArgumentDirection.In),
          new DvArgument("Channel",
            A_ARG_TYPE_Channel,
            ArgumentDirection.In),
          new DvArgument("DesiredVolume",
            Volume,
            ArgumentDirection.In),
        },
        new DvArgument[]
        {
        });
      AddAction(SetVolumeAction);

      #endregion Actions

    }
    public UPnPUserProfileDataManagementServiceImpl() : base(
        UPnPTypesAndIds.USER_PROFILE_DATA_MANAGEMENT_SERVICE_TYPE, UPnPTypesAndIds.USER_PROFILE_DATA_MANAGEMENT_SERVICE_TYPE_VERSION,
        UPnPTypesAndIds.USER_PROFILE_DATA_MANAGEMENT_SERVICE_ID)
    {
      // Used to transport an enumeration of user profiles
      DvStateVariable A_ARG_TYPE_UserProfileEnumeration = new DvStateVariable("A_ARG_TYPE_UserProfileEnumeration", new DvExtendedDataType(UPnPExtendedDataTypes.DtUserProfileEnumeration))
          {
            SendEvents = false,
          };
      AddStateVariable(A_ARG_TYPE_UserProfileEnumeration);

      DvStateVariable A_ARG_TYPE_UserProfile = new DvStateVariable("A_ARG_TYPE_UserProfile", new DvExtendedDataType(UPnPExtendedDataTypes.DtUserProfile))
          {
            SendEvents = false,
          };
      AddStateVariable(A_ARG_TYPE_UserProfile);

      // Used for boolean values
      DvStateVariable A_ARG_TYPE_Bool = new DvStateVariable("A_ARG_TYPE_Bool", new DvStandardDataType(UPnPStandardDataType.Boolean))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Bool);

      // Used for any single GUID value
      DvStateVariable A_ARG_TYPE_Uuid = new DvStateVariable("A_ARG_TYPE_Id", new DvStandardDataType(UPnPStandardDataType.Uuid))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Uuid);

      // Used for string values
      DvStateVariable A_ARG_TYPE_String = new DvStateVariable("A_ARG_TYPE_String", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_String);

      // More state variables go here


      // User profiles management
      DvAction getProfilesAction = new DvAction("GetProfiles", OnGetProfiles,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("Profiles", A_ARG_TYPE_UserProfileEnumeration, ArgumentDirection.Out, true)
          });
      AddAction(getProfilesAction);

      DvAction getProfileAction = new DvAction("GetProfile", OnGetProfile,
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Profile", A_ARG_TYPE_UserProfile, ArgumentDirection.Out, true)
          });
      AddAction(getProfileAction);

      DvAction getProfileByNameAction = new DvAction("GetProfileByName", OnGetProfileByName,
          new DvArgument[] {
            new DvArgument("ProfileName", A_ARG_TYPE_String, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Profile", A_ARG_TYPE_UserProfile, ArgumentDirection.Out, true)
          });
      AddAction(getProfileByNameAction);

      DvAction createProfileAction = new DvAction("CreateProfile", OnCreateProfile,
          new DvArgument[] {
            new DvArgument("ProfileName", A_ARG_TYPE_String, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.Out, true)
          });
      AddAction(createProfileAction);

      DvAction renameProfileAction = new DvAction("RenameProfile", OnRenameProfile,
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("NewName", A_ARG_TYPE_String, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(renameProfileAction);

      DvAction deleteProfileAction = new DvAction("DeleteProfile", OnDeleteProfile,
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(deleteProfileAction);

      // User playlist data
      DvAction getUserPlaylistDataAction = new DvAction("GetUserPlaylistData", OnGetUserPlaylistData,
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("PlaylistId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("Key", A_ARG_TYPE_String, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Data", A_ARG_TYPE_String, ArgumentDirection.Out),
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(getUserPlaylistDataAction);

      DvAction setUserPlaylistDataAction = new DvAction("SetUserPlaylistData", OnSetUserPlaylistData,
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("PlaylistId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("Key", A_ARG_TYPE_String, ArgumentDirection.In),
            new DvArgument("Data", A_ARG_TYPE_String, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(setUserPlaylistDataAction);

      // User media item data
      DvAction getUserMediaItemDataAction = new DvAction("GetUserMediaItemData", OnGetUserMediaItemData,
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("MediaItemId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("Key", A_ARG_TYPE_String, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Data", A_ARG_TYPE_String, ArgumentDirection.Out),
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(getUserMediaItemDataAction);

      DvAction setUserMediaItemDataAction = new DvAction("SetUserMediaItemData", OnSetUserMediaItemData,
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("MediaItemId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("Key", A_ARG_TYPE_String, ArgumentDirection.In),
            new DvArgument("Data", A_ARG_TYPE_String, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(setUserMediaItemDataAction);

      // User additional data
      DvAction getUserAdditionalDataAction = new DvAction("GetUserAdditionalData", OnGetUserAdditionalData,
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("Key", A_ARG_TYPE_String, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Data", A_ARG_TYPE_String, ArgumentDirection.Out),
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(getUserAdditionalDataAction);

      DvAction setUserAdditionalDataAction = new DvAction("SetUserAdditionalData", OnSetUserAdditionalData,
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("Key", A_ARG_TYPE_String, ArgumentDirection.In),
            new DvArgument("Data", A_ARG_TYPE_String, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(setUserAdditionalDataAction);

      // Cleanup user data
      DvAction clearAllUserDataAction = new DvAction("ClearAllUserData", OnClearAllUserData,
          new DvArgument[] {
            new DvArgument("ProfileId", A_ARG_TYPE_Uuid, ArgumentDirection.In)
          },
          new DvArgument[] {
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(clearAllUserDataAction);

      // More actions go here
    }
    public UPnPContentDirectoryServiceImpl() : base(
        UPnPTypesAndIds.CONTENT_DIRECTORY_SERVICE_TYPE, UPnPTypesAndIds.CONTENT_DIRECTORY_SERVICE_TYPE_VERSION,
        UPnPTypesAndIds.CONTENT_DIRECTORY_SERVICE_ID)
    {
      // Used for a boolean value
      DvStateVariable A_ARG_TYPE_Bool = new DvStateVariable("A_ARG_TYPE_Bool", new DvStandardDataType(UPnPStandardDataType.Boolean))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Bool);

      // Used for any single GUID value
      DvStateVariable A_ARG_TYPE_Uuid = new DvStateVariable("A_ARG_TYPE_Id", new DvStandardDataType(UPnPStandardDataType.Uuid))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Uuid);

      // CSV of GUID strings
      DvStateVariable A_ARG_TYPE_UuidEnumeration = new DvStateVariable("A_ARG_TYPE_UuidEnumeration", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_UuidEnumeration);

      // Used for a system ID string
      DvStateVariable A_ARG_TYPE_SystemId = new DvStateVariable("A_ARG_TYPE_SystemId", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_SystemId);

      // Used for several parameters and result values
      DvStateVariable A_ARG_TYPE_Count = new DvStateVariable("A_ARG_TYPE_Count", new DvStandardDataType(UPnPStandardDataType.Int))
          {
            SendEvents = false
          }; // Is int sufficient here?
      AddStateVariable(A_ARG_TYPE_Count);

      // Used to transport a resource path expression
      DvStateVariable A_ARG_TYPE_ResourcePath = new DvStateVariable("A_ARG_TYPE_ResourcePath", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_ResourcePath);

      // Used to transport an enumeration of directories data
      DvStateVariable A_ARG_TYPE_ResourcePaths = new DvStateVariable("A_ARG_TYPE_ResourcePaths", new DvExtendedDataType(UPnPExtendedDataTypes.DtResourcePathMetadataEnumeration))
        {
            SendEvents = false
        };
      AddStateVariable(A_ARG_TYPE_ResourcePaths);

      // Used to hold names for several objects
      DvStateVariable A_ARG_TYPE_Name = new DvStateVariable("A_ARG_TYPE_Name", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Name);

      // CSV of media category strings
      DvStateVariable A_ARG_TYPE_MediaCategoryEnumeration = new DvStateVariable("A_ARG_TYPE_MediaCategoryEnumeration", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_MediaCategoryEnumeration);

      // Used to transport the data of a share structure
      DvStateVariable A_ARG_TYPE_Share = new DvStateVariable("A_ARG_TYPE_Share", new DvExtendedDataType(UPnPExtendedDataTypes.DtShare))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_Share);

      // Used to transport an enumeration of shares data
      DvStateVariable A_ARG_TYPE_ShareEnumeration = new DvStateVariable("A_ARG_TYPE_ShareEnumeration", new DvExtendedDataType(UPnPExtendedDataTypes.DtShareEnumeration))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_ShareEnumeration);

      // Used to transport a media item aspect metadata structure
      DvStateVariable A_ARG_TYPE_MediaItemAspectMetadata = new DvStateVariable("A_ARG_TYPE_MediaItemAspectMetadata", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemAspectMetadata))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_MediaItemAspectMetadata);

      // Used to give a mode of relocating media items after a share edit.
      DvStateVariable A_ARG_TYPE_MediaItemRelocationMode = new DvStateVariable("A_ARG_TYPE_MediaItemRelocationMode", new DvStandardDataType(UPnPStandardDataType.String))
          {
            SendEvents = false,
            AllowedValueList = new List<string> {"Relocate", "ClearAndReImport"}
          };
      AddStateVariable(A_ARG_TYPE_MediaItemRelocationMode);

      // Used to transport an argument of type MediaItemQuery
      DvStateVariable A_ARG_TYPE_MediaItemQuery = new DvStateVariable("A_ARG_TYPE_MediaItemQuery", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemQuery))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItemQuery);

      // Used to transport a value indicating if only online objects are referred or all.
      DvStateVariable A_ARG_TYPE_OnlineState = new DvStateVariable("A_ARG_TYPE_OnlineState", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
            AllowedValueList = new List<string> {"All", "OnlyOnline"}
        };
      AddStateVariable(A_ARG_TYPE_OnlineState);

      // Used to transport a value indicating if query has to be done case sensitive or not.
      DvStateVariable A_ARG_TYPE_CapitalizationMode = new DvStateVariable("A_ARG_TYPE_CapitalizationMode", new DvStandardDataType(UPnPStandardDataType.String))
      {
        SendEvents = false,
        AllowedValueList = new List<string> { "CaseSensitive", "CaseInsensitive" }
      };
      AddStateVariable(A_ARG_TYPE_CapitalizationMode);

      // Used to transport a single media item with some media item aspects
      DvStateVariable A_ARG_TYPE_MediaItem = new DvStateVariable("A_ARG_TYPE_MediaItem", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItem))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItem);

      // Used to transport a collection of media items with some media item aspects
      DvStateVariable A_ARG_TYPE_MediaItems = new DvStateVariable("A_ARG_TYPE_MediaItems", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemEnumeration))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItems);

      // Used to transport a single media item filter
      DvStateVariable A_ARG_TYPE_MediaItemFilter = new DvStateVariable("A_ARG_TYPE_MediaItemFilter", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemsFilter))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItemFilter);

      // Used to transport a collection of media item attribute values
      DvStateVariable A_ARG_TYPE_MediaItemAttributeValues = new DvStateVariable("A_ARG_TYPE_MediaItemAttributeValues", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemAttributeValues))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItemAttributeValues);

      // Used to transport an enumeration of media item aspects for a media item specified elsewhere
      DvStateVariable A_ARG_TYPE_MediaItemAspects = new DvStateVariable("A_ARG_TYPE_MediaItemAspects", new DvExtendedDataType(UPnPExtendedDataTypes.DtMediaItemAspectEnumeration))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_MediaItemAspects);

      // Used to transport the text to be used in a simple text search
      DvStateVariable A_ARG_TYPE_SearchText = new DvStateVariable("A_ARG_TYPE_SearchText", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
        };
      AddStateVariable(A_ARG_TYPE_SearchText);

      // Used to transport a value indicating if only online objects are referred or all.
      DvStateVariable A_ARG_TYPE_TextSearchMode = new DvStateVariable("A_ARG_TYPE_TextSearchMode", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
            AllowedValueList = new List<string> {"Normal", "ExcludeCLOBs"}
        };
      AddStateVariable(A_ARG_TYPE_TextSearchMode);

      // Used to transport an enumeration of value group instances
      DvStateVariable A_ARG_TYPE_MLQueryResultGroupEnumeration = new DvStateVariable("A_ARG_TYPE_MLQueryResultGroupEnumeration", new DvExtendedDataType(UPnPExtendedDataTypes.DtMLQueryResultGroupEnumeration))
          {
            SendEvents = false,
          };
      AddStateVariable(A_ARG_TYPE_MLQueryResultGroupEnumeration);

      DvStateVariable A_ARG_TYPE_ProjectionFunction = new DvStateVariable("A_ARG_TYPE_ProjectionFunction", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
            AllowedValueList = new List<string> {"None", "DateToYear"}
        };
      AddStateVariable(A_ARG_TYPE_ProjectionFunction);

      DvStateVariable A_ARG_TYPE_GroupingFunction = new DvStateVariable("A_ARG_TYPE_GroupingFunction", new DvStandardDataType(UPnPStandardDataType.String))
        {
            SendEvents = false,
            AllowedValueList = new List<string> {"FirstCharacter"}
        };
      AddStateVariable(A_ARG_TYPE_GroupingFunction);

      // Used to transport the data of a PlaylistContents instance
      DvStateVariable A_ARG_TYPE_PlaylistContents = new DvStateVariable("A_ARG_TYPE_PlaylistContents", new DvExtendedDataType(UPnPExtendedDataTypes.DtPlaylistContents))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_PlaylistContents);

      // Used to transport the data of a PlaylistRawData instance
      DvStateVariable A_ARG_TYPE_PlaylistRawData = new DvStateVariable("A_ARG_TYPE_PlaylistRawData", new DvExtendedDataType(UPnPExtendedDataTypes.DtPlaylistRawData))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_PlaylistRawData);

      // Used to transport an enumeration of playlist identification data (id, name) instances
      DvStateVariable A_ARG_TYPE_PlaylistIdentificationDataEnumeration = new DvStateVariable("A_ARG_TYPE_PlaylistIdentificationDataEnumeration", new DvExtendedDataType(UPnPExtendedDataTypes.DtPlaylistInformationDataEnumeration))
          {
            SendEvents = false
          };
      AddStateVariable(A_ARG_TYPE_PlaylistIdentificationDataEnumeration);

      // Used to transport an IDictionary<Guid, DateTime> such as the MediaItemAspectCreationDates
      DvStateVariable A_ARG_TYPE_DictionaryGuidDateTime = new DvStateVariable("A_ARG_TYPE_DictionaryGuidDateTime", new DvExtendedDataType(UPnPExtendedDataTypes.DtDictionaryGuidDateTime))
      {
        SendEvents = false
      };
      AddStateVariable(A_ARG_TYPE_DictionaryGuidDateTime);

      // Change event for playlists
      PlaylistsChangeCounter = new DvStateVariable("PlaylistsChangeCounter", new DvStandardDataType(UPnPStandardDataType.Ui4))
        {
            SendEvents = true,
            Value = (uint) 0
        };
      AddStateVariable(PlaylistsChangeCounter);

      // Change event for MIA type registrations
      MIATypeRegistrationsChangeCounter = new DvStateVariable("MIATypeRegistrationsChangeCounter", new DvStandardDataType(UPnPStandardDataType.Ui4))
        {
            SendEvents = true,
            Value = (uint) 0
        };
      AddStateVariable(MIATypeRegistrationsChangeCounter);

      // Change event for registered shares
      RegisteredSharesChangeCounter = new DvStateVariable("RegisteredSharesChangeCounter", new DvStandardDataType(UPnPStandardDataType.Ui4))
        {
            SendEvents = true,
            Value = (uint) 0
        };
      AddStateVariable(RegisteredSharesChangeCounter);

      // Change event for currently importing shares
      CurrentlyImportingSharesChangeCounter = new DvStateVariable("CurrentlyImportingSharesChangeCounter", new DvStandardDataType(UPnPStandardDataType.Ui4))
        {
            SendEvents = true,
            Value = (uint) 0
        };
      AddStateVariable(CurrentlyImportingSharesChangeCounter);

      // More state variables go here

      // Shares management
      DvAction registerShareAction = new DvAction("RegisterShare", OnRegisterShare,
          new DvArgument[] {
            new DvArgument("Share", A_ARG_TYPE_Share, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(registerShareAction);

      DvAction removeShareAction = new DvAction("RemoveShare", OnRemoveShare,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In)
          },
          new DvArgument[] {
          });
      AddAction(removeShareAction);

      DvAction updateShareAction = new DvAction("UpdateShare", OnUpdateShare,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("BaseResourcePath", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
            new DvArgument("ShareName", A_ARG_TYPE_Name, ArgumentDirection.In),
            new DvArgument("MediaCategories", A_ARG_TYPE_MediaCategoryEnumeration, ArgumentDirection.In),
            new DvArgument("RelocateMediaItems", A_ARG_TYPE_MediaItemRelocationMode, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("NumAffectedMediaItems", A_ARG_TYPE_Count, ArgumentDirection.Out, true)
          });
      AddAction(updateShareAction);

      DvAction getSharesAction = new DvAction("GetShares", OnGetShares,
          new DvArgument[] {
            new DvArgument("SystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
            new DvArgument("SharesFilter", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("Shares", A_ARG_TYPE_ShareEnumeration, ArgumentDirection.Out, true)
          });
      AddAction(getSharesAction);

      DvAction getShareAction = new DvAction("GetShare", OnGetShare,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("Share", A_ARG_TYPE_Share, ArgumentDirection.Out, true)
          });
      AddAction(getShareAction);

      DvAction reImportShareAction = new DvAction("ReImportShare", OnReImportShare,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(reImportShareAction);

      DvAction setupDefaultServerSharesAction = new DvAction("SetupDefaultServerShares", OnSetupDefaultServerShares,
          new DvArgument[] {
          },
          new DvArgument[] {
          });
      AddAction(setupDefaultServerSharesAction);

      // Media item aspect storage management

      DvAction addMediaItemAspectStorageAction = new DvAction("AddMediaItemAspectStorage", OnAddMediaItemAspectStorage,
          new DvArgument[] {
            new DvArgument("MIAM", A_ARG_TYPE_MediaItemAspectMetadata, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(addMediaItemAspectStorageAction);

      DvAction removeMediaItemAspectStorageAction = new DvAction("RemoveMediaItemAspectStorage", OnRemoveMediaItemAspectStorage,
          new DvArgument[] {
            new DvArgument("MIAM_Id", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(removeMediaItemAspectStorageAction);

      DvAction getAllManagedMediaItemAspectTypesAction = new DvAction("GetAllManagedMediaItemAspectTypes", OnGetAllManagedMediaItemAspectTypes,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("MIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.Out, true),
          });
      AddAction(getAllManagedMediaItemAspectTypesAction);

      DvAction getAllManagedMediaItemAspectCreationDatesAction = new DvAction("GetAllManagedMediaItemAspectCreationDates", OnGetAllManagedMediaItemAspectCreationDates,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("MIACreationDates", A_ARG_TYPE_DictionaryGuidDateTime, ArgumentDirection.Out, true),
          });
      AddAction(getAllManagedMediaItemAspectCreationDatesAction);

      DvAction getMediaItemAspectMetadataAction = new DvAction("GetMediaItemAspectMetadata", OnGetMediaItemAspectMetadata,
          new DvArgument[] {
            new DvArgument("MIAM_Id", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MIAM", A_ARG_TYPE_MediaItemAspectMetadata, ArgumentDirection.Out, true),
          });
      AddAction(getMediaItemAspectMetadataAction);

      // Media query

      DvAction loadItemAction = new DvAction("LoadItem", OnLoadItem,
          new DvArgument[] {
            new DvArgument("SystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
            new DvArgument("Path", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MediaItem", A_ARG_TYPE_MediaItem, ArgumentDirection.Out, true),
          });
      AddAction(loadItemAction);

      DvAction browseAction = new DvAction("Browse", OnBrowse,
          new DvArgument[] {
            new DvArgument("ParentDirectory", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true),
          });
      AddAction(browseAction);

      DvAction searchAction = new DvAction("Search", OnSearch,
          new DvArgument[] {
            new DvArgument("Query", A_ARG_TYPE_MediaItemQuery, ArgumentDirection.In),
            new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true),
          });
      AddAction(searchAction);

      DvAction textSearchAction = new DvAction("SimpleTextSearch", OnTextSearch,
          new DvArgument[] {
            new DvArgument("SearchText", A_ARG_TYPE_SearchText, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("Filter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("SearchMode", A_ARG_TYPE_TextSearchMode, ArgumentDirection.In),
            new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
            new DvArgument("CapitalizationMode", A_ARG_TYPE_CapitalizationMode, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true),
          });
      AddAction(textSearchAction);

      DvAction getValueGroupsAction = new DvAction("GetValueGroups", OnGetValueGroups,
          new DvArgument[] {
            new DvArgument("MIAType", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("AttributeName", A_ARG_TYPE_Name, ArgumentDirection.In),
            new DvArgument("SelectAttributeFilter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("ProjectionFunction", A_ARG_TYPE_ProjectionFunction, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("Filter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("ValueGroups", A_ARG_TYPE_MediaItemAttributeValues, ArgumentDirection.Out, true),
          });
      AddAction(getValueGroupsAction);

      DvAction groupValueGroupsAction = new DvAction("GroupValueGroups", OnGroupValueGroups,
          new DvArgument[] {
            new DvArgument("MIAType", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("AttributeName", A_ARG_TYPE_Name, ArgumentDirection.In),
            new DvArgument("SelectAttributeFilter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("ProjectionFunction", A_ARG_TYPE_ProjectionFunction, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("Filter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
            new DvArgument("GroupingFunction", A_ARG_TYPE_GroupingFunction, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("ResultGroups", A_ARG_TYPE_MLQueryResultGroupEnumeration, ArgumentDirection.Out, true),
          });
      AddAction(groupValueGroupsAction);

      DvAction countMediaItemsAction = new DvAction("CountMediaItems", OnCountMediaItems,
          new DvArgument[] {
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("Filter", A_ARG_TYPE_MediaItemFilter, ArgumentDirection.In),
            new DvArgument("OnlineState", A_ARG_TYPE_OnlineState, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("NumMediaItems", A_ARG_TYPE_Count, ArgumentDirection.Out, true),
          });
      AddAction(countMediaItemsAction);

      // Playlist management

      DvAction getPlaylistsAction = new DvAction("GetPlaylists", OnGetPlaylists,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("Playlists", A_ARG_TYPE_PlaylistIdentificationDataEnumeration, ArgumentDirection.Out, true),
          });
      AddAction(getPlaylistsAction);

      DvAction savePlaylistAction = new DvAction("SavePlaylist", OnSavePlaylist,
          new DvArgument[] {
            new DvArgument("PlaylistRawData", A_ARG_TYPE_PlaylistRawData, ArgumentDirection.In)
          },
          new DvArgument[] {
          });
      AddAction(savePlaylistAction);

      DvAction deletePlaylistAction = new DvAction("DeletePlaylist", OnDeletePlaylist,
          new DvArgument[] {
            new DvArgument("PlaylistId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("Success", A_ARG_TYPE_Bool, ArgumentDirection.Out, true)
          });
      AddAction(deletePlaylistAction);

      DvAction exportPlaylistAction = new DvAction("ExportPlaylist", OnExportPlaylist,
          new DvArgument[] {
            new DvArgument("PlaylistId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("PlaylistRawData", A_ARG_TYPE_PlaylistRawData, ArgumentDirection.Out, true)
          });
      AddAction(exportPlaylistAction);

      DvAction loadCustomPlaylistAction = new DvAction("LoadCustomPlaylist", OnLoadCustomPlaylist,
          new DvArgument[] {
            new DvArgument("MediaItemIds", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("NecessaryMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
            new DvArgument("OptionalMIATypes", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MediaItems", A_ARG_TYPE_MediaItems, ArgumentDirection.Out, true)
          });
      AddAction(loadCustomPlaylistAction);

      // Media import

      DvAction addOrUpdateMediaItemAction = new DvAction("AddOrUpdateMediaItem", OnAddOrUpdateMediaItem,
          new DvArgument[] {
            new DvArgument("ParentDirectoryId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
            new DvArgument("SystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
            new DvArgument("Path", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
            new DvArgument("UpdatedMediaItemAspects", A_ARG_TYPE_MediaItemAspects, ArgumentDirection.In),
          },
          new DvArgument[] {
            new DvArgument("MediaItemId", A_ARG_TYPE_Uuid, ArgumentDirection.Out, true),
          });
      AddAction(addOrUpdateMediaItemAction);

      DvAction deleteMediaItemOrPathAction = new DvAction("DeleteMediaItemOrPath", OnDeleteMediaItemOrPath,
          new DvArgument[] {
            new DvArgument("SystemId", A_ARG_TYPE_SystemId, ArgumentDirection.In),
            new DvArgument("Path", A_ARG_TYPE_ResourcePath, ArgumentDirection.In),
            new DvArgument("Inclusive", A_ARG_TYPE_Bool, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(deleteMediaItemOrPathAction);

      DvAction clientStartedShareImportAction = new DvAction("ClientStartedShareImport", OnClientStartedShareImport,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(clientStartedShareImportAction);

      DvAction clientCompletedShareImportAction = new DvAction("ClientCompletedShareImport", OnClientCompletedShareImport,
          new DvArgument[] {
            new DvArgument("ShareId", A_ARG_TYPE_Uuid, ArgumentDirection.In),
          },
          new DvArgument[] {
          });
      AddAction(clientCompletedShareImportAction);

      DvAction getCurrentlyImportingSharesAction = new DvAction("GetCurrentlyImportingShares", OnGetCurrentlyImportingShares,
          new DvArgument[] {
          },
          new DvArgument[] {
            new DvArgument("ShareIds", A_ARG_TYPE_UuidEnumeration, ArgumentDirection.Out, true), 
          });
      AddAction(getCurrentlyImportingSharesAction);

      // Media playback

      DvAction notifyPlaybackAction = new DvAction("NotifyPlayback", OnNotifyPlayback,
          new DvArgument[] {
            new DvArgument("MediaItemId", A_ARG_TYPE_Uuid, ArgumentDirection.In), 
          },
          new DvArgument[] {
          });
      AddAction(notifyPlaybackAction);

      // More actions go here

      _messageQueue = new AsynchronousMessageQueue(this, new string[]
        {
            ContentDirectoryMessaging.CHANNEL,
            ImporterWorkerMessaging.CHANNEL,
        });
      _messageQueue.MessageReceived += OnMessageReceived;
      _messageQueue.Start();
    }
Пример #22
0
 /// <summary>
 /// Adds the specified state <paramref name="variable"/> to this service.
 /// </summary>
 /// <remarks>
 /// The state variables need to be added in a special order. If this service is a standard service, state variables
 /// of the standard service type need to be added first. After that, additional state variables might be added.
 /// </remarks>
 /// <param name="variable">UPnP state variable to add.</param>
 public void AddStateVariable(DvStateVariable variable)
 {
     _stateVariables.Add(variable.Name, variable);
     variable.ParentService = this;
 }
Пример #23
0
 /// <summary>
 /// Updates internal data structures that are necessary for event moderation.
 /// This method needs to be called when an event message for the given <paramref name="variable"/> is sent.
 /// </summary>
 public void UpdateModerationData(DvStateVariable variable)
 {
   ModerationData md;
   if (!_moderationData.TryGetValue(variable, out md))
     _moderationData[variable] = md = new ModerationData();
   DateTime now = DateTime.Now;
   md.LastEventTime = now;
   md.LastValue = variable.Value;
 }
Пример #24
0
    private void OnStateVariableChanged(DvStateVariable variable)
    {
      lock (_serverData.SyncObj)
      {
        // Unicast event notifications
        DvService service = variable.ParentService;
        foreach (EndpointConfiguration config in _serverData.UPnPEndPoints)
          foreach (EventSubscription subscription in config.EventSubscriptions)
            if (subscription.Service == service && !subscription.IsDisposed)
              subscription.StateVariableChanged(variable);

        // Multicast event notifications
        if (variable.Multicast)
        {
          EventingState eventingState = _serverData.GetMulticastEventKey(variable.ParentService);
          if (eventingState.EventKey == 0)
            // Avoid sending "normal" change events before the initial event was sent
            return;
          eventingState.ModerateChangeEvent(variable);
          ScheduleMulticastEvents();
        }
      }
    }
Пример #25
0
 internal void FireStateVariableChanged(DvStateVariable variable)
 {
   try
   {
     StateVariableChangedDlgt stateVariableChanged = StateVariableChanged;
     if (stateVariableChanged != null)
       stateVariableChanged(variable);
   }
   catch (Exception e)
   {
     UPnPConfiguration.LOGGER.Warn("DvService: Error invoking StateVariableChanged delegate", e);
   }
 }