Esempio n. 1
0
        unsafe private IntPtr InitCbs()
        {
            _clients.Add(this);
            fixed(FFIAskBid *bidBuff = subBidsBuff.AsSpan())
            {
                fixed(FFIAskBid *askBuff = subAsksBuff.AsSpan())
                {
                    fixed(FFITrade *tradeBuff = subTradesBuff.AsSpan())
                    {
                        this.onOrderbookCb  = this.onOrderbookHandler;
                        this.onTradesCb     = this.onTradesHandler;
                        this.onPingCb       = this.onPingHandler;
                        this.onErrorCb      = this.onErrorHandler;
                        this.onTradesCb     = this.onTradesHandler;
                        this.onDisconnectCb = this.onDisconnect;
                        InitCbs(
                            _client_handle,
                            this.onErrorCb,
                            this.onPingCb,
                            this.onOrderbookCb,
                            this.onTradesCb,
                            this.onDisconnectCb,

                            (IntPtr)bidBuff, (UIntPtr)subBidsBuff.Length,
                            (IntPtr)askBuff, (UIntPtr)subAsksBuff.Length,
                            (IntPtr)tradeBuff, (UIntPtr)subTradesBuff.Length,
                            out var handle
                            );
                        return(handle);
                    }
                }
            }
        }
Esempio n. 2
0
 unsafe private static extern FFIResult InitCbs(IntPtr client,
                                                OnError onError, OnPing onPing, OnOrderbookFFI onOrderbook, OnTradesFFI onTrades, OnDisconnect onDisconnect,
                                                IntPtr bidBuffPtr, UIntPtr bidBufLen,
                                                IntPtr askBuffPtr, UIntPtr askBufLen,
                                                IntPtr taskBuffPtr, UIntPtr tradeBufLen,
                                                out IntPtr subhandle
                                                );