using System;
using System.Text;
using InTheHand.Net.Sockets;
using InTheHand.Net.Bluetooth.Factory;
namespace InTheHand.Net.Bluetooth{
class SocketsBluetoothFactory : BluetoothFactory
{
static WindowsBluetoothSecurity m_btSecurity;
public SocketsBluetoothFactory()
{
bool supp = WindowsBluetoothRadio.IsPlatformSupported;
if (!supp)
throw new PlatformNotSupportedException("Microsoft Bluetooth stack not supported (radio).");
}
protected override void Dispose(bool disposing)
{
}
protected override IBluetoothClient GetBluetoothClient()
{
return new SocketBluetoothClient();
}
protected override IBluetoothClient GetBluetoothClient(System.Net.Sockets.Socket acceptedSocket)
{
return new SocketBluetoothClient(acceptedSocket);
}
protected override IBluetoothClient GetBluetoothClient(BluetoothEndPoint localEP)
{
return new SocketBluetoothClient(localEP);
}
protected override IBluetoothListener GetBluetoothListener()
{
return new WindowsBluetoothListener();
}
protected override IBluetoothDeviceInfo GetBluetoothDeviceInfo(BluetoothAddress address)
{
return new WindowsBluetoothDeviceInfo(address);
}
protected override IBluetoothRadio GetPrimaryRadio()
{
return WindowsBluetoothRadio.PrimaryRadio;
}
protected override IBluetoothRadio[] GetAllRadios()
{
return WindowsBluetoothRadio.AllRadios;
}
//----------------
protected override IBluetoothSecurity GetBluetoothSecurity()
{
if (m_btSecurity == null) {
m_btSecurity = new WindowsBluetoothSecurity();
}
return m_btSecurity;
}
}
}
|