示例#1
0
        public MFConfigHelper(MFDevice device)
        {
            m_device = device;

            Microsoft.SPOT.Debugger.ConnectionSource src = device.DbgEngine.ConnectionSource;

            if (src == _DBG.ConnectionSource.Unknown)
            {
                device.Connect(500, true);
            }

            m_fRestartClr = device.DbgEngine.ConnectionSource == Microsoft.SPOT.Debugger.ConnectionSource.TinyCLR;
        }
示例#2
0
        private MFDevice InitializePorts(MFPortDefinition portDefinitionMain, MFPortDefinition portDefinitionTinyBooter)
        {
            MFDevice device = null;

            MFPortDefinition[] portDefs = new MFPortDefinition[2] {
                portDefinitionMain, portDefinitionTinyBooter
            };
            _DBG.PortDefinition[] pds = new Microsoft.SPOT.Debugger.PortDefinition[2];

            for (int i = 0; i < portDefs.Length; i++)
            {
                MFPortDefinition portDefinition = portDefs[i];
                if (portDefinition == null)
                {
                    continue;
                }

                if (portDefinition.Transport == TransportType.TCPIP)
                {
                    System.Net.IPAddress[] addr = System.Net.Dns.GetHostAddresses(portDefinition.Port);

                    pds[i] = new Microsoft.SPOT.Debugger.PortDefinition_Tcp(addr[0]);
                }
                else
                {
                    ArrayList list = _DBG.PortDefinition.Enumerate(_DBG.PortFilter.Usb, _DBG.PortFilter.Serial);
                    foreach (_DBG.PortDefinition pd in list)
                    {
                        if (portDefinition.Port.Length > 0)
                        {
                            if (string.Equals(portDefinition.Port, pd.UniqueId.ToString()))
                            {
                                pds[i] = pd;
                                break;
                            }
                        }
                        if (string.Equals(portDefinition.Name, pd.DisplayName))
                        {
                            pds[i] = pd;
                            break;
                        }
                    }
                }
            }

            if (pds[0] == null && pds[1] != null)
            {
                pds[0] = pds[1];
                pds[1] = null;
            }

            if (pds[0] != null || pds[1] != null)
            {
                device = new MFDevice(pds[0], pds[1]);

                if (!device.Connect(2000, m_tryConnect))
                {
                    throw new MFDeviceNoResponseException();
                }
            }
            else
            {
                throw new MFDeviceUnknownDeviceException();
            }

            return(device);
        }
        public MFConfigHelper(MFDevice device)
        {
            m_device = device;

            Microsoft.SPOT.Debugger.ConnectionSource src = device.DbgEngine.ConnectionSource;

            if(src == _DBG.ConnectionSource.Unknown)
            {
                device.Connect(500, true);
            }

            m_fRestartClr = device.DbgEngine.ConnectionSource == Microsoft.SPOT.Debugger.ConnectionSource.TinyCLR;
        }
示例#4
0
        private MFDevice InitializePorts(MFPortDefinition portDefinitionMain, MFPortDefinition portDefinitionTinyBooter)
        {
            MFDevice device = null;
            MFPortDefinition[] portDefs = new MFPortDefinition[2] { portDefinitionMain, portDefinitionTinyBooter };
            _DBG.PortDefinition[] pds = new Microsoft.SPOT.Debugger.PortDefinition[2];

            for (int i = 0;i < portDefs.Length;i++)
            {
                MFPortDefinition portDefinition = portDefs[i];
                if (portDefinition == null) continue;

                if (portDefinition.Transport == TransportType.TCPIP)
                {
                    System.Net.IPAddress[] addr = System.Net.Dns.GetHostAddresses(portDefinition.Port);

                    pds[i] = new Microsoft.SPOT.Debugger.PortDefinition_Tcp(addr[0]);
                }
                else
                {
                    ArrayList list = _DBG.PortDefinition.Enumerate(_DBG.PortFilter.Usb, _DBG.PortFilter.Serial);
                    foreach (_DBG.PortDefinition pd in list)
                    {
                        if (portDefinition.Port.Length > 0)
                        {
                            if (string.Equals(portDefinition.Port, pd.UniqueId.ToString()))
                            {
                                pds[i] = pd;
                                break;
                            }
                        }
                        if (string.Equals(portDefinition.Name, pd.DisplayName))
                        {
                            pds[i] = pd;
                            break;
                        }
                    }
                }
            }

            if (pds[0] == null && pds[1] != null)
            {
                pds[0] = pds[1];
                pds[1] = null;
            }

            if (pds[0] != null || pds[1] != null)
            {
                device = new MFDevice(pds[0], pds[1]);

                if (!device.Connect(2000, m_tryConnect))
                {
                    throw new MFDeviceNoResponseException();
                }
            }
            else
            {
                throw new MFDeviceUnknownDeviceException();
            }

            return device;
        }