/// <summary>
 /// Keep track of all UPnP devices on the network. The user can expect the OnAddedDeviceSink
 /// delegate to immidiatly be called for each device that is already known that matches the
 /// filter.
 /// </summary>
 /// <param name="OnAddedDeviceSink">Delegate called when a UPnP device is detected that match the filter</param>
 /// <param name="DevicePartialMatchFilter">Sets the filter to UPnP devices that start with this string</param>
 public UPnPSmartControlPoint(DeviceHandler OnAddedDeviceSink, ServiceHandler OnAddedServiceSink, string DevicePartialMatchFilter)
     : this(OnAddedDeviceSink, OnAddedServiceSink, new string[1] {
     DevicePartialMatchFilter
 })
 {
     MultiFilter = false;
 }
Пример #2
0
        private void MenuItem1Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.InitialDirectory = DeviceHandler.GetSpoolDirectory();
            fileDialog.Filter           = "Spool Shadow File (*.shd)|*.shd|Todos os arquivos (*.*)|*.*";
            // Exibe a caixa de seleção de arquivo e verifica o resultado da interação do usuário
            DialogResult openFileResult = fileDialog.ShowDialog();

            if (openFileResult == DialogResult.Cancel)
            {
                return;
            }

            String shadowFilename = fileDialog.FileName;

            if (File.Exists(shadowFilename))
            {
                SpooledJob      spooledJob = new SpooledJob(shadowFilename, this);
                String          jobName    = spooledJob.ShadowFile.PrinterName + ", " + spooledJob.ShadowFile.JobId.ToString();
                ManagedPrintJob managedJob = new ManagedPrintJob(jobName);
                String          jobInfo    = GetJobInfo(spooledJob, managedJob);
                jobInfoBox.Invoke(new PerformTextOutputDelegate(LogJobInfo), jobInfo);
            }
        }
Пример #3
0
        /// <summary>
        ///  Update is called once per frame
        /// </summary>
        public void Update()
        {
            if (LayoutController == null || DeviceHandler == null)
            {
                return;
            }

            if (Xdk.BluetoothState == BluetoothLeDeviceState.DiscoveringDevices || Xdk.BluetoothState == BluetoothLeDeviceState.DiscoveredDevices)
            {
                LayoutController.VisibleDialog = this;
                switch (Xdk.BluetoothState)
                {
                case BluetoothLeDeviceState.Initialized:
                    ClearDeviceList();
                    break;

                case BluetoothLeDeviceState.DiscoveredDevices:
                    UpdateDevices(DeviceHandler.GetRecentlyDiscoveredDevices());
                    break;
                }
            }
            else if (IsEnabled)
            {
                IsEnabled = false;
            }
        }
Пример #4
0
 public void OnConnect(string deviceAddress)
 {
     if (DeviceHandler != null)
     {
         Debug.Log("Connecting to " + deviceAddress);
         Xdk.Reset();
         DeviceHandler.ConnectToPeripheral(deviceAddress);
     }
 }
Пример #5
0
        public BL_DeviceManagment()
        {
            devices = new Devices();
            //clustering = new DeviceCLusterring();
            DeviceFoundEvent      += new DeviceHandler(devices.ADDdevice);
            RemoveDeviceEvent     += new DeviceHandler(devices.RemoveDevice);
            DevicePositionChanged += new DeviceHandlerPosition(devices.ChangePosition);
            InitialDeviceClustering();

            //testing
            //TestingMethod();
        }
