Ejemplo n.º 1
0
 internal void SetCallback(eNkMAIDCapability capability, NkMAIDCallback callback)
 {
     CapSet(
         capability,
         eNkMAIDDataType.kNkMAIDDataType_CallbackPtr,
         new IntPtr(&callback));
 }
Ejemplo n.º 2
0
        //
        // Callback
        //
        internal NkMAIDCallback GetCallback(eNkMAIDCapability capability)
        {
            NkMAIDCallback callback = new NkMAIDCallback();

            CapGet(
                capability,
                eNkMAIDDataType.kNkMAIDDataType_CallbackPtr,
                new IntPtr(&callback));

            return(callback);
        }
Ejemplo n.º 3
0
        //
        // Set Callbacks
        //
        void SetSupportedCallbacks()
        {
            // Get supported caps and add them to a dictionary
            Dictionary <eNkMAIDCapability, NkMAIDCapInfo> caps = new Dictionary <eNkMAIDCapability, NkMAIDCapInfo>();

            NkMAIDCapInfo[] capsArray = GetCapInfo();
            foreach (NkMAIDCapInfo c in capsArray)
            {
                caps.Add(c.ulID, c);
            }

            // Callback capabilities
            eNkMAIDCapability[] procCaps = new eNkMAIDCapability[]
            {
                eNkMAIDCapability.kNkMAIDCapability_ProgressProc,
                eNkMAIDCapability.kNkMAIDCapability_EventProc,
                eNkMAIDCapability.kNkMAIDCapability_UIRequestProc,
                eNkMAIDCapability.kNkMAIDCapability_DataProc
            };

            // Corresponding callback functions
            Delegate[] procDelegates = new Delegate[]
            {
                _progressProc,
                _eventProc,
                _uiRequestProc,
                _dataProc
            };

            Debug.Assert(procCaps.Length == procDelegates.Length);

            // Set supported callbacks
            for (int i = 0; i < procCaps.Length; i++)
            {
                eNkMAIDCapability cap = procCaps[i];

                if (caps.ContainsKey(cap) &&
                    caps[cap].CanSet())
                {
                    NkMAIDCallback callback = new NkMAIDCallback();
                    callback.pProc = Marshal.GetFunctionPointerForDelegate(procDelegates[i]);

                    SetCallback(cap, callback);
                }
            }
        }
Ejemplo n.º 4
0
        //
        // Callback
        //
        internal NkMAIDCallback GetCallback(eNkMAIDCapability capability)
        {
            NkMAIDCallback callback = new NkMAIDCallback();

            CapGet(
                capability,
                eNkMAIDDataType.kNkMAIDDataType_CallbackPtr,
                new IntPtr(&callback));

            return callback;
        }
Ejemplo n.º 5
0
        //
        // Set Callbacks
        //
        void SetSupportedCallbacks()
        {
            // Get supported caps and add them to a dictionary
            Dictionary<eNkMAIDCapability, NkMAIDCapInfo> caps = new Dictionary<eNkMAIDCapability, NkMAIDCapInfo>();
            NkMAIDCapInfo[] capsArray = GetCapInfo();
            foreach (NkMAIDCapInfo c in capsArray)
            {
                caps.Add(c.ulID, c);
            }

            // Callback capabilities
            eNkMAIDCapability[] procCaps = new eNkMAIDCapability[]
            {
                eNkMAIDCapability.kNkMAIDCapability_ProgressProc,
                eNkMAIDCapability.kNkMAIDCapability_EventProc,
                eNkMAIDCapability.kNkMAIDCapability_UIRequestProc,
                eNkMAIDCapability.kNkMAIDCapability_DataProc
            };

            // Corresponding callback functions
            Delegate[] procDelegates = new Delegate[]
            {
                _progressProc,
                _eventProc,
                _uiRequestProc,
                _dataProc
            };

            Debug.Assert(procCaps.Length == procDelegates.Length);

            // Set supported callbacks
            for (int i = 0; i < procCaps.Length; i++)
            {
                eNkMAIDCapability cap = procCaps[i];

                if (caps.ContainsKey(cap) &&
                    caps[cap].CanSet())
                {
                    NkMAIDCallback callback = new NkMAIDCallback();
                    callback.pProc = Marshal.GetFunctionPointerForDelegate(procDelegates[i]);

                    SetCallback(cap, callback);
                }
            }
        }
Ejemplo n.º 6
0
 internal void SetCallback(eNkMAIDCapability capability, NkMAIDCallback callback)
 {
     CapSet(
         capability,
         eNkMAIDDataType.kNkMAIDDataType_CallbackPtr,
         new IntPtr(&callback));
 }