You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.4 KiB

// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2017 Intel Corporation. All Rights Reserved.
namespace Intel.RealSense
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
public class SerializableDevice : Device
{
internal SerializableDevice(IntPtr dev)
: base(dev)
{ }
public static SerializableDevice FromDevice(Device dev)
{
return Device.Create<SerializableDevice>(dev.Handle);
}
/// <summary>
/// Gets or sets JSON and applies advanced-mode controls
/// </summary>
/// <value>Serialize JSON content</value>
public string JsonConfiguration
{
get
{
object error;
IntPtr buffer = NativeMethods.rs2_serialize_json(Handle, out error);
int size = NativeMethods.rs2_get_raw_data_size(buffer, out error);
IntPtr data = NativeMethods.rs2_get_raw_data(buffer, out error);
var str = Marshal.PtrToStringAnsi(data, size);
NativeMethods.rs2_delete_raw_data(buffer);
return str;
}
set
{
object error;
NativeMethods.rs2_load_json(Handle, value, (uint)value.Length, out error);
}
}
}
}