using System;
using InTheHand.Net.Sockets;
using InTheHand.Net.Bluetooth.Factory;
namespace InTheHand.Net.Bluetooth{
/// <summary>
/// Provides the means to create Bluetooth classes on the one selected Bluetooth
/// stack where multiple are loaded in the same process.
/// </summary>
/// -
/// <remarks>when
/// <para>When calling <c>new BluetoothClient()</c>, <c>new BluetoothListener()</c>,
/// etc when multiple Bluetooth stacks are loaded at the same time then the
/// instance is created on the primary stack. This class allows the application
/// to select which stack the instance is created on.
/// Access this class via property
/// <see cref="P:InTheHand.Net.Bluetooth.BluetoothRadio.StackFactory"/>.
/// </para>
/// </remarks>
public sealed class BluetoothPublicFactory
{
BluetoothFactory m_factory;
#if V1
/*
#endif
#pragma warning disable 1591
#if V1
*/
#endif
internal BluetoothPublicFactory(BluetoothFactory factory)
{
m_factory = factory;
m_factory.ToString();//null check
}
#region Client
public BluetoothClient CreateBluetoothClient()
{
return new BluetoothClient(m_factory);
}
public BluetoothClient CreateBluetoothClient(BluetoothEndPoint localEP)
{
return new BluetoothClient(m_factory, localEP);
}
#endregion
#region Listener
public BluetoothListener CreateBluetoothListener(Guid service)
{
return new BluetoothListener(m_factory, service);
}
public BluetoothListener CreateBluetoothListener(BluetoothAddress localAddress, Guid service)
{
return new BluetoothListener(m_factory, localAddress, service);
}
public BluetoothListener CreateBluetoothListener(BluetoothEndPoint localEP)
{
return new BluetoothListener(m_factory, localEP);
}
public BluetoothListener CreateBluetoothListener(Guid service, byte[] sdpRecord, int channelOffset)
{
return new BluetoothListener(m_factory, service, sdpRecord, channelOffset);
}
public BluetoothListener CreateBluetoothListener(BluetoothAddress localAddress, Guid service, byte[] sdpRecord, int channelOffset)
{
return new BluetoothListener(m_factory, localAddress, service, sdpRecord, channelOffset);
}
public BluetoothListener CreateBluetoothListener(BluetoothEndPoint localEP, byte[] sdpRecord, int channelOffset)
{
return new BluetoothListener(m_factory, localEP, sdpRecord, channelOffset);
}
public BluetoothListener CreateBluetoothListener(Guid service, ServiceRecord sdpRecord)
{
return new BluetoothListener(m_factory, service, sdpRecord);
}
public BluetoothListener CreateBluetoothListener(BluetoothAddress localAddress, Guid service, ServiceRecord sdpRecord)
{
return new BluetoothListener(m_factory, localAddress, service, sdpRecord);
}
public BluetoothListener CreateBluetoothListener(BluetoothEndPoint localEP, ServiceRecord sdpRecord)
{
return new BluetoothListener(m_factory, localEP, sdpRecord);
}
#endregion
#region Security
public IBluetoothSecurity BluetoothSecurity
{
get { return m_factory.DoGetBluetoothSecurity(); }
}
#endregion
#region Misc
public BluetoothDeviceInfo CreateBluetoothDeviceInfo(BluetoothAddress addr)
{
return new BluetoothDeviceInfo(m_factory.DoGetBluetoothDeviceInfo(addr));
}
#endregion
#region OBEX
public ObexWebRequest CreateObexWebRequest(Uri requestUri)
{
ObexWebRequest req = new ObexWebRequest(requestUri, this);
return req;
}
public ObexListener CreateObexListener()
{
ObexListener req = new ObexListener(this);
return req;
}
#endregion
} //class
}
|