// Contructor.
    // scanResultsCallback -> Callback function that will be invoked once the Bluetooth scan for PLUX devices ends.
    // connectionDoneCallback -> Callback function that will be invoked once a connection with a PLUX device is established.
    public PluxDeviceManager(ScanResults scanResultsCallback, ConnectionDone connectionDoneCallback)
    {
        LazyObject    = new Lazy <BufferAcqSamples>(InitBufferedSamplesObject);
        PluxDevsFound = new Lazy <List <String> >(InitiListDevFound);

        // exceptionPointer -> Pointer to the callback function that will be used to send/communicate information about exceptions generated inside this .dll
        //                     The exception code and description will be sent to Unity where an appropriate action can take place.
        FPtrUnity dllCommunicationHandler = new FPtrUnity(DllCommunicationHandler);

        SetCommunicationHandler(dllCommunicationHandler);

        // Scan callback.
        this.ScanResultsCallback = new ScanResults(scanResultsCallback);

        // On connection successful callback.
        this.ConnectionDoneCallback = new ConnectionDone(connectionDoneCallback);

        // Initialise helper object that manages threads creating during the scanning and connection processes.
        var unitDispatcher = UnityThreadHelper.Dispatcher;

        // Specification of the callback function (defined on this/the user Unity script) which will receive the acquired data
        // samples as inputs.
        SetCallbackHandler(CallbackHandler);
    }
 public CallbackManager(FPtrUnity callbackPointer)
 {
     callbackReference = callbackPointer;
 }
 // Definition of the callback function responsible for managing the acquired data (which is defined on users Unity script).
 // callbackHandler -> A function pointer to the callback that will receive the acquired data samples on the Unity side.
 public bool SetCallbackHandler(FPtrUnity callbackHandler)
 {
     callbackPointer = new CallbackManager(callbackHandler);
     return(true);
 }
 private static extern void SetCommunicationHandler(FPtrUnity handlerFunction);