diff --git a/src/DxFeed.Graal.Net/Native/Orcs/PriceLevelServiceHandle.cs b/src/DxFeed.Graal.Net/Native/Orcs/PriceLevelServiceHandle.cs new file mode 100644 index 00000000..cb0bec36 --- /dev/null +++ b/src/DxFeed.Graal.Net/Native/Orcs/PriceLevelServiceHandle.cs @@ -0,0 +1,77 @@ +// +// Copyright © 2025 Devexperts LLC. All rights reserved. +// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// + +using System; +using System.Runtime.InteropServices; +using DxFeed.Graal.Net.Native.ErrorHandling; +using DxFeed.Graal.Net.Native.Interop; +using DxFeed.Graal.Net.Native.SymbolMappers; + +namespace DxFeed.Graal.Net.Native.Orcs; + +internal sealed class PriceLevelServiceHandle : JavaHandle +{ + public static PriceLevelServiceHandle Create(string address) + { + ErrorCheck.SafeCall(NativeCreate(CurrentThread, address, out var service)); + + return service; + } + + [DllImport( + ImportInfo.DllName, + CallingConvention = CallingConvention.Cdecl, + CharSet = CharSet.Ansi, + ExactSpelling = true, + BestFitMapping = false, + ThrowOnUnmappableChar = true, + EntryPoint = "dxfg_PriceLevelService_new")] + private static extern int NativeCreate( + nint thread, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StringMarshaler))] + string address, + out PriceLevelServiceHandle service); + + [DllImport( + ImportInfo.DllName, + CallingConvention = CallingConvention.Cdecl, + CharSet = CharSet.Ansi, + ExactSpelling = true, + BestFitMapping = false, + ThrowOnUnmappableChar = true, + EntryPoint = "dxfg_PriceLevelService_getOrders")] + private static extern unsafe int NativeGetOrders( + nint thread, + PriceLevelServiceHandle service, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SymbolMarshaler))] + object candleSymbol, + SymbolMarshaler.IndexedEventSourceNative* orderSource, + long from, + long to, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StringMarshaler))] + string caller, + out IntPtr /* ListNative* */ orders); + + [DllImport( + ImportInfo.DllName, + CallingConvention = CallingConvention.Cdecl, + CharSet = CharSet.Ansi, + ExactSpelling = true, + BestFitMapping = false, + ThrowOnUnmappableChar = true, + EntryPoint = "dxfg_PriceLevelService_getOrders2")] + private static extern unsafe int NativeGetOrders( + nint thread, + PriceLevelServiceHandle service, + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(SymbolMarshaler))] + object candleSymbol, + SymbolMarshaler.IndexedEventSourceNative* orderSource, + long from, + long to, + out IntPtr /* ListNative* */ orders); + + // ToDo: add dxfg_PriceLevelService_getAuthOrderSource +} diff --git a/src/DxFeed.Graal.Net/Native/SymbolMappers/SymbolMarshaler.cs b/src/DxFeed.Graal.Net/Native/SymbolMappers/SymbolMarshaler.cs index 5248c394..6d929993 100644 --- a/src/DxFeed.Graal.Net/Native/SymbolMappers/SymbolMarshaler.cs +++ b/src/DxFeed.Graal.Net/Native/SymbolMappers/SymbolMarshaler.cs @@ -20,7 +20,7 @@ internal sealed class SymbolMarshaler : AbstractMarshaler { private static readonly Lazy Instance = new(); - private enum IndexedSourceTypeNative + public enum IndexedSourceTypeNative { /// /// Represent type. @@ -232,7 +232,7 @@ private static unsafe void ReleaseNativeIndexedEventSource(IndexedEventSourceNat } [StructLayout(LayoutKind.Sequential)] - private struct IndexedEventSourceNative + public struct IndexedEventSourceNative { public IndexedSourceTypeNative Type; public int Id;