Beispiel #1
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            deviceList.Items.Clear();

            Cursor.Current = Cursors.WaitCursor;

            int result;

            try
            {
                result = BSSDK.BS_SearchDeviceInLAN(m_Handle, ref m_NumOfDevice, m_DeviceID, m_DeviceType, m_DeviceAddr);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }

            if (result != BSSDK.BS_SUCCESS)
            {
                MessageBox.Show("Cannot find any device", "Error");
                return;
            }

            for (int i = 0; i < m_NumOfDevice; i++)
            {
                string device = "";

                if (m_DeviceType[i] == BSSDK.BS_DEVICE_BIOSTATION)
                {
                    device += "BioStation ";
                }
                else if (m_DeviceType[i] == BSSDK.BS_DEVICE_BEPLUS)
                {
                    device += "BioEntry Plus ";
                }
                else
                {
                    device += "BioLite Net ";
                }

                device += (m_DeviceAddr[i] & 0xff) + ".";
                device += ((m_DeviceAddr[i] >> 8) & 0xff) + ".";
                device += ((m_DeviceAddr[i] >> 16) & 0xff) + ".";
                device += ((m_DeviceAddr[i] >> 24) & 0xff);

                device += "(" + m_DeviceID[i] + ")";

                deviceList.Items.Add(device);
            }
        }