OpenHome.Net.ControlPoint.CpDevice.GetAttribute C# (CSharp) Метод

GetAttribute() публичный Метод

Query the value of one of the device's attributes
public GetAttribute ( string aKey, string &aValue ) : bool
aKey string The name of the attribute being queried. Available attributes /// will be listed in a protocol-specific header
aValue string The value of the attribute
Результат bool
        public bool GetAttribute(string aKey, out string aValue)
        {
            IntPtr key = InteropUtils.StringToHGlobalUtf8(aKey);
            IntPtr value;
            int ret = CpDeviceCGetAttribute(iHandle, key, out value);
            Marshal.FreeHGlobal(key);
            if (ret != 0)
            {
                aValue = InteropUtils.PtrToStringUtf8(value);
                OhNetFree(value);
                return true;
            }
            aValue = null;
            return false;
        }

Usage Example

Пример #1
0
        private void PrintDeviceInfo(string aPrologue, ControlPoint.CpDevice aDevice)
        {
            string location;

            aDevice.GetAttribute("Upnp.Location", out location);
            string friendlyName;

            aDevice.GetAttribute("Upnp.FriendlyName", out friendlyName);
            Console.Write(aPrologue +
                          "\n    udn = " + aDevice.Udn() +
                          "\n    location = " + location +
                          "\n    name = " + friendlyName + "\n");
        }
All Usage Examples Of OpenHome.Net.ControlPoint.CpDevice::GetAttribute