internal static extern int GetDouble(IntPtr attributes, string key, out double val);
[DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_str")]
- internal static extern int GetStr(IntPtr attributes, string key, out string val);
+ internal static extern int GetStr(IntPtr attributes, string key, out IntPtr val);
[DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_byte_str")]
internal static extern int GetByteStr(IntPtr attributes, string key, out IntPtr value, out int size);
throw IoTConnectivityErrorFactory.GetException(ret);
}
- SetAttributes(attributesHandleToClone);
+ SetAttributes(_resourceAttributesHandle);
}
/// <summary>
}
case Interop.IoTConnectivity.Common.DataType.String:
{
- string value;
+ IntPtr value;
+ string Str;
ret = Interop.IoTConnectivity.Common.Attributes.GetStr(attributes, key, out value);
if (ret != (int)IoTConnectivityError.None)
{
Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes");
throw IoTConnectivityErrorFactory.GetException(ret);
}
- _attributes.Add(key, value);
+ Str = Marshal.PtrToStringAnsi(value);
+ _attributes.Add(key, Str);
break;
}
case Interop.IoTConnectivity.Common.DataType.ByteStr: