IList <UInt32> FindConnection(UInt32 hDev, UInt16 classId) { var hConnList = new List <UInt32>(); var hEnum = _factory.Api.Btsdk_StartEnumConnection(); if (hEnum == StackConsts.BTSDK_INVALID_HANDLE) { // BTSDK_INVALID_HANDLE here just means there are zero connections. return(hConnList); } while (true) { var connProp = new Structs.BtSdkConnectionPropertyStru(); var hConn = _factory.Api.Btsdk_EnumConnection(hEnum, ref connProp); if (hConn == StackConsts.BTSDK_INVALID_HANDLE) { break; } if (connProp.device_handle != hDev) { continue; } if (connProp.service_class != classId) { continue; } if (connProp.Role != StackConsts.BTSDK_CONNROLE.Initiator) { continue; } hConnList.Add(hConn); } var ret = _factory.Api.Btsdk_EndEnumConnection(hEnum); BluesoleilUtils.Assert(ret, "Btsdk_EndEnumConnection"); return(hConnList); }
internal static extern BTCONNHDL Btsdk_EnumConnection(BTSDKHANDLE enum_handle, ref Structs.BtSdkConnectionPropertyStru conn_prop);
BTCONNHDL IBluesoleilApi.Btsdk_EnumConnection(BTSDKHANDLE enum_handle, ref Structs.BtSdkConnectionPropertyStru conn_prop) { return(NativeMethods.Btsdk_EnumConnection(enum_handle, ref conn_prop)); }