public BluetoothService[] BrowseServices(BluetoothDevice device)
 {
     ValidateThread();
     NativeMethods.GENERAL_SERVICE_INFO[] serviceInfos;
     NativeMethods.BTSTATUS status = NativeMethods.BT_BrowseServices(device.DeviceInfo, true, out serviceInfos);
     ValidateStatus(status);
     BluetoothService[] services = new BluetoothService[serviceInfos.Length];
     for (int i = 0; i < serviceInfos.Length; i++)
     {
         services[i] = new BluetoothService(this, device, serviceInfos[i]);
     }
     return(services);
 }
        public BluetoothConnection ConnectService(BluetoothService service)
        {
            ValidateThread();
            int connectionHandle = 0;

            NativeMethods.BTSTATUS status = NativeMethods.BT_ConnectService(service.Device.DeviceInfo, service.ServiceInfo, ref connectionHandle);
            ValidateStatus(status);
            BluetoothConnection connection = new BluetoothConnection(this, service, connectionHandle);

            lookupConnections.Add(connectionHandle, connection);
            connections.Add(connection);

            OnConnectionOpened(new BluetoothConnectionEventArgs(connection));
            return(connection);
        }
 public BluesoleilDeviceInfo(BluetoothDevice device, BluetoothService service)
 {
     _Device  = device;
     _Service = service;
     _Address = new BluetoothAddress(device.Address);
 }
 internal BluetoothConnection(BluesoleilService owner, BluetoothService service, int connectionHandle)
 {
     this.owner            = owner;
     this.service          = service;
     this.connectionHandle = connectionHandle;
 }