Esempio n. 1
0
        //
        // GetCapInfo
        //
        internal NkMAIDCapInfo[] GetCapInfo()
        {
            NkMAIDCapInfo[] capInfo = null;

            while (true)
            {
                // Get capability count
                uint count = GetCapCount();

                // Allocate capabiity info array
                capInfo = new NkMAIDCapInfo[count];

                // GetCapInfo
                if (GetCapInfo(capInfo))
                {
                    // If GetCapInfo succeeds, we break out of the loop
                    break;
                }
                else
                {
                    // Otherwise we keep trying
                    continue;
                }
            }

            // Return result
            return(capInfo);
        }
Esempio n. 2
0
        public CapModel(NikonBase obj, NkMAIDCapInfo cap)
        {
            _object = obj;
            _cap = cap;

            NikonDevice device = _object as NikonDevice;

            if (device != null)
            {
                device.CapabilityValueChanged += new CapabilityChangedDelegate(device_CapabilityValueChanged);
            }
        }
Esempio n. 3
0
 public static bool CanGetArray(this NkMAIDCapInfo c)
 {
     return((c.ulOperations & eNkMAIDCapOperation.kNkMAIDCapOperation_GetArray) != 0);
 }
Esempio n. 4
0
 public static bool CanSet(this NkMAIDCapInfo c)
 {
     return((c.ulOperations & eNkMAIDCapOperation.kNkMAIDCapOperation_Set) != 0);
 }
Esempio n. 5
0
 public static unsafe string GetDescription(this NkMAIDCapInfo c)
 {
     return(Marshal.PtrToStringAnsi(new IntPtr(c.szDescription)));
 }
Esempio n. 6
0
 public static bool IsInvalid(this NkMAIDCapInfo c)
 {
     return((c.ulVisibility & eNkMAIDCapVisibility.kNkMAIDCapVisibility_Invalid) != 0);
 }
Esempio n. 7
0
 public static bool IsGroupMember(this NkMAIDCapInfo c)
 {
     return((c.ulVisibility & eNkMAIDCapVisibility.kNkMAIDCapVisibility_GroupMember) != 0);
 }
Esempio n. 8
0
 public static bool IsVendor(this NkMAIDCapInfo c)
 {
     return((c.ulVisibility & eNkMAIDCapVisibility.kNkMAIDCapVisibility_Vendor) != 0);
 }
Esempio n. 9
0
 public static bool IsAdvanced(this NkMAIDCapInfo c)
 {
     return((c.ulVisibility & eNkMAIDCapVisibility.kNkMAIDCapVisibility_Advanced) != 0);
 }
Esempio n. 10
0
 public static bool IsHidden(this NkMAIDCapInfo c)
 {
     return((c.ulVisibility & eNkMAIDCapVisibility.kNkMAIDCapVisibility_Hidden) != 0);
 }
Esempio n. 11
0
 public static bool CanGetDefault(this NkMAIDCapInfo c)
 {
     return((c.ulOperations & eNkMAIDCapOperation.kNkMAIDCapOperation_GetDefault) != 0);
 }
Esempio n. 12
0
        //
        // GetCapInfo
        //
        internal NkMAIDCapInfo[] GetCapInfo()
        {
            NkMAIDCapInfo[] capInfo = null;

            while (true)
            {
                // Get capability count
                uint count = GetCapCount();

                // Allocate capabiity info array
                capInfo = new NkMAIDCapInfo[count];

                // GetCapInfo
                if (GetCapInfo(capInfo))
                {
                    // If GetCapInfo succeeds, we break out of the loop
                    break;
                }
                else
                {
                    // Otherwise we keep trying
                    continue;
                }
            }

            // Return result
            return capInfo;
        }
Esempio n. 13
0
        //
        // GetCapInfo
        //
        bool GetCapInfo(NkMAIDCapInfo[] capInfo)
        {
            fixed (NkMAIDCapInfo* p = capInfo)
            {
                try
                {
                    CallEntryPointAsync(
                       eNkMAIDCommand.kNkMAIDCommand_GetCapInfo,
                       (uint)capInfo.Length,
                       eNkMAIDDataType.kNkMAIDDataType_CapInfoPtr,
                       new IntPtr(p).ToInt32());
                }
                catch (NikonException ex)
                {
                    if (ex.ErrorCode == eNkMAIDResult.kNkMAIDResult_BufferSize)
                    {
                        return false;
                    }
                    else
                    {
                        throw;
                    }
                }
            }

            return true;
        }