Exemplo n.º 1
0
 private static extern bool vlWorker_PushJsonAndBinaryCommand(
     IntPtr worker,
     [MarshalAs(UnmanagedType.LPStr)] string jsonString,
     IntPtr binaryData,
     UInt32 binaryDataSize,
     [MarshalAs(UnmanagedType.FunctionPtr)] JsonStringAndBinaryCallback callback,
     IntPtr clientData);
Exemplo n.º 2
0
    /// <summary>
    ///  Enqueues a command for the tracking thread using a JSON string and
    ///  binary data - THIS FUNCTION IS CONSIDERED AS BETA AND MAY BE MATTER OF CHANGE.
    /// </summary>
    /// <remarks>
    ///  <para>
    ///   The command gets processed asynchronously by the tracking thread and
    ///   a callback will called once after the processing has finished.
    ///   Since the memory is pinned until the callback is called in order to prevent multiple copies,
    ///   the static FreeBinaryMemory() function should be called from the callback, in order to
    ///   free allocated memory, which has eventually beeing passed to the function.
    ///  </para>
    /// </remarks>
    /// <param name="jsonString">
    ///  The command with all necessary data as JSON string. The JSON string
    ///  should describe the data
    /// </param>
    /// <param name="binaryDataPtr">
    ///  Binary data ptr, which is a pinned gcHandle memory pointer, which should be given to the vlSDK
    /// </param>
    /// <param name="binaryDataSize">
    ///  The size of the Binary data.
    /// </param>
    /// <param name="callback">
    ///  Callback, which will be called inside <see cref="ProcessCallbacks"/>
    ///  after the command was processed.
    /// </param>
    /// <param name="clientData">
    ///  The callback function will be called with the given pointer value.
    /// </param>
    /// <returns>
    ///  <c>true</c>, if the command was enqueue successfully;
    ///  <c>false</c> otherwise (usually some JSON syntax error).
    /// </returns>
    public bool PushJsonAndBinaryCommand(
        string jsonString,
        IntPtr binaryDataPtr,
        UInt32 binaryDataSize,
        JsonStringAndBinaryCallback callback,
        IntPtr clientData)
    {
        if (this.disposed)
        {
            throw new ObjectDisposedException("VLWorker");
        }



        return(vlWorker_PushJsonAndBinaryCommand(
                   this.handle,
                   jsonString,
                   binaryDataPtr,
                   binaryDataSize,
                   callback,
                   clientData));
    }