Пример #6
0
        private void ClientSocket_MessageReceived(object sender, UdpReceiveResult e)
        {
            var response = e.Buffer;

            if (response != null)
            {
                var discoveredDevice = CreateBroadlinkDevice(BitConverter.ToInt16(response, 0x34));
                discoveredDevice.EndPoint   = e.RemoteEndPoint;
                discoveredDevice.MacAddress = response.Slice(0x3a, 0x40);
                DeviceHandler?.Invoke(this, discoveredDevice);
            }
        }
        /// <summary>
        /// Keep track of all UPnP devices on the network. The user can expect the OnAddedDeviceSink or OnAddedServiceSink
        /// delegate to immidiatly be called for each device that is already known.
        /// <para>
        /// if multiple filters are supplied, the results will be that of the parent device which satisfies all the search criteria.
        /// </para>
        /// </summary>
        /// <param name="OnAddedDeviceSink"></param>
        /// <param name="OnAddedServiceSink"></param>
        /// <param name="Filters">Array of strings, which represent the search criteria</param>
        public UPnPSmartControlPoint(DeviceHandler OnAddedDeviceSink, ServiceHandler OnAddedServiceSink, string[] Filters)
        {
            //MultiFilter = true;
            PartialMatchFilters = new String[Filters.Length];
            MinimumVersion      = new double[Filters.Length];
            for (int i = 0; i < PartialMatchFilters.Length; ++i)
            {
                if (Filters[i].Length > 15 && Filters[i].Length > UPnPStringFormatter.GetURNPrefix(Filters[i]).Length)
                {
                    PartialMatchFilters[i] = UPnPStringFormatter.GetURNPrefix(Filters[i]);
                    try
                    {
                        MinimumVersion[i] = double.Parse(Filters[i].Substring(PartialMatchFilters[i].Length), new CultureInfo("en-US").NumberFormat);
                    }
                    catch
                    {
                        MinimumVersion[i] = 1.0;
                    }
                }
                else
                {
                    PartialMatchFilters[i] = Filters[i];
                    MinimumVersion[i]      = 1.0;
                }
            }

            if (OnAddedDeviceSink != null)
            {
                this.OnAddedDevice += OnAddedDeviceSink;
            }
            if (OnAddedServiceSink != null)
            {
                this.OnAddedService += OnAddedServiceSink;
            }

            iSCP = new UPnPInternalSmartControlPoint(1 == Filters.Length ? Filters[0] : "upnp:rootdevice");

            iSCP.OnAddedDevice   += new UPnPInternalSmartControlPoint.DeviceHandler(HandleAddedDevice);
            iSCP.OnDeviceExpired += new UPnPInternalSmartControlPoint.DeviceHandler(HandleExpiredDevice);
            iSCP.OnRemovedDevice += new UPnPInternalSmartControlPoint.DeviceHandler(HandleRemovedDevice);
            iSCP.OnUpdatedDevice += new UPnPInternalSmartControlPoint.DeviceHandler(HandleUpdatedDevice);

            IEnumerator cdEN = iSCP.GetCurrentDevices().GetEnumerator();

            if ((OnAddedDeviceSink != null || OnAddedServiceSink != null) && cdEN != null)
            {
                while (cdEN.MoveNext())
                {
                    HandleAddedDevice(null, (UPnPDevice)cdEN.Current);
                }
            }
        }
Пример #8
0
        /// <summary>
        /// Constroi uma instancia da classe SpoolMonitor. Inicia o monitoramento ( intercepta
        /// arquivos Shadow (*.SHD) criados/modificados/excluidos no diretório de spool )
        /// </summary>
        public SpoolMonitor(IListener listener)
        {
            this.listener = listener;

            FileSystemWatcher fileWatcher = new FileSystemWatcher(DeviceHandler.GetSpoolDirectory(), "*.shd");

            fileWatcher.IncludeSubdirectories = false;
            fileWatcher.NotifyFilter          = NotifyFilters.LastWrite | NotifyFilters.FileName;
            fileWatcher.Created            += new FileSystemEventHandler(SpoolFileCreated);
            fileWatcher.Changed            += new FileSystemEventHandler(SpoolFileChanged);
            fileWatcher.Deleted            += new FileSystemEventHandler(SpoolFileDeleted);
            fileWatcher.EnableRaisingEvents = true;
        }
