Exemple #1
0
        private static DX_CAP GetCap(int devh)
        {
            var cap = new DX_CAP();

            var result = dx_clrcap(ref cap);

            if (result <= -1)
            {
                var err = ATDV_ERRMSGP(devh);
                throw new VoiceException(err);
            }

            var capType = typeof(DX_CAP);

            object boxed = cap;

            var caps = VoiceProperties.Current.GetKeyPrefixMatch("cap.");

            foreach (var capName in caps)
            {
                var info = capType.GetField(capName);
                if (info == null)
                {
                    throw new Exception("Could not find dx_cap." + capName);
                }
                var obj = info.GetValue(cap);
                if (obj is ushort)
                {
                    var value = ushort.Parse(VoiceProperties.Current.GetProperty("cap." + capName));
                    info.SetValue(boxed, value);
                }
                else if (obj is byte)
                {
                    var value = byte.Parse(VoiceProperties.Current.GetProperty("cap." + capName));
                    info.SetValue(boxed, value);
                }
            }

            return((DX_CAP)boxed);
        }
Exemple #2
0
 private static extern int dx_dial(int chdev, string dialstring, ref DX_CAP dx_cap, int flag);
Exemple #3
0
 private static extern int dx_clrcap(ref DX_CAP dx_cap);