unsafe uint RegisterBthDevices() { devicectrl.DeviceInfo[] PeerDevicesInfo; int iNumDevices = DevCtrl.BthGetNumDevices(DevCtrl.m_hBt); if (iNumDevices == 0) { return(0); } Module mod = Assembly.GetExecutingAssembly().GetModules()[0]; string appPath = Path.GetDirectoryName(mod.FullyQualifiedName) + "\\scanlist.dat"; using (StreamWriter sw = new StreamWriter(appPath)) { PeerDevicesInfo = new devicectrl.DeviceInfo[iNumDevices]; DevCtrl.BthGetDeviceInfo(DevCtrl.m_hBt, PeerDevicesInfo); for (int iCount = 0; iCount < iNumDevices; iCount++) { char[] outstr = new char[devicectrl.MAX_NAME_SIZE]; fixed(char *addr = PeerDevicesInfo[iCount].szDeviceNameAddr) { string id = new string(addr); sw.WriteLine(id); } } } return((uint)iNumDevices); }
unsafe uint RegisterBthDevices() { devicectrl.DeviceInfo[] PeerDevicesInfo; int iNumDevices = DevCtrl.BthGetNumDevices(DevCtrl.m_hBt); if (iNumDevices == 0) return 0; Module mod = Assembly.GetExecutingAssembly().GetModules()[0]; string appPath = Path.GetDirectoryName(mod.FullyQualifiedName) + "\\scanlist.dat"; using (StreamWriter sw = new StreamWriter(appPath)) { PeerDevicesInfo = new devicectrl.DeviceInfo[iNumDevices]; DevCtrl.BthGetDeviceInfo(DevCtrl.m_hBt, PeerDevicesInfo); for(int iCount = 0; iCount < iNumDevices;iCount++) { char[] outstr = new char[devicectrl.MAX_NAME_SIZE]; fixed (char* addr = PeerDevicesInfo[iCount].szDeviceNameAddr) { string id = new string(addr); sw.WriteLine(id); } } } return (uint)iNumDevices; }