private void GetEndpointsOfNode(TreeNode devTree) { cboINEndpoint.Items.Clear(); cboOutEndPoint.Items.Clear(); foreach (TreeNode node in devTree.Nodes) { if (node.Nodes.Count > 0) { GetEndpointsOfNode(node); } else { CyUSBEndPoint ept = node.Tag as CyUSBEndPoint; if (ept == null) { //return; } else if (node.Text.Contains("Bulk in")) { CyUSBInterface ifc = node.Parent.Tag as CyUSBInterface; string s = string.Format("ALT-{0}, {1} Byte {2}", ifc.bAlternateSetting, ept.MaxPktSize, node.Text); cboINEndpoint.Items.Add(s); } else if (node.Text.Contains("Bulk out")) { CyUSBInterface ifc = node.Parent.Tag as CyUSBInterface; string s = string.Format("ALT-{0}, {1} Byte {2}", ifc.bAlternateSetting, ept.MaxPktSize, node.Text); cboOutEndPoint.Items.Add(s); } } } }
private void GetEndpointsOfNode(TreeNode devTree) { foreach (TreeNode node in devTree.Nodes) { if (node.Nodes.Count > 0) { GetEndpointsOfNode(node); } else { CyControlEndPoint ctrlEp = node.Tag as CyControlEndPoint; CyBulkEndPoint bulkEp = node.Tag as CyBulkEndPoint; if (ctrlEp != null) { controlEndPoint = ctrlEp; } if (bulkEp != null && bulkEp.bIn) { bulkInEndPoint = bulkEp; CyUSBInterface ifc = node.Parent.Tag as CyUSBInterface; if (ifc != null) { cyDevice.AltIntfc = ifc.bAlternateSetting; } } } } }
// Endpoint private void GetEndpointsOfNode(TreeNode devTree) { // 박스 클리어 ConnectCyUsbInEndpointComboBox.Items.Clear(); ConnectCyUsbOutEndpointComboBox.Items.Clear(); // in Endpoint, out Endpoint 박스에 텍스트 추가 foreach (TreeNode node in devTree.Nodes) { // 노드 맨 하위에 위치한 Endpoint 찾기 if (node.Nodes.Count > 0) { GetEndpointsOfNode(node); } else { CyUSBEndPoint ept = node.Tag as CyUSBEndPoint; if (ept == null) { // Tag가 없으면 pass } // 벌크 인 엔드포인트 정보 찾기 else if (node.Text.Contains("Bulk in")) { // Alterate Setting ?? CyUSBInterface ifc = node.Parent.Tag as CyUSBInterface; string s = string.Format("ALT-{0}, {1} Byte {2}", ifc.bAlternateSetting, ept.MaxPktSize, node.Text); ConnectCyUsbInEndpointComboBox.Items.Add(s); } // 벌크 아웃 엔드포인트 정보 찾기 else if (node.Text.Contains("Bulk out")) { CyUSBInterface ifc = node.Parent.Tag as CyUSBInterface; string s = string.Format("ALT-{0}, {1} Byte {2}", ifc.bAlternateSetting, ept.MaxPktSize, node.Text); ConnectCyUsbOutEndpointComboBox.Items.Add(s); } } } }
/*Summary * Recursive routine populates EndPointsComboBox with strings * representing all the endpoints in the device. */ private void GetEndpointsOfNode(TreeNode devTree) { foreach (TreeNode node in devTree.Nodes) { if (node.Nodes.Count > 0) { GetEndpointsOfNode(node); } else { CyUSBEndPoint ept = node.Tag as CyUSBEndPoint; if (ept == null) { //return; } else if (!node.Text.Contains("Control")) { CyUSBInterface ifc = node.Parent.Tag as CyUSBInterface; string s = string.Format("ALT-{0}, {1} Byte, {2}", ifc.bAlternateSetting, ept.MaxPktSize, node.Text); EndPointsComboBox.Items.Add(s); } } } }