public int GetVerticalKeystone(System.UInt32 InstanceID)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("CurrentVerticalKeystone", "");
        return(_S.InvokeAsync("GetVerticalKeystone", args, new UPnPService.UPnPServiceInvokeHandler(Sink_GetVerticalKeystone), new UPnPService.UPnPServiceInvokeErrorHandler(Error_Sink_GetVerticalKeystone)));
 }
 private void Sink_SetVerticalKeystone(UPnPService sender, string MethodName, UPnPArgument[] Args, object RetVal, int Handle)
 {
     if(OnResult_SetVerticalKeystone != null)
     {
        OnResult_SetVerticalKeystone((System.UInt32 )Args[0].DataValue, (System.Int16 )Args[1].DataValue, null, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetVerticalKeystone.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetVerticalKeystone)wr.Target)((System.UInt32 )Args[0].DataValue, (System.Int16 )Args[1].DataValue, null, Handle);
         }
         else
         {
             WeakList_SetVerticalKeystone.Remove(wr);
         }
     }
 }
示例#3
0
文件: UPnP.cs 项目: Qu3uk/HomeGenie
        public object InterfaceControl(MIGInterfaceCommand request)
        {
            string returnValue = "";
            bool raisePropertyChanged = false;
            string parameterPath = "Status.Unhandled";
            string raiseParameter = "";
            //
            var device = GetUpnpDevice(request.NodeId);

            //////////////////// Commands: SwitchPower, Dimming
            if (request.Command == Command.CONTROL_ON || request.Command == Command.CONTROL_OFF)
            {
                bool commandValue = (request.Command == Command.CONTROL_ON ? true : false);
                var newValue = new UPnPArgument("newTargetValue", commandValue);
                var args = new UPnPArgument[] {
                    newValue
                };
                InvokeUpnpDeviceService(device, "SwitchPower", "SetTarget", args);
                //
                raisePropertyChanged = true;
                parameterPath = "Status.Level";
                raiseParameter = (commandValue ? "1" : "0");
            }
            else if (request.Command == Command.CONTROL_LEVEL)
            {
                var newvalue = new UPnPArgument("NewLoadLevelTarget", (byte)uint.Parse(request.GetOption(0)));
                var args = new UPnPArgument[] {
                    newvalue
                };
                InvokeUpnpDeviceService(device, "Dimming", "SetLoadLevelTarget", args);
                //
                raisePropertyChanged = true;
                parameterPath = "Status.Level";
                raiseParameter = (double.Parse(request.GetOption(0)) / 100d).ToString(System.Globalization.CultureInfo.InvariantCulture);
            }
            else if (request.Command == Command.CONTROL_TOGGLE)
            {
            }
            //////////////////// Commands: Browse, AVTransport
            else if (request.Command == Command.AVMEDIA_GETURI)
            {
                string deviceId = request.NodeId;
                string id = request.GetOption(0);
                //
                var objectId = new UPnPArgument("ObjectID", id);
                var flags = new UPnPArgument("BrowseFlag", "BrowseMetadata");
                var filter = new UPnPArgument(
                                 "Filter",
                                 "upnp:album,upnp:artist,upnp:genre,upnp:title,res@size,res@duration,res@bitrate,res@sampleFrequency,res@bitsPerSample,res@nrAudioChannels,res@protocolInfo,res@protection,res@importUri"
                             );
                var startIndex = new UPnPArgument("StartingIndex", (uint)0);
                var requestedCount = new UPnPArgument("RequestedCount", (uint)1);
                var sortCriteria = new UPnPArgument("SortCriteria", "");
                //
                var result = new UPnPArgument("Result", "");
                var returnedNumber = new UPnPArgument("NumberReturned", "");
                var totalMatches = new UPnPArgument("TotalMatches", "");
                var updateId = new UPnPArgument("UpdateID", "");
                //
                InvokeUpnpDeviceService(device, "ContentDirectory", "Browse", new UPnPArgument[] {
                    objectId,
                    flags,
                    filter,
                    startIndex,
                    requestedCount,
                    sortCriteria,
                    result,
                    returnedNumber,
                    totalMatches,
                    updateId
                });
                //
                try
                {
                    string ss = result.DataValue.ToString();
                    var item = XDocument.Parse(ss, LoadOptions.SetBaseUri).Descendants().Where(ii => ii.Name.LocalName == "item").First();
                    //
                    foreach (var i in item.Elements())
                    {
                        var protocolUri = i.Attribute("protocolInfo");
                        if (protocolUri != null)
                        {
                            returnValue = i.Value;
                            break;
                        }
                    }
                }
                catch
                {
                }

            }
            else if (request.Command == Command.AVMEDIA_BROWSE)
            {
                string deviceId = request.NodeId;
                string id = request.GetOption(0);
                //
                var objectId = new UPnPArgument("ObjectID", id);
                var flags = new UPnPArgument("BrowseFlag", "BrowseDirectChildren");
                var filter = new UPnPArgument(
                                 "Filter",
                                 "upnp:album,upnp:artist,upnp:genre,upnp:title,res@size,res@duration,res@bitrate,res@sampleFrequency,res@bitsPerSample,res@nrAudioChannels,res@protocolInfo,res@protection,res@importUri"
                             );
                var startIndex = new UPnPArgument("StartingIndex", (uint)0);
                var requestedCount = new UPnPArgument("RequestedCount", (uint)0);
                var sortCriteria = new UPnPArgument("SortCriteria", "");
                //
                var result = new UPnPArgument("Result", "");
                var returnedNumber = new UPnPArgument("NumberReturned", "");
                var totalMatches = new UPnPArgument("TotalMatches", "");
                var updateId = new UPnPArgument("UpdateID", "");
                //
                InvokeUpnpDeviceService(device, "ContentDirectory", "Browse", new UPnPArgument[] {
                    objectId,
                    flags,
                    filter,
                    startIndex,
                    requestedCount,
                    sortCriteria,
                    result,
                    returnedNumber,
                    totalMatches,
                    updateId
                });
                //
                try
                {
                    string ss = result.DataValue.ToString();
                    var root = XDocument.Parse(ss, LoadOptions.SetBaseUri).Elements();
                    //
                    string jsonres = "[";
                    foreach (var i in root.Elements())
                    {
                        string itemId = i.Attribute("id").Value;
                        string itemTitle = i.Descendants().Where(n => n.Name.LocalName == "title").First().Value;
                        string itemClass = i.Descendants().Where(n => n.Name.LocalName == "class").First().Value;
                        jsonres += "{ \"Id\" : \"" + itemId + "\", \"Title\" : \"" + itemTitle.Replace("\"", "\\\"") + "\", \"Class\" : \"" + itemClass + "\" },\n";
                    }
                    jsonres = jsonres.TrimEnd(',', '\n') + "]";
                    //
                    returnValue = jsonres;
                }
                catch
                {
                }

            }
            else if (request.Command == Command.AVMEDIA_GETTRANSPORTINFO)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var transportState = new UPnPArgument("CurrentTransportState", "");
                var transportStatus = new UPnPArgument("CurrentTransportStatus", "");
                var currentSpeed = new UPnPArgument("CurrentSpeed", "");
                var args = new UPnPArgument[] {
                    instanceId,
                    transportState,
                    transportStatus,
                    currentSpeed
                };
                InvokeUpnpDeviceService(device, "AVTransport", "GetTransportInfo", args);
                //
                string jsonres = "[{ ";
                jsonres += "\"CurrentTransportState\" : \"" + transportState.DataValue + "\", ";
                jsonres += "\"CurrentTransportStatus\" : \"" + transportStatus.DataValue + "\", ";
                jsonres += "\"CurrentSpeed\" : \"" + currentSpeed.DataValue + "\"";
                jsonres += " }]";
                //
                returnValue = jsonres;
            }
            else if (request.Command == Command.AVMEDIA_GETMEDIAINFO)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var nrTracks = new UPnPArgument("NrTracks", (uint)0);
                var mediaDuration = new UPnPArgument("MediaDuration", "");
                var currentUri = new UPnPArgument("CurrentURI", "");
                var currentUriMetadata = new UPnPArgument("CurrentURIMetaData", "");
                var nextUri = new UPnPArgument("NextURI", "");
                var nextUriMetadata = new UPnPArgument("NextURIMetaData", "");
                var playMedium = new UPnPArgument("PlayMedium", "");
                var recordMedium = new UPnPArgument("RecordMedium", "");
                var writeStatus = new UPnPArgument("WriteStatus", "");
                var args = new UPnPArgument[] {
                    instanceId,
                    nrTracks,
                    mediaDuration,
                    currentUri,
                    currentUriMetadata,
                    nextUri,
                    nextUriMetadata,
                    playMedium,
                    recordMedium,
                    writeStatus
                };
                InvokeUpnpDeviceService(device, "AVTransport", "GetMediaInfo", args);
                //
                string jsonres = "[{ ";
                jsonres += "\"NrTracks\" : \"" + nrTracks.DataValue + "\", ";
                jsonres += "\"MediaDuration\" : \"" + mediaDuration.DataValue + "\", ";
                jsonres += "\"CurrentURI\" : \"" + currentUri.DataValue + "\", ";
                jsonres += "\"CurrentURIMetaData\" : \"" + currentUriMetadata.DataValue.ToString().Replace("\"", "\\\"") + "\", ";
                jsonres += "\"NextURI\" : \"" + nextUri.DataValue + "\", ";
                jsonres += "\"NextURIMetaData\" : \"" + nextUriMetadata.DataValue.ToString().Replace("\"", "\\\"") + "\", ";
                jsonres += "\"PlayMedium\" : \"" + playMedium.DataValue + "\", ";
                jsonres += "\"RecordMedium\" : \"" + recordMedium.DataValue + "\", ";
                jsonres += "\"WriteStatus\" : \"" + writeStatus.DataValue + "\"";
                jsonres += " }]";
                //
                returnValue = jsonres;
            }
            else if (request.Command == Command.AVMEDIA_GETPOSITIONINFO)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var currentTrack = new UPnPArgument("Track", (uint)0);
                var trackDuration = new UPnPArgument("TrackDuration", "");
                var trackMetadata = new UPnPArgument("TrackMetaData", "");
                var trackUri = new UPnPArgument("TrackURI", "");
                var relativeTime = new UPnPArgument("RelTime", "");
                var absoluteTime = new UPnPArgument("AbsTime", "");
                var relativeCount = new UPnPArgument("RelCount", (uint)0);
                var absoluteCount = new UPnPArgument("AbsCount", (uint)0);
                var args = new UPnPArgument[] {
                    instanceId,
                    currentTrack,
                    trackDuration,
                    trackMetadata,
                    trackUri,
                    relativeTime,
                    absoluteTime,
                    relativeCount,
                    absoluteCount
                };
                InvokeUpnpDeviceService(device, "AVTransport", "GetPositionInfo", args);
                //
                string jsonres = "[{";
                jsonres += "\"Track\" : \"" + currentTrack.DataValue + "\",";
                jsonres += "\"TrackDuration\" : \"" + trackDuration.DataValue + "\",";
                jsonres += "\"TrackMetaData\" : \"" + trackMetadata.DataValue.ToString().Replace("\"", "\\\"") + "\",";
                jsonres += "\"TrackURI\" : \"" + trackUri.DataValue + "\",";
                jsonres += "\"RelTime\" : \"" + relativeTime.DataValue + "\",";
                jsonres += "\"AbsTime\" : \"" + absoluteTime.DataValue + "\",";
                jsonres += "\"RelCount\" : \"" + relativeCount.DataValue + "\",";
                jsonres += "\"AbsCount\" : \"" + absoluteCount.DataValue + "\"";
                jsonres += "}]";
                //
                returnValue = jsonres;
            }
            else if (request.Command == Command.AVMEDIA_SETURI)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var currentUri = new UPnPArgument("CurrentURI", request.GetOption(0));
                var uriMetadata = new UPnPArgument("CurrentURIMetaData", "");
                var args = new UPnPArgument[] {
                    instanceId,
                    currentUri,
                    uriMetadata
                };
                InvokeUpnpDeviceService(device, "AVTransport", "SetAVTransportURI", args);
            }
            else if (request.Command == Command.AVMEDIA_PLAY)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var speed = new UPnPArgument("Speed", "1");
                var args = new UPnPArgument[] {
                    instanceId,
                    speed
                };
                InvokeUpnpDeviceService(device, "AVTransport", "Play", args);
            }
            else if (request.Command == Command.AVMEDIA_PAUSE)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var args = new UPnPArgument[] {
                    instanceId
                };
                InvokeUpnpDeviceService(device, "AVTransport", "Pause", args);
            }
            else if (request.Command == Command.AVMEDIA_STOP)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var args = new UPnPArgument[] {
                    instanceId
                };
                InvokeUpnpDeviceService(device, "AVTransport", "Stop", args);
            }
            else if (request.Command == Command.AVMEDIA_PREVIOUS)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var args = new UPnPArgument[] {
                    instanceId
                };
                InvokeUpnpDeviceService(device, "AVTransport", "Previous", args);
            }
            else if (request.Command == Command.AVMEDIA_NEXT)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var args = new UPnPArgument[] {
                    instanceId
                };
                InvokeUpnpDeviceService(device, "AVTransport", "Next", args);
            }
            else if (request.Command == Command.AVMEDIA_SETNEXT)
            {
            }
            else if (request.Command == Command.AVMEDIA_GETMUTE)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var channel = new UPnPArgument("Channel", "Master");
                var currentMute = new UPnPArgument("CurrentMute", "");
                var args = new UPnPArgument[] {
                    instanceId,
                    channel,
                    currentMute
                };
                InvokeUpnpDeviceService(device, "RenderingControl", "GetMute", args);
                returnValue = currentMute.DataValue.ToString();
            }
            else if (request.Command == Command.AVMEDIA_SETMUTE)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var channel = new UPnPArgument("Channel", "Master");
                var mute = new UPnPArgument("DesiredMute", request.GetOption(0) == "1" ? true : false);
                var args = new UPnPArgument[] {
                    instanceId,
                    channel,
                    mute
                };
                InvokeUpnpDeviceService(device, "RenderingControl", "SetMute", args);
            }
            else if (request.Command == Command.AVMEDIA_GETVOLUME)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var channel = new UPnPArgument("Channel", "Master");
                var currentVolume = new UPnPArgument("CurrentVolume", "");
                var args = new UPnPArgument[] {
                    instanceId,
                    channel,
                    currentVolume
                };
                InvokeUpnpDeviceService(device, "RenderingControl", "GetVolume", args);
                returnValue = currentVolume.DataValue.ToString();
            }
            else if (request.Command == Command.AVMEDIA_SETVOLUME)
            {
                var instanceId = new UPnPArgument("InstanceID", (uint)0);
                var channel = new UPnPArgument("Channel", "Master");
                var volume = new UPnPArgument("DesiredVolume", UInt16.Parse(request.GetOption(0)));
                var args = new UPnPArgument[] {
                    instanceId,
                    channel,
                    volume
                };
                InvokeUpnpDeviceService(device, "RenderingControl", "SetVolume", args);
            }

            // signal event
            if (raisePropertyChanged && InterfacePropertyChangedAction != null)
            {
                try
                {
                    InterfacePropertyChangedAction(new InterfacePropertyChangedAction() {
                        Domain = this.Domain,
                        SourceId = device.UniqueDeviceName,
                        SourceType = "UPnP " + (device != null ? device.StandardDeviceType : "device"),
                        Path = parameterPath,
                        Value = raiseParameter
                    });
                }
                catch
                {
                }
            }

            return returnValue;
        }
 private void Error_Sink_SetColorTemperature(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_SetColorTemperature != null)
     {
          OnResult_SetColorTemperature((System.UInt32 )Args[0].DataValue, (System.UInt16)UPnPService.CreateObjectInstance(typeof(System.UInt16),null), e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetColorTemperature.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetColorTemperature)wr.Target)((System.UInt32 )Args[0].DataValue, (System.UInt16)UPnPService.CreateObjectInstance(typeof(System.UInt16),null), e, Handle);
         }
         else
         {
             WeakList_SetColorTemperature.Remove(wr);
         }
     }
 }
 private void Error_Sink_SetSharpness(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     if(OnResult_SetSharpness != null)
     {
          OnResult_SetSharpness((System.UInt32 )Args[0].DataValue, (System.UInt16 )Args[1].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetSharpness.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetSharpness)wr.Target)((System.UInt32 )Args[0].DataValue, (System.UInt16 )Args[1].DataValue, e, Handle);
         }
         else
         {
             WeakList_SetSharpness.Remove(wr);
         }
     }
 }
 public void Sync_SetRedVideoGain(System.UInt32 InstanceID, System.UInt16 DesiredRedVideoGain)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("DesiredRedVideoGain", DesiredRedVideoGain);
     _S.InvokeSync("SetRedVideoGain", args);
     InstanceID = (System.UInt32) args[0].DataValue;
     DesiredRedVideoGain = (System.UInt16) args[1].DataValue;
     return;
 }
 public void Sync_SetVerticalKeystone(System.UInt32 InstanceID, System.Int16 DesiredVerticalKeystone)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("DesiredVerticalKeystone", DesiredVerticalKeystone);
     _S.InvokeSync("SetVerticalKeystone", args);
     InstanceID = (System.UInt32) args[0].DataValue;
     DesiredVerticalKeystone = (System.Int16) args[1].DataValue;
     return;
 }
 public int SetSharpness(System.UInt32 InstanceID, System.UInt16 DesiredSharpness)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("DesiredSharpness", DesiredSharpness);
        return(_S.InvokeAsync("SetSharpness", args, new UPnPService.UPnPServiceInvokeHandler(Sink_SetSharpness), new UPnPService.UPnPServiceInvokeErrorHandler(Error_Sink_SetSharpness)));
 }
 public int SetVerticalKeystone(System.UInt32 InstanceID, System.Int16 DesiredVerticalKeystone)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("DesiredVerticalKeystone", DesiredVerticalKeystone);
        return(_S.InvokeAsync("SetVerticalKeystone", args, new UPnPService.UPnPServiceInvokeHandler(Sink_SetVerticalKeystone), new UPnPService.UPnPServiceInvokeErrorHandler(Error_Sink_SetVerticalKeystone)));
 }
 public int SetGreenVideoBlackLevel(System.UInt32 InstanceID, System.UInt16 DesiredGreenVideoBlackLevel)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("DesiredGreenVideoBlackLevel", DesiredGreenVideoBlackLevel);
        return(_S.InvokeAsync("SetGreenVideoBlackLevel", args, new UPnPService.UPnPServiceInvokeHandler(Sink_SetGreenVideoBlackLevel), new UPnPService.UPnPServiceInvokeErrorHandler(Error_Sink_SetGreenVideoBlackLevel)));
 }
 public int SetRedVideoGain(System.UInt32 InstanceID, System.UInt16 DesiredRedVideoGain)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("DesiredRedVideoGain", DesiredRedVideoGain);
        return(_S.InvokeAsync("SetRedVideoGain", args, new UPnPService.UPnPServiceInvokeHandler(Sink_SetRedVideoGain), new UPnPService.UPnPServiceInvokeErrorHandler(Error_Sink_SetRedVideoGain)));
 }
 public int SetColorTemperature(System.UInt32 InstanceID)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("DesiredColorTemperature", "");
        return(_S.InvokeAsync("SetColorTemperature", args, new UPnPService.UPnPServiceInvokeHandler(Sink_SetColorTemperature), new UPnPService.UPnPServiceInvokeErrorHandler(Error_Sink_SetColorTemperature)));
 }
 public int SelectPreset(System.UInt32 InstanceID, Enum_A_ARG_TYPE_PresetName PresetName)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        switch(PresetName)
        {
        case Enum_A_ARG_TYPE_PresetName.FACTORYDEFAULTS:
            args[1] = new UPnPArgument("PresetName", "FactoryDefaults");
            break;
        case Enum_A_ARG_TYPE_PresetName.INSTALLATIONDEFAULTS:
            args[1] = new UPnPArgument("PresetName", "InstallationDefaults");
            break;
        case Enum_A_ARG_TYPE_PresetName.VENDOR_DEFINED:
            args[1] = new UPnPArgument("PresetName", "Vendor defined");
            break;
        default:
           args[1] = new UPnPArgument("PresetName", GetUnspecifiedValue("Enum_A_ARG_TYPE_PresetName"));
           break;
        }
        return(_S.InvokeAsync("SelectPreset", args, new UPnPService.UPnPServiceInvokeHandler(Sink_SelectPreset), new UPnPService.UPnPServiceInvokeErrorHandler(Error_Sink_SelectPreset)));
 }
 public int ListPresets(System.UInt32 InstanceID)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("CurrentPresetNameList", "");
        return(_S.InvokeAsync("ListPresets", args, new UPnPService.UPnPServiceInvokeHandler(Sink_ListPresets), new UPnPService.UPnPServiceInvokeErrorHandler(Error_Sink_ListPresets)));
 }
 public void Sync_SetColorTemperature(System.UInt32 InstanceID, out System.UInt16 DesiredColorTemperature)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("DesiredColorTemperature", "");
     _S.InvokeSync("SetColorTemperature", args);
     InstanceID = (System.UInt32) args[0].DataValue;
     DesiredColorTemperature = (System.UInt16) args[1].DataValue;
     return;
 }
 public int SetVolumeDB(System.UInt32 InstanceID, Enum_A_ARG_TYPE_Channel Channel, System.Int16 DesiredVolume)
 {
     UPnPArgument[] args = new UPnPArgument[3];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        switch(Channel)
        {
        case Enum_A_ARG_TYPE_Channel.MASTER:
            args[1] = new UPnPArgument("Channel", "Master");
            break;
        case Enum_A_ARG_TYPE_Channel.LF:
            args[1] = new UPnPArgument("Channel", "LF");
            break;
        case Enum_A_ARG_TYPE_Channel.RF:
            args[1] = new UPnPArgument("Channel", "RF");
            break;
        case Enum_A_ARG_TYPE_Channel.CF:
            args[1] = new UPnPArgument("Channel", "CF");
            break;
        case Enum_A_ARG_TYPE_Channel.LFE:
            args[1] = new UPnPArgument("Channel", "LFE");
            break;
        case Enum_A_ARG_TYPE_Channel.LS:
            args[1] = new UPnPArgument("Channel", "LS");
            break;
        case Enum_A_ARG_TYPE_Channel.RS:
            args[1] = new UPnPArgument("Channel", "RS");
            break;
        case Enum_A_ARG_TYPE_Channel.LFC:
            args[1] = new UPnPArgument("Channel", "LFC");
            break;
        case Enum_A_ARG_TYPE_Channel.RFC:
            args[1] = new UPnPArgument("Channel", "RFC");
            break;
        case Enum_A_ARG_TYPE_Channel.SD:
            args[1] = new UPnPArgument("Channel", "SD");
            break;
        case Enum_A_ARG_TYPE_Channel.SL:
            args[1] = new UPnPArgument("Channel", "SL");
            break;
        case Enum_A_ARG_TYPE_Channel.SR_:
            args[1] = new UPnPArgument("Channel", "SR ");
            break;
        case Enum_A_ARG_TYPE_Channel.T:
            args[1] = new UPnPArgument("Channel", "T");
            break;
        case Enum_A_ARG_TYPE_Channel.B:
            args[1] = new UPnPArgument("Channel", "B");
            break;
        case Enum_A_ARG_TYPE_Channel.VENDOR_DEFINED:
            args[1] = new UPnPArgument("Channel", "Vendor defined");
            break;
        default:
           args[1] = new UPnPArgument("Channel", GetUnspecifiedValue("Enum_A_ARG_TYPE_Channel"));
           break;
        }
        args[2] = new UPnPArgument("DesiredVolume", DesiredVolume);
        return(_S.InvokeAsync("SetVolumeDB", args, new UPnPService.UPnPServiceInvokeHandler(Sink_SetVolumeDB), new UPnPService.UPnPServiceInvokeErrorHandler(Error_Sink_SetVolumeDB)));
 }
 public void Sync_SetGreenVideoBlackLevel(System.UInt32 InstanceID, System.UInt16 DesiredGreenVideoBlackLevel)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("DesiredGreenVideoBlackLevel", DesiredGreenVideoBlackLevel);
     _S.InvokeSync("SetGreenVideoBlackLevel", args);
     InstanceID = (System.UInt32) args[0].DataValue;
     DesiredGreenVideoBlackLevel = (System.UInt16) args[1].DataValue;
     return;
 }
 public void Sync_GetGreenVideoGain(System.UInt32 InstanceID, out System.UInt16 CurrentGreenVideoGain)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("CurrentGreenVideoGain", "");
     _S.InvokeSync("GetGreenVideoGain", args);
     InstanceID = (System.UInt32) args[0].DataValue;
     CurrentGreenVideoGain = (System.UInt16) args[1].DataValue;
     return;
 }
 public void Sync_SetSharpness(System.UInt32 InstanceID, System.UInt16 DesiredSharpness)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("DesiredSharpness", DesiredSharpness);
     _S.InvokeSync("SetSharpness", args);
     InstanceID = (System.UInt32) args[0].DataValue;
     DesiredSharpness = (System.UInt16) args[1].DataValue;
     return;
 }
 public void Sync_GetRedVideoBlackLevel(System.UInt32 InstanceID, out System.UInt16 CurrentRedVideoBlackLevel)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("CurrentRedVideoBlackLevel", "");
     _S.InvokeSync("GetRedVideoBlackLevel", args);
     InstanceID = (System.UInt32) args[0].DataValue;
     CurrentRedVideoBlackLevel = (System.UInt16) args[1].DataValue;
     return;
 }
 public void Sync_SetVolumeDB(System.UInt32 InstanceID, Enum_A_ARG_TYPE_Channel Channel, System.Int16 DesiredVolume)
 {
     UPnPArgument[] args = new UPnPArgument[3];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        switch(Channel)
        {
        case Enum_A_ARG_TYPE_Channel.MASTER:
            args[1] = new UPnPArgument("Channel", "Master");
            break;
        case Enum_A_ARG_TYPE_Channel.LF:
            args[1] = new UPnPArgument("Channel", "LF");
            break;
        case Enum_A_ARG_TYPE_Channel.RF:
            args[1] = new UPnPArgument("Channel", "RF");
            break;
        case Enum_A_ARG_TYPE_Channel.CF:
            args[1] = new UPnPArgument("Channel", "CF");
            break;
        case Enum_A_ARG_TYPE_Channel.LFE:
            args[1] = new UPnPArgument("Channel", "LFE");
            break;
        case Enum_A_ARG_TYPE_Channel.LS:
            args[1] = new UPnPArgument("Channel", "LS");
            break;
        case Enum_A_ARG_TYPE_Channel.RS:
            args[1] = new UPnPArgument("Channel", "RS");
            break;
        case Enum_A_ARG_TYPE_Channel.LFC:
            args[1] = new UPnPArgument("Channel", "LFC");
            break;
        case Enum_A_ARG_TYPE_Channel.RFC:
            args[1] = new UPnPArgument("Channel", "RFC");
            break;
        case Enum_A_ARG_TYPE_Channel.SD:
            args[1] = new UPnPArgument("Channel", "SD");
            break;
        case Enum_A_ARG_TYPE_Channel.SL:
            args[1] = new UPnPArgument("Channel", "SL");
            break;
        case Enum_A_ARG_TYPE_Channel.SR_:
            args[1] = new UPnPArgument("Channel", "SR ");
            break;
        case Enum_A_ARG_TYPE_Channel.T:
            args[1] = new UPnPArgument("Channel", "T");
            break;
        case Enum_A_ARG_TYPE_Channel.B:
            args[1] = new UPnPArgument("Channel", "B");
            break;
        case Enum_A_ARG_TYPE_Channel.VENDOR_DEFINED:
            args[1] = new UPnPArgument("Channel", "Vendor defined");
            break;
        default:
           args[1] = new UPnPArgument("Channel", GetUnspecifiedValue("Enum_A_ARG_TYPE_Channel"));
           break;
        }
        args[2] = new UPnPArgument("DesiredVolume", DesiredVolume);
     _S.InvokeSync("SetVolumeDB", args);
     for(int i=0;i<args.Length;++i)
     {
         switch(args[i].Name)
         {
             case "Channel":
                 switch((string)args[i].DataValue)
                 {
                     case "Master":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.MASTER;
                         break;
                     case "LF":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.LF;
                         break;
                     case "RF":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.RF;
                         break;
                     case "CF":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.CF;
                         break;
                     case "LFE":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.LFE;
                         break;
                     case "LS":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.LS;
                         break;
                     case "RS":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.RS;
                         break;
                     case "LFC":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.LFC;
                         break;
                     case "RFC":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.RFC;
                         break;
                     case "SD":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.SD;
                         break;
                     case "SL":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.SL;
                         break;
                     case "SR ":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.SR_;
                         break;
                     case "T":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.T;
                         break;
                     case "B":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.B;
                         break;
                     case "Vendor defined":
                         args[i].DataValue = Enum_A_ARG_TYPE_Channel.VENDOR_DEFINED;
                         break;
                     default:
                        SetUnspecifiedValue("Enum_A_ARG_TYPE_Channel", (string)args[i].DataValue);
                        args[i].DataValue = Enum_A_ARG_TYPE_Channel._UNSPECIFIED_;
                        break;
                 }
                 break;
         }
     }
     InstanceID = (System.UInt32) args[0].DataValue;
     Channel = (Enum_A_ARG_TYPE_Channel) args[1].DataValue;
     DesiredVolume = (System.Int16) args[2].DataValue;
     return;
 }
 public void Sync_GetSharpness(System.UInt32 InstanceID, out System.UInt16 CurrentSharpness)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("CurrentSharpness", "");
     _S.InvokeSync("GetSharpness", args);
     InstanceID = (System.UInt32) args[0].DataValue;
     CurrentSharpness = (System.UInt16) args[1].DataValue;
     return;
 }
 private void Error_Sink_SetMute(UPnPService sender, string MethodName, UPnPArgument[] Args, UPnPInvokeException e, int Handle)
 {
     for(int i=0;i<Args.Length;++i)
     {
         switch(Args[i].Name)
         {
             case "Channel":
                 switch((string)Args[i].DataValue)
                 {
                     case "Master":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.MASTER;
                         break;
                     case "LF":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LF;
                         break;
                     case "RF":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RF;
                         break;
                     case "CF":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.CF;
                         break;
                     case "LFE":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LFE;
                         break;
                     case "LS":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LS;
                         break;
                     case "RS":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RS;
                         break;
                     case "LFC":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LFC;
                         break;
                     case "RFC":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RFC;
                         break;
                     case "SD":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SD;
                         break;
                     case "SL":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SL;
                         break;
                     case "SR ":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SR_;
                         break;
                     case "T":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.T;
                         break;
                     case "B":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.B;
                         break;
                     case "Vendor defined":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.VENDOR_DEFINED;
                         break;
                 }
                 break;
         }
     }
     if(OnResult_SetMute != null)
     {
          OnResult_SetMute((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Boolean )Args[2].DataValue, e, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetMute.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetMute)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Boolean )Args[2].DataValue, e, Handle);
         }
         else
         {
             WeakList_SetMute.Remove(wr);
         }
     }
 }
 public void Sync_GetVerticalKeystone(System.UInt32 InstanceID, out System.Int16 CurrentVerticalKeystone)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("CurrentVerticalKeystone", "");
     _S.InvokeSync("GetVerticalKeystone", args);
     InstanceID = (System.UInt32) args[0].DataValue;
     CurrentVerticalKeystone = (System.Int16) args[1].DataValue;
     return;
 }
 private void Sink_SelectPreset(UPnPService sender, string MethodName, UPnPArgument[] Args, object RetVal, int Handle)
 {
     for(int i=0;i<Args.Length;++i)
     {
         switch(Args[i].Name)
         {
             case "PresetName":
                 switch((string)Args[i].DataValue)
                 {
                     case "FactoryDefaults":
                         Args[i].DataValue = Enum_A_ARG_TYPE_PresetName.FACTORYDEFAULTS;
                         break;
                     case "InstallationDefaults":
                         Args[i].DataValue = Enum_A_ARG_TYPE_PresetName.INSTALLATIONDEFAULTS;
                         break;
                     case "Vendor defined":
                         Args[i].DataValue = Enum_A_ARG_TYPE_PresetName.VENDOR_DEFINED;
                         break;
                     default:
                        SetUnspecifiedValue("Enum_A_ARG_TYPE_PresetName", (string)Args[i].DataValue);
                        Args[i].DataValue = Enum_A_ARG_TYPE_PresetName._UNSPECIFIED_;
                        break;
                 }
                 break;
         }
     }
     if(OnResult_SelectPreset != null)
     {
        OnResult_SelectPreset((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_PresetName )Args[1].DataValue, null, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SelectPreset.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SelectPreset)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_PresetName )Args[1].DataValue, null, Handle);
         }
         else
         {
             WeakList_SelectPreset.Remove(wr);
         }
     }
 }
 public void Sync_ListPresets(System.UInt32 InstanceID, out System.String CurrentPresetNameList)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("CurrentPresetNameList", "");
     _S.InvokeSync("ListPresets", args);
     InstanceID = (System.UInt32) args[0].DataValue;
     CurrentPresetNameList = (System.String) args[1].DataValue;
     return;
 }
 private void Sink_SetVolumeDB(UPnPService sender, string MethodName, UPnPArgument[] Args, object RetVal, int Handle)
 {
     for(int i=0;i<Args.Length;++i)
     {
         switch(Args[i].Name)
         {
             case "Channel":
                 switch((string)Args[i].DataValue)
                 {
                     case "Master":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.MASTER;
                         break;
                     case "LF":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LF;
                         break;
                     case "RF":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RF;
                         break;
                     case "CF":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.CF;
                         break;
                     case "LFE":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LFE;
                         break;
                     case "LS":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LS;
                         break;
                     case "RS":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RS;
                         break;
                     case "LFC":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.LFC;
                         break;
                     case "RFC":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.RFC;
                         break;
                     case "SD":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SD;
                         break;
                     case "SL":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SL;
                         break;
                     case "SR ":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.SR_;
                         break;
                     case "T":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.T;
                         break;
                     case "B":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.B;
                         break;
                     case "Vendor defined":
                         Args[i].DataValue = Enum_A_ARG_TYPE_Channel.VENDOR_DEFINED;
                         break;
                     default:
                        SetUnspecifiedValue("Enum_A_ARG_TYPE_Channel", (string)Args[i].DataValue);
                        Args[i].DataValue = Enum_A_ARG_TYPE_Channel._UNSPECIFIED_;
                        break;
                 }
                 break;
         }
     }
     if(OnResult_SetVolumeDB != null)
     {
        OnResult_SetVolumeDB((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Int16 )Args[2].DataValue, null, Handle);
     }
     WeakReference[] w = (WeakReference[])WeakList_SetVolumeDB.ToArray(typeof(WeakReference));
     foreach(WeakReference wr in w)
     {
         if(wr.IsAlive==true)
         {
            ((Delegate_OnResult_SetVolumeDB)wr.Target)((System.UInt32 )Args[0].DataValue, (Enum_A_ARG_TYPE_Channel )Args[1].DataValue, (System.Int16 )Args[2].DataValue, null, Handle);
         }
         else
         {
             WeakList_SetVolumeDB.Remove(wr);
         }
     }
 }
 public void Sync_SelectPreset(System.UInt32 InstanceID, Enum_A_ARG_TYPE_PresetName PresetName)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        switch(PresetName)
        {
        case Enum_A_ARG_TYPE_PresetName.FACTORYDEFAULTS:
            args[1] = new UPnPArgument("PresetName", "FactoryDefaults");
            break;
        case Enum_A_ARG_TYPE_PresetName.INSTALLATIONDEFAULTS:
            args[1] = new UPnPArgument("PresetName", "InstallationDefaults");
            break;
        case Enum_A_ARG_TYPE_PresetName.VENDOR_DEFINED:
            args[1] = new UPnPArgument("PresetName", "Vendor defined");
            break;
        default:
           args[1] = new UPnPArgument("PresetName", GetUnspecifiedValue("Enum_A_ARG_TYPE_PresetName"));
           break;
        }
     _S.InvokeSync("SelectPreset", args);
     for(int i=0;i<args.Length;++i)
     {
         switch(args[i].Name)
         {
             case "PresetName":
                 switch((string)args[i].DataValue)
                 {
                     case "FactoryDefaults":
                         args[i].DataValue = Enum_A_ARG_TYPE_PresetName.FACTORYDEFAULTS;
                         break;
                     case "InstallationDefaults":
                         args[i].DataValue = Enum_A_ARG_TYPE_PresetName.INSTALLATIONDEFAULTS;
                         break;
                     case "Vendor defined":
                         args[i].DataValue = Enum_A_ARG_TYPE_PresetName.VENDOR_DEFINED;
                         break;
                     default:
                        SetUnspecifiedValue("Enum_A_ARG_TYPE_PresetName", (string)args[i].DataValue);
                        args[i].DataValue = Enum_A_ARG_TYPE_PresetName._UNSPECIFIED_;
                        break;
                 }
                 break;
         }
     }
     InstanceID = (System.UInt32) args[0].DataValue;
     PresetName = (Enum_A_ARG_TYPE_PresetName) args[1].DataValue;
     return;
 }
        private void addArgButton_Click(object sender, System.EventArgs e)
        {
            if (action == null) return;

            if (action.ParentService.GetStateVariables().Length == 0)
            {
                MessageBox.Show(this,"No state variables available","Argument Creation",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);
                return;
            }

            UPnPArgument arg = new UPnPArgument("",null);
            arg.Direction = "in";
            UPnpArgumentEditControl argEdit = new UPnpArgumentEditControl(this,action,arg);
            argEdit.Dock = DockStyle.Top;
            ArrayList list = new ArrayList(argPanel.Controls);
            list.Insert(0, argEdit);
            argPanel.Controls.Clear();
            argPanel.Controls.AddRange(list.ToArray(typeof(Control)) as Control[]);
        }
 public int GetRedVideoGain(System.UInt32 InstanceID)
 {
     UPnPArgument[] args = new UPnPArgument[2];
        args[0] = new UPnPArgument("InstanceID", InstanceID);
        args[1] = new UPnPArgument("CurrentRedVideoGain", "");
        return(_S.InvokeAsync("GetRedVideoGain", args, new UPnPService.UPnPServiceInvokeHandler(Sink_GetRedVideoGain), new UPnPService.UPnPServiceInvokeErrorHandler(Error_Sink_GetRedVideoGain)));
 }