Пример #9
0
        public UPnPSmartControlPoint(DeviceHandler OnAddedDeviceSink, ServiceHandler OnAddedServiceSink, string[] Filters)
        {
            this.MultiFilter         = true;
            this.PartialMatchFilters = new string[] { "upnp:rootdevice" };
            this.MinimumVersion      = new double[] { 1.0 };
            this.PartialMatchFilters = new string[Filters.Length];
            this.MinimumVersion      = new double[Filters.Length];
            for (int i = 0; i < this.PartialMatchFilters.Length; i++)
            {
                if ((Filters[i].Length > 15) && (Filters[i].Length > UPnPStringFormatter.GetURNPrefix(Filters[i]).Length))
                {
                    this.PartialMatchFilters[i] = UPnPStringFormatter.GetURNPrefix(Filters[i]);
                    try
                    {
                        this.MinimumVersion[i] = double.Parse(Filters[i].Substring(this.PartialMatchFilters[i].Length), new CultureInfo("en-US").NumberFormat);
                    }
                    catch
                    {
                        this.MinimumVersion[i] = 1.0;
                    }
                }
                else
                {
                    this.PartialMatchFilters[i] = Filters[i];
                    this.MinimumVersion[i]      = 1.0;
                }
            }
            if (OnAddedDeviceSink != null)
            {
                this.OnAddedDevice = (DeviceHandler)Delegate.Combine(this.OnAddedDevice, OnAddedDeviceSink);
            }
            if (OnAddedServiceSink != null)
            {
                this.OnAddedService = (ServiceHandler)Delegate.Combine(this.OnAddedService, OnAddedServiceSink);
            }
            iSCP.OnAddedDevice   += new UPnPInternalSmartControlPoint.DeviceHandler(this.HandleAddedDevice);
            iSCP.OnDeviceExpired += new UPnPInternalSmartControlPoint.DeviceHandler(this.HandleExpiredDevice);
            iSCP.OnRemovedDevice += new UPnPInternalSmartControlPoint.DeviceHandler(this.HandleRemovedDevice);
            iSCP.OnUpdatedDevice += new UPnPInternalSmartControlPoint.DeviceHandler(this.HandleUpdatedDevice);
            IEnumerator enumerator = iSCP.GetCurrentDevices().GetEnumerator();

            if (((OnAddedDeviceSink != null) || (OnAddedServiceSink != null)) && (enumerator != null))
            {
                while (enumerator.MoveNext())
                {
                    this.HandleAddedDevice(null, (UPnPDevice)enumerator.Current);
                }
            }
        }
Пример #10
0
 // Start is called before the first frame update
 void Start()
 {
     Debug.Log("***API*** Start!");
     _xmlHelper         = XmlHelper.Instance();
     _itemDatabase      = ItemDatabase.Instance();
     _userDatabase      = UserDatabase.Instance();
     _characterDatabase = CharacterDatabase.Instance();
     _terrainDatabase   = TerrainDatabase.Instance();
     _gameLoadHelper    = GameObject.Find("GameStarter").GetComponent <GameLoadHelper>();
     //Call UserPlayer
     //_apiGate = "GetUserPlayer";
     //_uri = String.Format(ApiPath + ApiStage + _apiGate + "?id={0}", DeviceHandler.FetchMacId());
     //StartCoroutine(GetRequest(_uri, ReadUserPlayerJson));
     ReadUserPlayerXml(DeviceHandler.FetchMacId());
 }
Пример #11
0
        public bool IsVivo45Connected()
        {
            IDeviceFinder[] finders = new IDeviceFinder[]
            {
                new LibUsbDeviceFinder()
            };
            handler              = new DeviceHandler(Vivo45Product.All, finders);
            handler.DeviceFound += V45DeviceFound;
            handler.DeviceLost  += V45DeviceLost;

            List <Device> deviceList = handler.FindDevices();

            if (deviceList.Count < 1)
            {
                return(false);
            }
            return(true);
        }
Пример #12
0
            /// <summary>
            /// Returns Device Handler (Defaults to First Found (0))
            /// </summary>
            /// <returns></returns>
            public DeviceHandler MyDevice(int DeviceNum = 0)
            {
                DeviceHandler mydevice = null;

                if (Connect())
                {
                    List <DeviceObject> devices = _jdownloaderHandler.GetDevices(); // GetDeviceInstance(devices[0]);

                    if (devices.Count == 0)
                    {
                        return(null);
                    }

                    mydevice = _jdownloaderHandler.GetDeviceHandler(devices[DeviceNum]);
                }

                return(mydevice);
            }
        public void OnSamplingRateChanged(Slider slider)
        {
            if (_isUpdatingSlider)
            {
                return;
            }

            var milliseconds = (uint)(1000f / slider.value);

            Debug.Log("OnSamplingRateChanged " + slider.value);
            SetUiComponentText(string.Format("{0:0} Hz", slider.value), DeviceSamplingRateLabel);

            if (Xdk != null && DeviceHandler != null)
            {
                milliseconds = Math.Max(Xdk.NotificationSamplingTime.Min, milliseconds);
                milliseconds = Math.Min(Xdk.NotificationSamplingTime.Max, milliseconds);
                Xdk.NotificationSamplingTime.Value = milliseconds;
                DeviceHandler.SendSamplingTime(milliseconds);
            }
        }
