Ejemplo n.º 1
0
        internal static CpArgument CreateArgument(CpAction parentAction, CpService parentService, XPathNavigator argumentNav,
                                                  IXmlNamespaceResolver nsmgr)
        {
            string          name = ParserHelper.SelectText(argumentNav, "s:name/text()", nsmgr);
            string          relatedStateVariableName = ParserHelper.SelectText(argumentNav, "s:relatedStateVariable/text()", nsmgr);
            CpStateVariable relatedStateVariable;

            if (!parentService.StateVariables.TryGetValue(relatedStateVariableName, out relatedStateVariable))
            {
                throw new ArgumentException("Related state variable '{0}' is not present in service", relatedStateVariableName);
            }
            string            direction = ParserHelper.SelectText(argumentNav, "s:direction/text()", nsmgr);
            XPathNodeIterator retValIt  = argumentNav.Select("s:retval", nsmgr);
            CpArgument        result    = new CpArgument(parentAction, name, relatedStateVariable, ParseArgumentDirection(direction), retValIt.MoveNext());

            return(result);
        }
Ejemplo n.º 2
0
 internal static CpAction ConnectAction(DeviceConnection connection, CpService parentService, XPathNavigator actionNav, IXmlNamespaceResolver nsmgr)
 {
     using (connection.CPData.Lock.EnterWrite())
     {
         string            name       = ParserHelper.SelectText(actionNav, "s:name/text()", nsmgr);
         CpAction          result     = new CpAction(connection, parentService, name);
         XPathNodeIterator argumentIt = actionNav.Select("s:argumentList/s:argument", nsmgr);
         while (argumentIt.MoveNext())
         {
             CpArgument argument = CpArgument.CreateArgument(result, parentService, argumentIt.Current, nsmgr);
             if (argument.Direction == ArgumentDirection.In)
             {
                 result.AddInAgrument(argument);
             }
             else
             {
                 result.AddOutAgrument(argument);
             }
         }
         return(result);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a new formal output argument to this action.
 /// </summary>
 /// <exception cref="UPnPAlreadyConnectedException">If the action is already connected to an action in a device.</exception>
 /// <param name="argument">Argument to add.</param>
 internal void AddOutAgrument(CpArgument argument)
 {
     _outArguments.Add(argument);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Adds a new formal input argument to this action.
 /// </summary>
 /// <exception cref="UPnPAlreadyConnectedException">If the action is already connected to an action in a device.</exception>
 /// <param name="argument">Argument to add.</param>
 internal void AddInAgrument(CpArgument argument)
 {
     _inArguments.Add(argument);
 }
Ejemplo n.º 5
0
 internal static CpArgument CreateArgument(CpAction parentAction, CpService parentService, XPathNavigator argumentNav,
     IXmlNamespaceResolver nsmgr)
 {
   string name = ParserHelper.SelectText(argumentNav, "s:name/text()", nsmgr);
   string relatedStateVariableName = ParserHelper.SelectText(argumentNav, "s:relatedStateVariable/text()", nsmgr);
   CpStateVariable relatedStateVariable;
   if (!parentService.StateVariables.TryGetValue(relatedStateVariableName, out relatedStateVariable))
     throw new ArgumentException("Related state variable '{0}' is not present in service", relatedStateVariableName);
   string direction = ParserHelper.SelectText(argumentNav, "s:direction/text()", nsmgr);
   XPathNodeIterator retValIt = argumentNav.Select("s:retval", nsmgr);
   CpArgument result = new CpArgument(parentAction, name, relatedStateVariable, ParseArgumentDirection(direction), retValIt.MoveNext());
   return result;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Adds a new formal output argument to this action.
 /// </summary>
 /// <exception cref="UPnPAlreadyConnectedException">If the action is already connected to an action in a device.</exception>
 /// <param name="argument">Argument to add.</param>
 internal void AddOutAgrument(CpArgument argument)
 {
   _outArguments.Add(argument);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Adds a new formal input argument to this action.
 /// </summary>
 /// <exception cref="UPnPAlreadyConnectedException">If the action is already connected to an action in a device.</exception>
 /// <param name="argument">Argument to add.</param>
 internal void AddInAgrument(CpArgument argument)
 {
   _inArguments.Add(argument);
 }