Exemplo n.º 1
0
        /// <summary>
        /// Retrieves receiver information.
        /// </summary>
        /// <returns>Returns <see cref="RadioInfo"/> retrieved information.</returns>
        public RadioInfo Info()
        {
            var info = new NativeDefinitions.RadioInfo2();
            var ptr  = Marshal.AllocHGlobal((int)info.bLength);

            Marshal.StructureToPtr(info, ptr, true);

            G313Api.GetInfo(GetHandle(), ptr);

            Marshal.PtrToStructure(ptr, info);
            Marshal.FreeHGlobal(ptr);

            CachedInfo = new RadioInfo(info);
            return(CachedInfo);
        }
Exemplo n.º 2
0
        public ICollection <RadioInfo> List()
        {
            var info = new NativeDefinitions.RadioInfo2();
            var ptr  = Marshal.AllocHGlobal((int)info.bLength);

            var structSize = 0;
            var count      = G313Api.GetRadioList(ptr, (int)info.bLength, ref structSize);

            if (info.bLength != structSize)
            {
                throw new InvalidOperationException("info size mismatch");
            }

            Marshal.PtrToStructure(ptr, info);
            Marshal.FreeHGlobal(ptr);

            return(count > 1 ? ListBig(count, structSize) : new[] { new RadioInfo(info) });
        }