Beispiel #1
0
        internal YUSBWatcher(YUSBHub hub)
        {
            _hub = hub;


            // Create a selector that gets a HID device using VID/PID and a
            // VendorDefined usage.
            var selector = HidDevice.GetDeviceSelector(usagePage, usageId);
        }
 public YUSBDevice(YUSBWatcher watcher, YUSBHub hub, HidDevice hid, DeviceInformation info)
 {
     _watcher = watcher;
     _hub     = hub;
     _yctx    = hub._yctx;
     Hid      = hid;
     Info     = info;
     hid.InputReportReceived += OnInputReportEvent;
     _devState    = DevState.Detected;
     _pktAckDelay = 0;
 }
        private async Task <int> AddNewHub(string url, bool reportConnnectionLost, System.IO.Stream request, System.IO.Stream response, object session)
        {
            foreach (YGenericHub h in _hubs)
            {
                if (h.imm_isSameHub(url, request, response, session))
                {
                    return(YAPI.SUCCESS);
                }
            }
            YGenericHub newhub;

            YGenericHub.HTTPParams parsedurl;
            parsedurl = new YGenericHub.HTTPParams(url);
            // Add hub to known list
            if (url.Equals("usb"))
            {
                newhub = new YUSBHub(this, _hubs.Count, true);
            }
            else if (url.Equals("usb_silent"))
            {
                newhub = new YUSBHub(this, _hubs.Count, false);
            }
            else if (url.Equals("net"))
            {
                if ((_apiMode & YAPI.DETECT_NET) == 0)
                {
                    _apiMode |= YAPI.DETECT_NET;
                    // todo: review ssdp callback
                    //_ssdp.addCallback(_ssdpCallback);
                }
                return(YAPI.SUCCESS);
            }
            else if (parsedurl.Host.Equals("callback"))
            {
                //todo: add SUPPORT FOR CALLBACK
                throw new YAPI_Exception(YAPI.NOT_SUPPORTED, "callback is not yet supported");
            }
            else
            {
                newhub = new YHTTPHub(this, _hubs.Count, parsedurl, reportConnnectionLost);
            }
            _hubs.Add(newhub);
            await newhub.startNotifications();

            return(YAPI.SUCCESS);
        }
        /**
         *
         */
        public async Task <int> TestHub(string url, uint mstimeout)
        {
            YGenericHub newhub;

            YGenericHub.HTTPParams parsedurl = new YGenericHub.HTTPParams(url);
            // Add hub to known list
            if (url.Equals("usb"))
            {
                newhub = new YUSBHub(this, 0, true);
            }
            else if (url.Equals("net"))
            {
                return(YAPI.SUCCESS);
            }
            else if (parsedurl.Host.Equals("callback"))
            {
                throw new YAPI_Exception(YAPI.NOT_SUPPORTED, "Not yet supported");
            }
            else
            {
                newhub = new YHTTPHub(this, 0, parsedurl, true);
            }
            return(await newhub.ping(mstimeout));
        }
        //PUBLIC STATIC METHOD:

        /**
         * <summary>
         *   Returns the version identifier for the Yoctopuce library in use.
         * <para>
         *   The version is a string in the form <c>"Major.Minor.Build"</c>,
         *   for instance <c>"1.01.5535"</c>. For languages using an external
         *   DLL (for instance C#, VisualBasic or Delphi), the character string
         *   includes as well the DLL version, for instance
         *   <c>"1.01.5535 (1.01.5439)"</c>.
         * </para>
         * <para>
         *   If you want to verify in your code that the library version is
         *   compatible with the version that you have used during development,
         *   verify that the major number is strictly equal and that the minor
         *   number is greater or equal. The build number is not relevant
         *   with respect to the library compatibility.
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a character string describing the library version.
         * </returns>
         */
        public static string GetAPIVersion()
        {
            return(YOCTO_API_VERSION_STR + ".PATCH_WITH_BUILD" + YUSBHub.imm_getAPIVersion());
        }
Beispiel #6
0
//--- (end of generated code: YAPIContext yapiwrapper)


        /**
         * <summary>
         *   Returns the version identifier for the Yoctopuce library in use.
         * <para>
         *   The version is a string in the form <c>"Major.Minor.Build"</c>,
         *   for instance <c>"1.01.5535"</c>. For languages using an external
         *   DLL (for instance C#, VisualBasic or Delphi), the character string
         *   includes as well the DLL version, for instance
         *   <c>"1.01.5535 (1.01.5439)"</c>.
         * </para>
         * <para>
         *   If you want to verify in your code that the library version is
         *   compatible with the version that you have used during development,
         *   verify that the major number is strictly equal and that the minor
         *   number is greater or equal. The build number is not relevant
         *   with respect to the library compatibility.
         * </para>
         * <para>
         * </para>
         * </summary>
         * <returns>
         *   a character string describing the library version.
         * </returns>
         */
        public static string GetAPIVersion()
        {
            return(YOCTO_API_VERSION_STR + ".45343" + YUSBHub.imm_getAPIVersion());
        }