internal static pxcmStatus SubscribeAlertINT(IntPtr instance, OnFiredAlertDelegate handler, out Object proxy)
 {
     AlertHandlerDIR adir = new AlertHandlerDIR(handler);
     pxcmStatus sts = PXCMFaceConfiguration_SubscribeAlert(instance, adir.uDIR);
     if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR)
         adir.Dispose();
     proxy = (Object)adir;
     return sts;
 }
    internal static pxcmStatus SubscribeAlertINT(IntPtr instance, OnFiredAlertDelegate alertHandler, out Object proxy)
    {
        AlertHandlerDIR adir = new AlertHandlerDIR(alertHandler);
        pxcmStatus      sts  = PXCMTouchlessController_SubscribeAlert(instance, adir.uDIR);

        if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR)
        {
            adir.Dispose();
        }
        proxy = (Object)adir;
        return(sts);
    }
Esempio n. 3
0
    /**
     *   @brief Unsubscribe an alert handler object.
     *   @param[in] alertHandler - a pointer to the event handler to unsubscribe.
     *   @return PXCM_STATUS_NO_ERROR - operation succeeded.
     *   @return PXCM_STATUS_PARAM_UNSUPPORTED - illegal alertHandler (null pointer).
     */
    public pxcmStatus UnsubscribeAlert(OnFiredAlertDelegate handler)
    {
        if (handler == null)
        {
            return(pxcmStatus.PXCM_STATUS_HANDLE_INVALID);
        }

        lock (maps.cs)
        {
            Object proxy;
            if (!maps.alert.TryGetValue(handler, out proxy))
            {
                return(pxcmStatus.PXCM_STATUS_HANDLE_INVALID);
            }
            pxcmStatus sts = UnsubscribeAlertINT(instance, proxy);
            maps.alert.Remove(handler);
            return(sts);
        }
    }
Esempio n. 4
0
    /**
     *   @brief Register an event handler object for the alerts.
     *   The event handler's OnFiredAlert method is called each time an alert fires.
     *   @param[in] alertHandler - a pointer to the event handler.
     *
     *   @return PXCM_STATUS_NO_ERROR - operation succeeded.
     *   @return PXCM_STATUS_PARAM_UNSUPPORTED - null alertHandler pointer.
     *
     */
    public pxcmStatus SubscribeAlert(OnFiredAlertDelegate handler)
    {
        if (handler == null)
        {
            return(pxcmStatus.PXCM_STATUS_HANDLE_INVALID);
        }

        Object     proxy;
        pxcmStatus sts = SubscribeAlertINT(instance, handler, out proxy);

        if (sts >= pxcmStatus.PXCM_STATUS_NO_ERROR)
        {
            lock (maps.cs)
            {
                maps.alert[handler] = proxy;
            }
        }
        return(sts);
    }
        /** 
            @brief Unsubscribe an event handler for alerts.
            @param[in] alertHandler a delegate event handler that should be removed.
            @return PXC_STATUS_NO_ERROR if the unregistering the event handler was successful, an error otherwise.
        */
        public pxcmStatus UnsubscribeAlert(OnFiredAlertDelegate alertHandler)
        {
            if (alertHandler == null) return pxcmStatus.PXCM_STATUS_HANDLE_INVALID;

            lock (maps.cs)
            {
                Object proxy;
                if (!maps.alerts.TryGetValue(alertHandler, out proxy))
                    return pxcmStatus.PXCM_STATUS_HANDLE_INVALID;

                pxcmStatus sts = UnsubscribeAlertINT(instance, proxy);
                maps.alerts.Remove(alertHandler);
                return sts;
            }
        }
        /** 
            @brief Register an event handler for alerts. The event handler's will be called each time an alert is identified.
            @param[in] alertHandler a delegate event handler.
            @return PXC_STATUS_NO_ERROR if the registering an event handler was successful; otherwise, return the following error:
            PXC_STATUS_DATA_NOT_INITIALIZED - Data failed to initialize.\n        
        */
        public pxcmStatus SubscribeAlert(OnFiredAlertDelegate alertHandler)
        {
            if (alertHandler == null) return pxcmStatus.PXCM_STATUS_HANDLE_INVALID;

            Object proxy;
            pxcmStatus sts = SubscribeAlertINT(instance, alertHandler, out proxy);
            if (sts >= pxcmStatus.PXCM_STATUS_NO_ERROR)
            {
                lock (maps.cs)
                {
                    maps.alerts[alertHandler] = proxy;
                }
            }
            return sts;
        }
 public AlertHandlerDIR(OnFiredAlertDelegate handler)
 {
     mfunc = handler;
     gch = GCHandle.Alloc(handler);
     uDIR = PXCMTouchlessController_AllocAlertHandlerDIR(Marshal.GetFunctionPointerForDelegate(handler));
 }
 public AlertHandlerDIR(OnFiredAlertDelegate handler)
 {
     mfunc = handler;
     gch = GCHandle.Alloc(handler);
     uDIR = PXCMFaceConfiguration_AllocAlertHandlerDIR(Marshal.GetFunctionPointerForDelegate(handler));
 }
 public AlertHandlerDIR(OnFiredAlertDelegate handler)
 {
     mfunc = handler;
     gch   = GCHandle.Alloc(handler);
     uDIR  = PXCMFaceConfiguration_AllocAlertHandlerDIR(Marshal.GetFunctionPointerForDelegate(handler));
 }
 public AlertHandlerDIR(OnFiredAlertDelegate handler)
 {
     mfunc = handler;
     gch   = GCHandle.Alloc(handler);
     uDIR  = PXCMTouchlessController_AllocAlertHandlerDIR(Marshal.GetFunctionPointerForDelegate(handler));
 }