示例#1
0
            public void searchPrinters(IReadOnlyDictionary <string, string> options, IMethodResult oResult)
            {
                Logger.Write("searchPrinters call");
                Logger.Write("options", options);

                tryToConnectInFoundPrinters(oResult);

                DiscoveryPrintersJob job = new DiscoveryPrintersJob();

                Object valueObj         = null;
                int    discoveryTimeout = getTimeout(options);

                Logger.Write("set timeout: " + discoveryTimeout.ToString());

                job.connectionType  = getConnectionType(options);
                job.deviceAdress    = getDeviceAdress(options);
                job.devicePort      = getDevicePort(options);
                job.oResult         = oResult;
                job.zebraSingleton  = this;
                job.isSearchStopped = false;

                if (options.ContainsKey("printerType"))
                {
                    valueObj = options["printerType"];

                    if ((valueObj != null) && (valueObj is String))
                    {
                        String printerType = (String)valueObj;

                        if (!printerType.Equals(ZebraConstants.PRINTER_TYPE_ZEBRA))
                        {
                            sendConnectFinish(ZebraConstants.PRINTER_STATUS_ERR_UNSUPPORTED, oResult);
                            return;
                        }
                    }
                }

                if (discoveryTimeout == 0)
                {
                    job.Connect();
                }
                else
                {
                    job.Connect(discoveryTimeout);
                }

                job.isSearchStopped = true;

                sendConnectFinish(ZebraConstants.PRINTER_STATUS_SUCCESS, oResult);

                Logger.Write("searchPrinters call end");
            }
示例#2
0
        public void searchPrinters(IReadOnlyDictionary<string, string> options, IMethodResult oResult)
        {
            Logger.Write("searchPrinters call");
            Logger.Write("options", options);

            tryToConnectInFoundPrinters(oResult);

            DiscoveryPrintersJob job = new DiscoveryPrintersJob();

            Object valueObj       = null;
            int discoveryTimeout  = getTimeout(options);

            Logger.Write("set timeout: " + discoveryTimeout.ToString());

            job.connectionType    = getConnectionType(options);
            job.deviceAdress      = getDeviceAdress(options);
            job.devicePort        = getDevicePort(options);
            job.oResult           = oResult;
            job.zebraSingleton    = this;
            job.isSearchStopped   = false;

            if (options.ContainsKey("printerType"))
            {
                valueObj = options["printerType"];

                if ((valueObj != null) && (valueObj is String))
                {
                    String printerType = (String)valueObj;

                    if (!printerType.Equals(ZebraConstants.PRINTER_TYPE_ZEBRA))
                    {
                        sendConnectFinish(ZebraConstants.PRINTER_STATUS_ERR_UNSUPPORTED, oResult);
                        return;
                    }
                }
            }

            if (discoveryTimeout == 0)
            {
                job.Connect();
            }
            else
            {
                job.Connect(discoveryTimeout);
            }

            job.isSearchStopped = true;

            sendConnectFinish(ZebraConstants.PRINTER_STATUS_SUCCESS, oResult);

            Logger.Write("searchPrinters call end");
        }