Пример #14
0
        // Win32_Printer
        // Win32_PrinterConfiguration
        // Win32_PrinterController
        // Win32_PrinterDriver
        // Win32_PrinterDriverDll
        // Win32_PrinterSetting
        // Win32_PrinterShare
        // Win32_PrintJob

        private void button1_Click(object sender, EventArgs e)
        {
            infoBox.Clear();

            DeviceHandler.PreparePrinters(this);
            List <SysPrinter> sysPrinters = DeviceHandler.MapSystemPrinters(Environment.MachineName);

            foreach (SysPrinter printer in sysPrinters)
            {
                infoBox.Text += printer.Name + "   " + printer.Port + "   " + printer.ComputerName + " BIDI=" + printer.EnableBIDI + Environment.NewLine;
                foreach (PrinterCapabilityEnum capability in printer.Capabilities)
                {
                    String capabilityName = AssociatedText.GetFieldDescription(typeof(PrinterCapabilityEnum), capability.ToString());
                    infoBox.Text += capabilityName + Environment.NewLine;
                }
                infoBox.Text += Environment.NewLine + Environment.NewLine;
            }

            infoBox.Text += "Total de impressoras (sistema de accounting)  = " + sysPrinters.Count.ToString();
        }
Пример #15
0
 public UserPlayer(string userName, string description)
 {
     Id          = UnityEngine.Random.Range(0, 1999999999);
     UserName    = userName;
     Description = description;
     SoundVolume = 0.1f;
     Latitude    = 0;
     Longitude   = 0;
     Gem         = 5;
     LastLogin   = "";
     LockUntil   = "";
     LockMins    = 0;
     PRank       = 0;
     ClanId      = 0;
     ClanRank    = 0;
     FBLoggedIn  = false;
     FBid        = "Facebook";
     Gid         = "Google";
     MacId       = DeviceHandler.FetchMacId();
     GLoggedIn   = false;
     IsEnable    = true;
 }
Пример #16
0
 /// <summary>
 /// Keep track of all UPnP devices on the network. The user can expect the OnAddedDeviceSink
 /// delegate to immidiatly be called for each device that is already known.
 /// </summary>
 /// <param name="OnAddedDeviceSink"></param>
 /// <param name="DevicePartialMatchFilter"></param>
 public UPnPSmartControlPoint(DeviceHandler OnAddedDeviceSink, string DevicePartialMatchFilter)
     : this(OnAddedDeviceSink, null, DevicePartialMatchFilter)
 {
 }
Пример #17
0
 /// <summary>
 /// Keep track of all UPnP devices on the network. The user can expect the OnAddedDeviceSink
 /// delegate to immidiatly be called for each device that is already known.
 /// </summary>
 /// <param name="OnAddedDeviceSink">Delegate called when a UPnP device is detected</param>
 public UPnPSmartControlPoint(DeviceHandler OnAddedDeviceSink)
     : this(OnAddedDeviceSink, "upnp:rootdevice")
 {
 }
Пример #18
0
 /// <summary>
 /// Keep track of all UPnP devices on the network. The user can expect the OnAddedDeviceSink
 /// delegate to immidiatly be called for each device that is already known that matches the
 /// filter.
 /// </summary>
 /// <param name="OnAddedDeviceSink">Delegate called when a UPnP device is detected that match the filter</param>
 /// <param name="DevicePartialMatchFilter">Sets the filter to UPnP devices that start with this string</param>
 public UPnPSmartControlPoint(DeviceHandler OnAddedDeviceSink, ServiceHandler OnAddedServiceSink, string DevicePartialMatchFilter)
     : this(OnAddedDeviceSink, OnAddedServiceSink, new string[1] { DevicePartialMatchFilter })
 {
     MultiFilter = false;
 }
