Esempio n. 1
0
        private bool init(bool rfe, bool pa)
        {
            hasRFE = rfe;
            hasPA  = pa;

            JanusAudio.initOzy();

            IntPtr OzyHandle = JanusAudio.OzyOpen();

            if (OzyHandle != (IntPtr)0)
            {
                usbDevHandle = JanusAudio.OzyHandleToRealHandle(OzyHandle);
            }
            else
            {
                usbDevHandle = IntPtr.Zero;
            }

            if (usbDevHandle.Equals(IntPtr.Zero))
            {
                System.Console.WriteLine("Ozy init fails");
                return(false);
            }
            /* else */
            // System.Console.WriteLine("Ozy init succeeds");
            return(true);
        }
Esempio n. 2
0
        // get ozy firmware version string - 8 bytes.  returns
        // null for error
        private static string getOzyFirmwareString()
        {
            IntPtr oz_h = JanusAudio.OzyOpen();

            if (oz_h == (IntPtr)0)
            {
                return(null);
            }
            IntPtr usb_h = JanusAudio.OzyHandleToRealHandle(oz_h);

            if (usb_h == (IntPtr)0)
            {
                JanusAudio.OzyClose(oz_h);
                return(null);
            }

            byte[] buf = new byte[8];
            int    rc  = libUSB_Interface.usb_control_msg(usb_h,
                                                          OzySDR1kControl.VRT_VENDOR_IN,
                                                          OzySDR1kControl.VRQ_SDR1K_CTL,
                                                          OzySDR1kControl.SDR1KCTRL_READ_VERSION,
                                                          0, buf, buf.Length, 1000);
            // System.Console.WriteLine("read version rc: " + rc);

            string result = null;

            if (rc == 8)                  // got length we expected
            {
                char[] cbuf = new char[8];
                for (int i = 0; i < 8; i++)
                {
                    cbuf[i] = (char)(buf[i]);
                }
                result = new string(cbuf);
                System.Console.WriteLine("version: >" + result + "<");
            }
            JanusAudio.OzyClose(oz_h);
            return(result);
        }