//----
 internal SdpDiscoveryRecordsBuffer(WidcommBluetoothFactoryBase fcty,
                                    IntPtr pList, int recordCount, ServiceDiscoveryParams requestArgs)
     : base(requestArgs)
 {
     if (pList == IntPtr.Zero)
     {
         GC.SuppressFinalize(this);
         throw new ArgumentException("The native pointer pList is NULL.");
     }
     m_filledCount = recordCount;
     m_pBuffer     = pList;
     Debug.Assert(fcty != null, "fcty");
     _fcty = fcty;
 }
 public ISdpDiscoveryRecordsBuffer ReadDiscoveryRecords(BluetoothAddress address, int maxRecords, ServiceDiscoveryParams args)
 {
     return(_child.ReadDiscoveryRecords(address, maxRecords, args));
 }
 protected SdpDiscoveryRecordsBufferBase(ServiceDiscoveryParams query)
 {
     m_request = query;
 }
Esempio n. 4
0
        public ISdpDiscoveryRecordsBuffer ReadDiscoveryRecords(BluetoothAddress address, int maxRecords, ServiceDiscoveryParams args)
        {
            byte[] bdaddr = WidcommUtils.FromBluetoothAddress(address);
            IntPtr pList;
            Guid   filter = args.serviceGuid;
            int    count;

            if (args.searchScope == SdpSearchScope.Anywhere)
            {
                count = NativeMethods.BtIf_ReadDiscoveryRecords(m_pBtIf, bdaddr,
                                                                maxRecords, out pList);
            }
            else
            {
                Debug.Assert(args.searchScope == SdpSearchScope.ServiceClassOnly, "the other enum");
                try {
                    count = NativeMethods.BtIf_ReadDiscoveryRecordsServiceClassOnly(m_pBtIf, bdaddr,
                                                                                    maxRecords, out pList, ref filter);
                } catch (EntryPointNotFoundException ex) {
                    ReportNeedNeedNativeDllUpgrade(ex, true);
                    count = NativeMethods.BtIf_ReadDiscoveryRecords(m_pBtIf, bdaddr,
                                                                    maxRecords, out pList);
                } catch (MissingMethodException ex) { // for NETCF
                    ReportNeedNeedNativeDllUpgrade(ex, true);
                    count = NativeMethods.BtIf_ReadDiscoveryRecords(m_pBtIf, bdaddr,
                                                                    maxRecords, out pList);
                }
            }
            ISdpDiscoveryRecordsBuffer recBuf = new SdpDiscoveryRecordsBuffer(
                _factory, pList, count, args);

            return(recBuf);
        }