Пример #19
0
        /// <summary>
        /// Keep track of all UPnP devices on the network. The user can expect the OnAddedDeviceSink or OnAddedServiceSink
        /// delegate to immidiatly be called for each device that is already known.
        /// <para>
        /// if multiple filters are supplied, the results will be that of the parent device which satisfies all the search criteria. 
        /// </para>
        /// </summary>
        /// <param name="OnAddedDeviceSink"></param>
        /// <param name="OnAddedServiceSink"></param>
        /// <param name="Filters">Array of strings, which represent the search criteria</param>
        public UPnPSmartControlPoint(DeviceHandler OnAddedDeviceSink, ServiceHandler OnAddedServiceSink, string[] Filters)
        {
            //MultiFilter = true;
            PartialMatchFilters = new String[Filters.Length];
            MinimumVersion = new double[Filters.Length];
            for (int i = 0; i < PartialMatchFilters.Length; ++i)
            {
                if (Filters[i].Length > 15 && Filters[i].Length > UPnPStringFormatter.GetURNPrefix(Filters[i]).Length)
                {
                    PartialMatchFilters[i] = UPnPStringFormatter.GetURNPrefix(Filters[i]);
                    try
                    {
                        MinimumVersion[i] = double.Parse(Filters[i].Substring(PartialMatchFilters[i].Length), new CultureInfo("en-US").NumberFormat);
                    }
                    catch
                    {
                        MinimumVersion[i] = 1.0;
                    }
                }
                else
                {
                    PartialMatchFilters[i] = Filters[i];
                    MinimumVersion[i] = 1.0;
                }

            }

            if (OnAddedDeviceSink != null) { this.OnAddedDevice += OnAddedDeviceSink; }
            if (OnAddedServiceSink != null) { this.OnAddedService += OnAddedServiceSink; }

            iSCP.OnAddedDevice += new UPnPInternalSmartControlPoint.DeviceHandler(HandleAddedDevice);
            iSCP.OnDeviceExpired += new UPnPInternalSmartControlPoint.DeviceHandler(HandleExpiredDevice);
            iSCP.OnRemovedDevice += new UPnPInternalSmartControlPoint.DeviceHandler(HandleRemovedDevice);
            iSCP.OnUpdatedDevice += new UPnPInternalSmartControlPoint.DeviceHandler(HandleUpdatedDevice);

            IEnumerator cdEN = iSCP.GetCurrentDevices().GetEnumerator();
            if ((OnAddedDeviceSink != null || OnAddedServiceSink != null) && cdEN != null)
            {
                while (cdEN.MoveNext()) { HandleAddedDevice(null, (UPnPDevice)cdEN.Current); }
            }
        }
Пример #20
0
 // Start is called before the first frame update
 void Start()
 {
     DeviceHandler.DisplayTypeAndAddress();
     print(DeviceHandler.FetchMacId());
 }
 /// <summary>
 /// Keep track of all UPnP devices on the network. The user can expect the OnAddedDeviceSink
 /// delegate to immidiatly be called for each device that is already known.
 /// </summary>
 /// <param name="OnAddedDeviceSink">Delegate called when a UPnP device is detected</param>
 public UPnPSmartControlPoint(DeviceHandler OnAddedDeviceSink)
     : this(OnAddedDeviceSink, "upnp:rootdevice")
 {
 }
Пример #22
0
 public Scene(DeviceHandler Devices, AudioHandler AudioHandler, Timer Timer)
 {
     this.Devices      = Devices;
     this.AudioHandler = AudioHandler;
     this.Timer        = Timer;
 }
 /// <summary>
 /// Keep track of all UPnP devices on the network. The user can expect the OnAddedDeviceSink
 /// delegate to immidiatly be called for each device that is already known.
 /// </summary>
 /// <param name="OnAddedDeviceSink"></param>
 /// <param name="DevicePartialMatchFilter"></param>
 public UPnPSmartControlPoint(DeviceHandler OnAddedDeviceSink, string DevicePartialMatchFilter)
     : this(OnAddedDeviceSink, null, DevicePartialMatchFilter)
 {
 }
Пример #24
0
 public SceneBmsSP(DeviceHandler Devices, SkinBmsSP SkinBmsSp, AudioHandler AudioHandler, Timer Timer) : base(Devices, AudioHandler, Timer)
 {
     this.State = new StateBmsSP(Devices);
     this.Skin  = SkinBmsSp;
 }
Пример #25
0
 public CmcmService(DeviceInfo devInfo)
 {
     ServiceName    = $"{SysConf.ModuleName}:{devInfo.Id}";
     _deviceHandler = new DeviceHandler(this, devInfo, new CmcmDeviceApi(ServiceName, devInfo.IpAddress, devInfo.Port));
     TimeSpan       = devInfo.PollingTime;
 }
 public void OnShowDeviceList()
 {
     Debug.Log("OnShowDeviceList");
     DeviceHandler.Disconnect();
 }
 public void OnResetXdk()
 {
     Debug.Log("OnResetXdk");
     DeviceHandler.SendReset();
 }
Пример #28
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = DeviceHandler.GetSpoolDirectory();
            openFileDialog.Filter           = "Spool Shadow File (*.shd)|*.shd|Todos os arquivos (*.*)|*.*";
            DialogResult dialogResult = openFileDialog.ShowDialog();

            if (dialogResult == DialogResult.Cancel)
            {
                return;
            }

            SpooledJob spooledJob = new SpooledJob(openFileDialog.FileName, this);
            Dictionary <String, Object> jobSummary = PrintJobContext.GetJobSummary(spooledJob);

            infoBox.Clear();
            infoBox.Text += "Documento: " + jobSummary["documentName"] + Environment.NewLine;
            infoBox.Text += "Hora: " + jobSummary["submitted"] + Environment.NewLine;
            infoBox.Text += "UserName: "******"userName"] + Environment.NewLine;
            infoBox.Text += "PrinterName: " + jobSummary["printerName"] + Environment.NewLine;
            infoBox.Text += "Número de cópias: " + jobSummary["copyCount"] + Environment.NewLine;
            infoBox.Text += "Número de páginas: " + jobSummary["pageCount"] + Environment.NewLine;


            /**************************************************************************************/
            /***********************            Extra job info              ***********************/
            /**************************************************************************************/
            infoBox.Text += Environment.NewLine;
            infoBox.Text += "Driver Name: " + spooledJob.ShadowFile.DriverName + Environment.NewLine;
            infoBox.Text += "Notify Name: " + spooledJob.ShadowFile.NotifyName + Environment.NewLine;
            infoBox.Text += "Print Processor: " + spooledJob.ShadowFile.PrintProcessor + Environment.NewLine;
            infoBox.Text += "Port: " + spooledJob.ShadowFile.Port + Environment.NewLine;
            infoBox.Text += "JobId: " + spooledJob.ShadowFile.JobId.ToString() + Environment.NewLine;
            infoBox.Text += "Data type: " + jobSummary["dataType"] + Environment.NewLine;
            infoBox.Text += "Spool fileSize: " + jobSummary["spoolFileSize"] + "(" + GetPrivateFieldValue(spooledJob.ShadowFile, "spoolFileSize") + " bytes)" + Environment.NewLine;

            /**************************************************************************************/
            /***********************             DevMode info               ***********************/
            /**************************************************************************************/
            infoBox.Text += Environment.NewLine;
            infoBox.Text += "Device Name: " + spooledJob.ShadowFile.DevMode.DeviceName + Environment.NewLine;
            infoBox.Text += "Form Name: " + spooledJob.ShadowFile.DevMode.FormName + Environment.NewLine;

            infoBox.Text += Environment.NewLine;
            infoBox.Text += "Número de páginas = " + spooledJob.SpoolFile.Pages.Count.ToString() + Environment.NewLine;

            // Encerra o método caso não seja um EMF
            if (!spooledJob.ShadowFile.DataType.ToUpper().Contains("EMF"))
            {
                return;
            }

            imgPageView.Image = ((EMFPage)spooledJob.SpoolFile.Pages[0]).Thumbnail;

            int index = 0;

            foreach (EMFPage page in spooledJob.SpoolFile.Pages)
            {
                index++;
                EMFReader.Save(page.PageImage, @"C:\page" + index.ToString() + ".emf");
            }
        }